Agent count indicator in statusline persists after agent completion
Description
The agent count indicator (yellow badge showing "N agents") in the Claude Code CLI statusline does not clear after background agents complete their work. The indicator persists indefinitely, showing stale agent counts that confuse users about the actual system state.
Steps to Reproduce
- Launch Claude Code CLI (v2.1.76)
- Start a background agent using the Agent tool with
run_in_background: true - Wait for the agent to complete (notification appears)
- Observe the statusline — the yellow "N агентов" indicator remains
Expected Behavior
The agent count indicator should decrement (or disappear) when a background agent completes its work.
Actual Behavior
The indicator persists showing the peak agent count, even after all agents have completed. Users must use /clear to reset the statusline.
Environment
- Claude Code v2.1.76
- Opus 4.6 (1M context)
- Linux (Ubuntu)
- tmux terminal
Additional Context
This is a UI-only issue — the agents themselves complete correctly and return results. The problem is purely in the statusline state management.
Screenshot showing "2 агента" persisting after all work is done:
The indicator shows agents are still running when they have already completed.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗