Agent tool `name` parameter silently switches to teammate protocol, losing background agent results
Bug Description
When the Agent tool is called with a name parameter in a session that has (or has had) a team configuration, the spawn silently takes the teammate path instead of the regular background agent path. This causes the agent's results to be lost — the calling session never receives a task-notification with the work output.
Reproduction Steps
- Start a background session (
--agent claude) - Use the Agent tool without
name— observe it returns "Async agent launched successfully" and eventually delivers results viatask-notification✅ - Use the Agent tool with
nameparameter (e.g.,name: "my-agent") — observe it returns:
````
Spawned successfully.
agent_id: my-agent@session-<id>
name: my-agent
The agent is now running and will receive instructions via mailbox.
- The named agent completes its work but sends
idle_notificationthrough the team inbox instead of atask-notification - The calling session never receives the agent's results
Expected Behavior
The name parameter should only provide addressability (for SendMessage({to: name})), without changing the spawn path or result delivery mechanism. A background agent spawned with name should still deliver results via task-notification.
Actual Behavior
nameparameter triggers teammate spawn path ("status": "teammate_spawned")- Agent is registered in
~/.claude/teams/session-<id>/config.jsonas a team member - Agent uses inbox-based
idle_notificationprotocol instead oftask-notification - Job state tracker records the agent in
fanarray but never receives completion signal → zombie entries shutdown_requestsent to the teammate does not terminate it — it continues sendingidle_notification
Evidence from Real Session
Session 0287d9cb (Claude Code v2.1.185) experienced this:
| Condition | Spawn Response | Result Delivery | Outcome |
|-----------|---------------|-----------------|---------|
| No name param | "Async agent launched successfully" | task-notification, 3.8s | ✅ Result received |
| With name param | "Spawned successfully...via mailbox" | idle_notification | ❌ Result lost |
The session's own thinking confirmed the diagnosis:
"The subagents sent idle notifications but didn't report their findings. They seem to be using a team protocol that doesn't match the Agent tool's behavior."
Impact
- Agent work results are silently lost (no error surfaced to user)
- ~20 minutes wasted per occurrence (waiting + redoing work)
idle_notificationmessages pollute context window (~200 tokens each, recurring)- Job state
fanarray accumulates zombie entries that never clear shutdown_requestdoesn't terminate the zombie teammates
Environment
- Claude Code v2.1.185
- macOS (Darwin 23.2.0, arm64)
- Background session mode (
--agent claude)
Suggested Fix
Either:
- Don't let
namechange the spawn path — always use the background agent protocol regardless ofname;nameshould only add SendMessage addressability - Or clearly document and error — if
nametriggers team mode, surface this as an explicit choice rather than a silent protocol switch
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗