Repository navigation
fix(state): leave a subagent's tool calls unreported - #81
Merged
Merged
Conversation
Claude Code fires the session's PreToolUse and PostToolUse for its subagents' tools, adding agent_id (measured on 2.1.302). A background agent, and most likely the prompt-suggestion fork, run tools after Stop, which put a finished card back on busy naming a tool nobody ran. report-tool.sh and report-state.sh busy now drop a payload carrying agent_id. Contract: lichdotdev/lich#784.
Merged
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.
Why
A finished Claude Code card went back to a spinner naming a tool nobody ran, two seconds after
Stop, until the next prompt. Measured on Claude Code 2.1.302: a subagent's tool calls fire the session's ownPreToolUseandPostToolUse, with the session'ssession_idplusagent_id, and some run afterStop(a background agent; most likely also the prompt-suggestion fork).Contract: lichdotdev/lich#784.
What
conversation-id.shgainsfrom_subagent:has("agent_id")with jq, agrepwithout it.report-tool.shdrops a subagent's call;report-state.shdrops onlybusyfrom one, so a turn still opens, blocks and ends on the session's own events.docs/session-state.mdand aCHANGELOG.mdFixed entry.Trade-offs, documented: inside a turn the card's tool line keeps naming the
Agentcall while the subagent works; without jq the match is not anchored to the top level, so a tool input carrying its ownagent_idgoes unreported too.Verified
node --test tests/*.test.mjs: 433 pass. The six new tests failed before the fix.busy+Agentthendone; the background Explore agent'sBashone second later reached the stub with nothing.