Terminated team agents persist in the agent list until session end (no cleanup mechanism) — still occurs on v2.1.186

Open 💬 2 comments Opened Jun 23, 2026 by kHeroBite

<!-- GitHub 이슈 초안 — anthropics/claude-code 에 제출용. 검토 후 직접 등록. -->

이슈 제목 (Title)

Terminated team agents persist in the agent list until session end (no cleanup mechanism) — still occurs on v2.1.186

---

본문 (Body)

Description

Team agents spawned via the Agent tool (tmux/pane backend) continue to appear in the agent list above the input field after they have been terminated (normal shutdown_request / shutdown_approved, pane already destroyed). They accumulate across a session and there is no working way to dismiss them.

This is a follow-up to two previously-closed issues that were never fixed:

  • #27639 — closed by the reporter as "an orchestration design limitation rather than a bug" (no maintainer triage, no fix).
  • #46284 — triaged with bug + has repro + area:tui + area:agents labels, then auto-closed as stale on 2026-05-22 without a fix. The closing bot explicitly said: "Please open a new issue if this is still relevant."

It is still relevant on the latest version, so filing fresh per that guidance.

Steps to Reproduce

  1. Run an orchestration that spawns several team agents sequentially via the Agent tool with team_name (tmux/pane backend), e.g. a plan → dev → test → done pipeline.
  2. Let each agent finish and terminate it normally: send shutdown_request, receive shutdown_approved, and confirm the tmux pane is destroyed (tmux list-panes shows only the main pane).
  3. Observe the agent list (FleetView / picker above the input field).

Expected Behavior

Agents whose process/pane has been terminated (confirmed gone via shutdown_approved + pane destruction) should be removed from the agent list, or there should be a user action to dismiss them.

Actual Behavior

All terminated agents remain listed with an idle marker () and elapsed-time stats, even though their panes are gone. Example from a single pipeline run:

● main
◯ oplan-1   PIPELINE_UUID=...   10m 33s
◯ odev-1    PIPELINE_UUID=...    5m 19s
◯ otest-1   PIPELINE_UUID=...    2m 22s
◯ odone-1   PIPELINE_UUID=...    2m 40s
◯ oplan-2   PIPELINE_UUID=...    ...
... (continues to accumulate across the session)

Confirmed on my side:

  • All listed agents received shutdown_approved and their tmux panes were destroyed (tmux list-panes shows only the main pane %0).
  • Pressing x on these entries does not dismiss them. (The v2.1.186 changelog item "pressing x on a finished subagent ... not dismissing it" appears to apply only to subagents in the agent panel, not team agents on the tmux/pane backend.)
  • The only way to clear the list is to restart the session.

Environment

  • Claude Code CLI v2.1.186
  • OS: Windows 11 (WSL2, Linux 6.6.87.2-microsoft-standard-WSL2)
  • Terminal: tmux-based session
  • Backend: team agents via Agent(name=, team_name=) (tmux/pane), CLAUDE_CONFIG_DIR under /tmp/cc-*

Impact

  • The agent list grows unbounded within a long orchestration session, pushing down / obscuring the input area.
  • Hard to tell which agents are actually active () vs already terminated ().
  • shutdown_request/shutdown_approved cleans up the process & pane but not the UI entry.
  • Manually deleting teams/<name>/ is not a workaround — it makes subsequent Agent calls fail with "team file not found", so the list cannot be cleared that way either.

Notes / Suggested fix

A few possible directions (any one would resolve it):

  • On shutdown_approved (or pane destruction), remove the corresponding entry from the agent list.
  • Provide a slash command to clear terminated/idle team agents (e.g. /agents clear-idle).
  • Make the existing x-to-dismiss work for tmux/pane team agents, not just panel subagents.

Related (closed without fix)

  • #27639 (closed as "design limitation" by reporter)
  • #46284 (triaged as bug, auto-closed stale)
  • #27882 (referenced as possible duplicate of #46284)

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗