Skip to content

Claude Code mod: a subagent's turn no longer leaves the session busy for good - #1979

Merged
backnotprop merged 1 commit into
mainfrom
mod-busy-subagent-fix
Oct 17, 2026
Merged

backnotprop merged 1 commit into
mainfrom
mod-busy-subagent-fix

Conversation

@backnotprop

Copy link
Copy Markdown
Owner

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, while turn.complete for that turn is filtered out by agent id. Once a subagent started, runningTurnId held the subagent's turn id, the main turn's end no longer matched it, and the session read busy forever (busy: true, idle_since: null on 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.ts passes e.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's turn.start through 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 validate passes.

…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>
@backnotprop
backnotprop merged commit a8fe402 into main Oct 17, 2026
41 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant