Skip to content

app-server: clear stale thread watches after v2 agent interruption - #27166

Merged
jif-oai merged 2 commits into
mainfrom
jif/fix-tui-2
Jun 9, 2026
Merged

app-server: clear stale thread watches after v2 agent interruption#27166
jif-oai merged 2 commits into
mainfrom
jif/fix-tui-2

Conversation

@jif-oai

@jif-oai jif-oai commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Why

PR #27007 moved MultiAgentV2 interruption reporting from the legacy collaboration close event to SubAgentActivity::Interrupted. App-server's missing-thread cleanup still ran only for the legacy event, so an interrupted child that had already been unloaded could remain marked as loaded and running in ThreadWatchManager. That leaves thread status and running-turn accounting stale, including the count used during graceful shutdown.

What changed

  • Handle SubAgentActivity::Interrupted separately in app-server event processing.
  • Remove the child's thread watch when ThreadManager no longer has that thread.
  • Continue forwarding the same completed sub-agent activity notification to clients.

Testing

  • Added a regression test that starts with a running watch for an unloaded child, applies the interrupted activity event, and verifies the watch is removed, the running count returns to zero, and the client notification is still emitted.

@jif-oai jif-oai changed the title fix: app-server app-server: clear stale thread watches after v2 agent interruption Jun 9, 2026
@jif-oai

jif-oai commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Hooray!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@jif-oai
jif-oai merged commit 1547785 into main Jun 9, 2026
31 checks passed
@jif-oai
jif-oai deleted the jif/fix-tui-2 branch June 9, 2026 11:27
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant