Repository navigation
Claude Code mod: a subagent's turn no longer leaves the session busy for good - #1979
Merged
Merged
Conversation
…for good Every hook hears a subagent's turn.start (a background one included), and the mod counted it as the session's running turn, while its turn.complete is filtered out by agent id. Once a subagent started, the session read busy forever (busy: true, idle_since null), so the Plannotator Inbox wake, which waits for idle, never delivered a reply, and Ask this session read busy too. onTurnStart now ignores turns with an agent id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
Every hooks-module hook hears a subagent's
turn.start(a background one included; the engine's API says so: "The hooks an agent's spawn was nested in do not hear its start … every other hook does"). The Claude Code mod counted it as the session's running turn, whileturn.completefor that turn is filtered out by agent id. Once a subagent started,runningTurnIdheld the subagent's turn id, the main turn's end no longer matched it, and the session read busy forever (busy: true, idle_since: nullon the Inbox's live sessions).Consequences: the Plannotator Inbox wake waits for idle, so a reply to that session never went in; "Ask this session" read busy too. This is happening now on the owner's machine: two sessions show busy with no idle since, and Inbox replies to them never woke them.
The fix
PlannotatorMod.onTurnStart(turnId, text, agentId?)ignores a turn with an agent id;register.tspassese.agentId. Split out of #1968 (which carries the same change) so it can merge right away.Tests
apps/hook/tests/register.test.ts(the engine harness,claude plugin test): a subagent'sturn.startthrough the engine, then a reply: it arrives as a turn. It fails without the fix.apps/hook/hooks/mod/controller.test.ts: a background subagent starting during the main turn and after it never makes the session busy.claude plugin validatepasses.