TeamDelete fails after agents approve shutdown - 'active members' not cleared
Resolved 💬 4 comments Opened Mar 24, 2026 by JinFuLee Closed Apr 21, 2026
Bug Description
After agents approve a shutdown_request, TeamDelete still fails with Cannot cleanup team with N active member(s). The agents have:
- Responded with
shutdown_response approve: true - System sent
teammate_terminatedmessage - But agents continue sending
idle_notificationafter termination TeamDeletestill counts them as active members
Reproduction Steps
- Create a team with
TeamCreate - Spawn 2+ agents with
Agenttool (team_nameparameter) - Send
shutdown_requestto each agent - Wait for
shutdown_response approve: truefrom each - Wait for
teammate_terminatedsystem message - Call
TeamDelete - Expected: Team deleted successfully
- Actual:
Cannot cleanup team with N active member(s): agent1, agent2
Workaround
Force-removing team directories: rm -r ~/.claude/teams/{name} ~/.claude/tasks/{name}
Environment
- Claude Code version: 2.1.81
- OS: macOS Darwin 25.2.0 (Apple Silicon)
- Model: Claude Opus 4.6 (1M context)
Impact
In long sessions with multiple team cycles (20+ agent spawns across 6+ teams), every TeamDelete fails. This forces manual directory cleanup and prevents clean team lifecycle management.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗