Team-mode session becomes unresponsive after sub-agent shutdown
Bug Report
Description
When using Claude Code in team mode, the team-lead session becomes completely unresponsive after shutting down a sub-agent. If the CLI UI is focused on the shut-down teammate (via Shift+Arrow switching), the UI freezes and no longer processes any keyboard input, requiring the process to be killed externally.
Environment
- Claude Code version: 2.1.34
- Platform: macOS (Darwin 25.2.0, arm64, Apple M1 Max)
- Terminal: macOS Terminal.app (ttys010)
Steps to Reproduce
- Start a Claude Code session
- Create a team using
TeamCreate - Spawn a sub-agent teammate using the
Tasktool withteam_nameparameter - Interactively switch input to the teammate to watch progress — using Shift+ArrowUp/Down
- Send a
shutdown_requestto the teammate viaSendMessage - Teammate approves shutdown and terminates
- Result: The CLI UI, still focused on the shut-down teammate, no longer processes any input. The team-lead session becomes completely unreachable.
Expected Behavior
After a sub-agent shuts down, if the CLI is focused on that agent, the agent selector UI should not be disabled/removed. The user should be able to switch back to the team-lead session using Shift+Arrow or other navigation.
Actual Behavior
The UI freezes on the dead teammate's message prompt:
╭──────────────────────────────────────────────────────╮
│ Shutdown request from team-lead │
│ Reason: Thanks for the plan, shutting down now. │
╰──────────────────────────────────────────────────────╯
❯ Message @plan-caddy-upgrade…
- The input prompt targets a teammate that no longer exists
- No keyboard input is processed — typing, Ctrl+C, Escape, Shift+Arrow,
/exit, etc. all ignored - The Claude process (PID) remains alive with MCP child processes (
chrome-devtools-mcp, etc.) - The team's task list directory exists but contains no task JSON files (only
.lockand.highwatermark) - All agent subprocesses have already terminated
- The session cannot be recovered without externally killing the process (
kill <pid>) - On kill, the exit output includes
1 MCP server failedand a valid--resumesession ID
Additional Context
- The session had been running for ~14 hours before being killed (started ~16:43, killed next morning)
- An orphaned Claude process from a different session (no TTY, 848 minutes of CPU time) required
kill -9to terminate — regularkillwas insufficient - After killing,
claude --resume <session-id>can be used to restore the conversation
Process State When Stuck
PID TTY TIME CMD
92209 ttys010 17:10.47 claude
Child MCP server processes were still running under this PID, but all team agent subprocesses had already exited.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗