Skip to content

fix(state): leave a subagent's tool calls unreported - #81

Merged
omartelo merged 1 commit into
mainfrom
fix/subagent-tool-reports
Oct 17, 2026
Merged

omartelo merged 1 commit into
mainfrom
fix/subagent-tool-reports

Conversation

@omartelo

Copy link
Copy Markdown
Collaborator

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 own PreToolUse and PostToolUse, with the session's session_id plus agent_id, and some run after Stop (a background agent; most likely also the prompt-suggestion fork).

Contract: lichdotdev/lich#784.

What

  • conversation-id.sh gains from_subagent: has("agent_id") with jq, a grep without it.
  • report-tool.sh drops a subagent's call; report-state.sh drops only busy from one, so a turn still opens, blocks and ends on the session's own events.
  • docs/session-state.md and a CHANGELOG.md Fixed entry.

Trade-offs, documented: inside a turn the card's tool line keeps naming the Agent call while the subagent works; without jq the match is not anchored to the top level, so a tool input carrying its own agent_id goes unreported too.

Verified

  • node --test tests/*.test.mjs: 433 pass. The six new tests failed before the fix.
  • Live run, installed plugin disabled, scripts from this branch against a stub listener: the main turn reported busy + Agent then done; the background Explore agent's Bash one second later reached the stub with nothing.

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.
@omartelo
omartelo merged commit a25664e into main Oct 17, 2026
2 checks passed
@omartelo omartelo mentioned this pull request Oct 17, 2026
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