[BUG] Teammate ignores shutdown_request and loops idle notifications indefinitely (in-process backend)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When a team lead sends a shutdown_request via SendMessage to an idle teammate (in-process backend), the teammate occasionally does not process it. Instead, it continues emitting idle_notification messages indefinitely. Follow-up shutdown_request messages and direct SendMessage messages are also ignored.
In a 5-teammate team, 4 out of 5 shut down correctly on the first shutdown_request. The 5th teammate (identical configuration) entered an infinite idle loop and never processed any subsequent messages.
The stuck teammate had successfully completed its assigned task, sent results back to the team lead, and was idle when the shutdown was requested. Message delivery worked correctly during the teammate's active working phase — only post-idle messages were ignored.
What Should Happen?
The teammate should receive the shutdown_request, call SendMessage with type: "shutdown_response" and approve: true, and terminate — the same as the other 4 identically configured teammates did.
Error Messages/Logs
No error messages. The teammate simply emits idle_notification JSON every ~30-60 seconds: {"type":"idle_notification","from":"lean-editor","timestamp":"...","idleReason":"available"}
Timeline:
- Teammate completes task, sends results, goes idle
- Team lead sends shutdown_request → teammate emits idle_notification (ignores shutdown)
- Team lead sends second shutdown_request → same result
- Team lead sends direct message → same result
- Teammate continues idle_notification loop indefinitely
Steps to Reproduce
- Create a team:
TeamCreatewith a team name - Spawn 5 teammates via
Agenttool, all with:
subagent_type: "general-purpose"run_in_background: trueteam_nameset to the team
- Assign tasks to all teammates via
TaskCreate+TaskUpdate - Wait for all teammates to complete their tasks and go idle
- Send
shutdown_requestto all 5 teammates viaSendMessage - Observe: 4 teammates shut down within 3-5 seconds. 1 teammate ignores the shutdown and loops
idle_notification
indefinitely.
- Sending additional
shutdown_requestor direct messages to the stuck teammate has no effect.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.70
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
- All 5 teammates were identically configured (same subagent_type, mode, backend, model). Only 1 got stuck.
- The stuck teammate received and processed messages correctly during its working phase — the issue only manifests after going
idle.
- Related but different issues: #23415 (tmux backend message non-delivery) and #24307 (delegate mode tool stripping). This bug
is specific to the in-process backend and only affects shutdown/message processing after idle state.
- Likely cause: race condition or state issue where the teammate's message processing loop stops polling after going idle, while
the idle notification timer continues firing.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗