Team UI indicators persist after force-deleting team files (zombie teammates)
Bug Description
When a team is created with teammates and the teammate processes are killed manually (Ctrl+C in tmux panes, then exit), the teammate UI indicators persist in the lead agent's session — showing spinning animations, teammate count, and a ticking time counter — even though no agents are actually running and no tokens are being consumed.
Steps to Reproduce
- Create a team with
TeamCreateand spawn 3 teammates viaTasktool - While teammates are still running, manually kill them:
- Switch to each teammate's tmux pane
- Press Ctrl+C to interrupt the running agent
- Type
exitto close the tmux pane
- Return to the lead agent's session
- Result: UI still shows "3 teammates" with spinning indicators, time counter ticking, but 0 tokens used
- Attempting
TeamDeletefails with "Cannot cleanup team with 3 active member(s)" - Even force-deleting files (
rm -rf ~/.claude/teams/team-name ~/.claude/tasks/team-name) does not clear the UI indicators - Only restarting the Claude Code session clears the stale state
Expected Behavior
Either:
- The lead agent should detect that teammate tmux panes have been killed and clean up the in-memory state automatically (heartbeat/health check)
TeamDeleteshould support a--forceflag to clean up even when agents are listed as active but their processes are dead- The UI should reconcile in-memory state against actual tmux pane status — if the pane no longer exists, clear the teammate indicator
Root Cause Analysis
The UI reads teammate state from in-memory AppState, not from the filesystem or tmux process status. When a teammate's tmux pane is killed externally (Ctrl+C + exit), the lead agent's AppState is never notified — the teammate is still listed as isActive: true in the team config, and the in-memory state retains the stale entry.
The TeamDelete tool refuses to operate if any members are listed as active in the config, creating a deadlock — the agents are dead but still "active" according to the config, so TeamDelete won't run and there's no way to clear the state without restarting the session.
Environment
- Claude Code version: latest (Feb 2026)
- OS: macOS (Darwin 25.1.0)
- Shell: zsh
Screenshot
The UI shows "3 teammates" with spinning indicators and time counter ticking, but no tokens are being consumed.
Showing cached comments. Read the full discussion on GitHub ↗
12 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
This is not a duplicate of the suggested issues. The linked root issue #26202 is about deleted skills persisting in Cowork UI, which is unrelated. This issue is specifically about team/teammate zombie indicators persisting in the CLI after manually killing tmux panes (Ctrl+C + exit). The in-memory AppState for teams is not reconciled when teammate processes die externally. #25371 describes the same underlying
TeamDeletelimitation but was also closed in the duplicate chain. Keeping this open.We hit the same zombie teammate problem. Built cozempic with a doctor check that detects stale team directories and cleans them up — open source.
Also checkpoints team state continuously so you can see what agents were doing before they went zombie. Feedback welcome.
Additional reproduction case: TeamCreate failure → orphaned agent process
Version: 2.1.69 (macOS, Darwin 24.6.0)
Steps to reproduce
TeamCreatewith team namecode-review-triageAgenttool — one fails to join team due to a transient errorTeamDelete→ fails ("Cannot cleanup with active members")shutdown_requestto remaining agents →TeamDeletesucceedsObserved behavior
ps aux | grep claudeconfirms the orphaned agent process is still alive (PID visible)~/.claude/teams/kill <PID>resolves the UI indicatorWorkaround
After team operations involving failures/retries, run:
and manually kill any orphaned agent processes.
Suggestion
When
TeamDeletesucceeds, it should also send SIGTERM to all processes that were spawned with--team-name <deleted-team>, regardless of whether they successfully joined the team.does this happen even with guard mode on?
Sorry for the delayed reply.
I did see this in my environment while running Claude Code in
planpermission mode with custom local guard hooks enabled, although I'm not sure that matches exactly what you mean by "guard mode."Since upgrading to v2.1.72, I haven't been able to reproduce it again so far.
Update: Reproduced on v2.1.72 via clean shutdown path
I need to correct my earlier comment — I stated this wasn't reproducing on v2.1.72, but I've now hit it again under different conditions that narrow down the root cause.
Environment: v2.1.72, macOS Darwin 24.6.0, zsh
Reproduction scenario
This time, no force-kill was involved. The entire lifecycle completed cleanly:
TeamCreate→ teamgas-code-reviewcreatedAgenttool — all completed work and sent resultsshutdown_requestto all 3 → all responded withshutdown_approvedteammate_terminatedfor all 3TeamDelete→ succeeded ("Cleaned up directories and worktrees")Key difference from the original report
The original issue described zombie indicators after
Ctrl+C + exit(force-killing tmux panes). This reproduction shows that even when every step of the graceful shutdown path succeeds, the UI state falls out of sync.Evidence from session log analysis
Session ID:
498e7420-68b5-4780-a2be-fe6797cc7249I found two notable anomalies in the session transcript:
1. Message ordering anomaly —
teammate_terminatedarrives beforeshutdown_approved:All three agents had their
teammate_terminated(system) event delivered to the lead before theirshutdown_approvedresponse. For example:This happened for all 3 agents. The tmux pane exits (triggering
teammate_terminated) before theshutdown_approvedmessage finishes delivery, creating a race condition. If the UI processesterminatedfirst and drops the agent from tracking, the subsequentshutdown_approvedmay be ignored — leaving the internal counter in an inconsistent state.Confirmed with a second team in the same session: I created another team (
issue-analysis, 2 agents) immediately after. The exact same ordering anomaly occurred for both agents:This is 100% reproducible across 5/5 agents in 2 separate teams within one session.
2. Batched message delivery:
The lead agent was generating a long report when shutdown responses arrived. All 9+ teammate messages (idle notifications, terminated events, shutdown approvals) were buffered and delivered as a single batch. The last message in the batch had a truncated closing tag (
</teammate-messaginstead of</teammate-message>), suggesting a buffer overflow or parse error in batch processing.Updated root cause hypothesis
This isn't solely a process-detection problem. Two likely contributing factors:
teammate_terminatedarriving beforeshutdown_approvedmay cause the UI to miscount active agents (terminated agent's shutdown_approved gets orphaned).TeamDeletedoesn't explicitly reset UI indicator state: The backend data (teamNamefield) correctly transitions toNoneafterTeamDelete, but the UI indicator layer doesn't subscribe to this event for cleanup — it appears to track teammates independently.The fix likely needs to ensure that
TeamDeleteunconditionally clears all teammate UI indicators, regardless of the shutdown sequence's event ordering.I'm still seeing it with version
2.1.77as wellAdditional variant: teammate ignores shutdown protocol (no external kill)
I'm hitting the same
TeamDeletedeadlock but from a different trigger — no manual kills involved.Scenario
TeamCreate, spawn 5+ teammatescompletedviaTaskUpdateshutdown_requestto each teammate viaSendMessageshutdown_approvedand terminate normallyidle_notificationmessages indefinitelyTeamDeleterefuses:"Cannot cleanup team with 1 active member(s)"shutdown_requestmessages are ignoredKey difference from OP
No external process kill — the teammate's process is still running, it just won't acknowledge the shutdown protocol. The agent completed its work, marked its task done, but the shutdown handshake never completes. This happened with
oh-my-claudecode:writer(haiku) andoh-my-claudecode:analyst(opus) agent types in the same session, so it's not model-specific.Impact
This blocks the entire team workflow — you can't create a new team while leading one, and you can't delete the current team. The only workaround is ending the session entirely.
Suggested fixes (in addition to OP's)
TeamDelete --forceflag that terminates all members regardless of stateshutdown_responsewithin N seconds, force-terminateTeamDeletewhen all tasks are completed, even if members are still "active"+1 — experiencing the same zombie teammates issue. Subscribed for updates.
Adding a data point not yet covered in the thread: the per-task X dismiss button in the task overlay UI is also a no-op for stuck task entries. Tested today on macOS (Claude Desktop, in-process teammate mode via
Agent({ run_in_background: true })):TeamDeletefailed with the expected "6 active member(s)" errorrm -rf ~/.claude/teams/<team>to clear the bookkeepingkill -TERMon all 12 leftoverclaude --resumePIDs (each teammate had a parent + helper PID pair)Confirms the existing root-cause hypothesis (UI tracks teammates independently of disk/process state) and adds one more failure mode: the UI's own dismissal control is also broken, so there's truly no in-session recovery. Restarting the session is the only known workaround.
Closing for now — inactive for too long. Please open a new issue if this is still relevant.