Agent tool `name` parameter silently switches to teammate protocol, losing background agent results

Open 💬 7 comments Opened Jun 27, 2026 by Macrox

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

  1. Start a background session (--agent claude)
  2. Use the Agent tool without name — observe it returns "Async agent launched successfully" and eventually delivers results via task-notification
  3. Use the Agent tool with name parameter (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.
``

  1. The named agent completes its work but sends idle_notification through the team inbox instead of a task-notification
  2. 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

  • name parameter triggers teammate spawn path ("status": "teammate_spawned")
  • Agent is registered in ~/.claude/teams/session-<id>/config.json as a team member
  • Agent uses inbox-based idle_notification protocol instead of task-notification
  • Job state tracker records the agent in fan array but never receives completion signal → zombie entries
  • shutdown_request sent to the teammate does not terminate it — it continues sending idle_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_notification messages pollute context window (~200 tokens each, recurring)
  • Job state fan array accumulates zombie entries that never clear
  • shutdown_request doesn'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:

  1. Don't let name change the spawn path — always use the background agent protocol regardless of name; name should only add SendMessage addressability
  2. Or clearly document and error — if name triggers team mode, surface this as an explicit choice rather than a silent protocol switch

View original on GitHub ↗

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