Completed subagent shows as "running" in UI indefinitely — stale agent status not cleared
Describe the bug
When a subagent (spawned via the Agent tool) completes successfully, the Claude Code UI continues to display it as "running" indefinitely. The agent has genuinely finished — its output is fully written and git commits from its work are confirmed — but the UI status is never updated.
To reproduce
- Invoke a workflow that spawns a background subagent via the
Agenttool - The subagent completes its work successfully (output file written, task finalized)
- Observe: Claude Code UI still shows the agent as "running"
- Call
TaskListtool — returns empty (no active tasks registered) - There is no way to dismiss or kill the ghost entry from within the UI
Expected behavior
Once a subagent completes (success or failure), the UI status indicator should update to reflect the completed state and eventually be dismissed.
Actual behavior
The "running" indicator persists indefinitely after completion. It only disappears when the next task is started or the UI is refreshed.
Evidence that the agent actually completed
- Output file for the agent was fully written with a successful result
- Git commits from the agent's work were confirmed in the repository
TaskListreturned empty — system-level confirmation no active tasks exist- All files modified by the agent were present and correct
Environment
- Claude Code version:
2.1.71 - Platform: macOS (Darwin 25.2.0)
- Shell: zsh
Severity
Low — no functional impact (the agent did complete successfully), but causes confusion about whether work is still in progress and whether it is safe to proceed with follow-up tasks.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗