You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sidebar shows Claude Code web-fetch subagent as running forever (no SubagentStart/SubagentStop for it) #464
After a Clau
9859
de Code turn that used the built-in web-fetch subagent, the pane's sidebar keeps a web-fetch subagent line in the running state. The session is idle at its prompt, and the line stays until the session ends (SessionEnd).
Why
Claude Code (2.1.302) fires no SubagentStart and no SubagentStop for the built-in web-fetch subagent. Its tool calls still fire PreToolUse with agent_id and agent_type: "web-fetch".
In wmux 2.64.0:
PreToolUse with an agent_id → reportSubagent(sid, { id, name, toolUse: true }), which creates a declared line.
The line ends only on SubagentStop with that agent_id, on SessionEnd, or on a fresh SessionStart.
So the line gets created and nothing ever ends it.
Repro (hook logger, no wmux needed)
hooks.json logs SubagentStart / SubagentStop / PreToolUse / Stop payloads to a file. Then run:
echo "Use the Agent tool with subagent_type web-fetch to fetch https://example.com and report its title." \
| claude -p --settings hooks.json --allowedTools Agent WebFetch
Logged events:
subagent_type
SubagentStart
PreToolUse inside (agent_id)
SubagentStop
web-fetch
—
WebFetch, agent_type: web-fetch
—
general-purpose (same setup, Glob)
✓
✓
✓
The subagent's subagents/agent-<id>.meta.json has "finished": true, "requestShape": "foreground", so Claude Code considers it done.
Possible fixes (your call)
A declared line that was created from a tool event and never had a SubagentStart could end on the parent's Stop. A subagent with no SubagentStart can't be the background kind that handle subprocess status #272 keeps alive.
Or end the line on the parent's PostToolUse for Agent, if its tool_response carries the agentId.
The missing hooks are arguably a Claude Code bug. Even so, wmux would need a fallback for any subagent type that skips the lifecycle hooks.
Thanks for the trace, it made this quick. I reproduced it with the same hook logger on Claude Code 2.1.323: web-fetch still fires no SubagentStart and no SubagentStop.
The line ends when the parent's Agent call returns. The parent's PostToolUse for Agent does carry the id: tool_response.agentId, with status: "completed". The hook helper forwards that id and nothing else from the response. A background launch answers with another status, so it keeps running.
Backstop: the parent's Stop ends a line that was never announced. A line created by a tool event, with no SubagentStart, ends with the turn. A subagent that did fire SubagentStart, or one declared with wmux report-subagent, keeps the handle subprocess status #272 rule and outlives the turn. SubagentStart is an async hook, so one that lands after the subagent's first tool call still counts.
So a web-fetch line now goes away as soon as the subagent hands back, not only at the end of the turn.
One limit: the first path needs tool_response.agentId, which I only checked on 2.1.323. On a Claude Code version without it, the line ends at the parent's Stop.
The missing hooks do look like a Claude Code bug, and worth reporting there. This fallback covers any subagent type that skips them.
Activity
fix(sidebar): end the line of a subagent that fires no lifecycle hooks (
amirlehmam commentedon Nov 19, 2026
Thanks for the trace, it made this quick. I reproduced it with the same hook logger on Claude Code 2.1.323:
web-fetchstill fires noSubagentStartand noSubagentStop.Fixed in 2.64.1, with both of your suggestions:
Agentcall returns. The parent'sPostToolUseforAgentdoes carry the id:tool_response.agentId, withstatus: "completed". The hook helper forwards that id and nothing else from the response. A background launch answers with another status, so it keeps running.Stopends a line that was never announced. A line created by a tool event, with noSubagentStart, ends with the turn. A subagent that did fireSubagentStart, or one declared withwmux report-subagent, keeps the handle subprocess status #272 rule and outlives the turn.SubagentStartis an async hook, so one that lands after the subagent's first tool call still counts.So a
web-fetchline now goes away as soon as the subagent hands back, not only at the end of the turn.One limit: the first path needs
tool_response.agentId, which I only checked on 2.1.323. On a Claude Code version without it, the line ends at the parent'sStop.The missing hooks do look like a Claude Code bug, and worth reporting there. This fallback covers any subagent type that skips them.