[BUG] Status bar 'agents running in the background' counter never decrements after Task tool agents complete
Resolved 💬 3 comments Opened Feb 16, 2026 by Havean365 Closed Feb 19, 2026
Bug Description
When using the Task tool to spawn subagents (e.g., subagent_type=general-purpose), the CLI status bar shows "X agents running in the background." After the agents complete and return their results to the parent conversation, the counter never decrements. It persists for the entire session.
Steps to Reproduce
- Start a Claude Code session
- Use the Task tool to spawn 3 agents in parallel (e.g., research tasks)
- Wait for all 3 agents to complete and return results
- Observe the status bar — still shows "3 agents running in the background"
- The counter persists indefinitely until the session ends
Expected Behavior
The "X agents running in the background" counter should decrement to 0 (or disappear) once the spawned agents complete and return their results.
Actual Behavior
The counter remains at the peak agent count for the entire session. There is no way to clear it mid-session.
Environment
- Platform: Linux (WSL2 Ubuntu 24.04)
- Claude Code version: latest
- Model: claude-opus-4-6
Additional Context
- The agents DO complete successfully — results are received in the conversation
- No actual processes remain running (verified via
ps aux) - The
/tmp/claude-*/tasks/directory is empty after completion - This appears to be a UI state tracking issue where completion isn't reflected in the counter
- Related: #21981 (parent token counter during subagent runs), #17692 (/stats subagent counting)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗