claude-code - 💡(How to fix) Fix Agent-team teammate reports 'Spawned successfully' but never registers in mailbox (v2.1.123, macOS, tmux) [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#54634Fetched 2026-04-30 06:40:14
View on GitHub
Comments
2
Participants
2
Timeline
7
Reactions
0
Timeline (top)
labeled ×4commented ×2closed ×1

Agent-team teammates spawned via the Agent tool report Spawned successfully but the child Claude Code subprocess never registers with the parent's mailbox. current-team.json stays at members: [] and the orchestrator never receives a reply.

Root Cause

Orchestrator declares Spawned successfully based on tmux pane creation (or the binary returning a session id) rather than on the child completing the mailbox handshake. The child appears to start, then exits before subscribing to the mailbox — possibly because:

Fix Action

Workaround

Use plain subagents (Agent without team_name) — these spawn reliably. Forfeits team mailbox / per-teammate fresh-context-window benefits.

Code Example

Agent({
     subagent_type: "general-purpose",
     model: "sonnet",
     mode: "acceptEdits",
     team_name: "<team>",
     name: "test-spawn",
     prompt: "reply HELLO and end your turn"
   })

---

echo "hi" | /Users/<user>/.local/share/claude/versions/2.1.123 --print --model sonnet --permission-mode bypassPermissions
# returns "Hey."

env CLAUDECODE=1 CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 \
  /Users/<user>/.local/share/claude/versions/2.1.123 \
  --print "reply HELLO" \
  --agent-id t@td --agent-name t --team-name td --agent-color blue \
  --parent-session-id <fresh-uuid> --agent-type general-purpose \
  --permission-mode auto --model sonnet
# stdout: HELLO, exit 0

---

tmux new-session -d -s test
tmux send-keys -t test "env CLAUDECODE=1 CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 \
  /Users/<user>/.local/share/claude/versions/2.1.123 \
  --agent-id t@td --agent-name t --team-name td --agent-color blue \
  --parent-session-id <fresh-uuid> --agent-type general-purpose \
  --permission-mode auto --model sonnet" Enter
sleep 5
tmux capture-pane -t test -p
# Pane shows Claude Code banner, "@t" agent prompt, no errors, stays alive.
RAW_BUFFERClick to expand / collapse

Summary

Agent-team teammates spawned via the Agent tool report Spawned successfully but the child Claude Code subprocess never registers with the parent's mailbox. current-team.json stays at members: [] and the orchestrator never receives a reply.

Environment

  • macOS Darwin 24.4.0 (arm64)
  • Claude Code v2.1.123 (native installer, binary at ~/.local/share/claude/versions/2.1.123)
  • tmux 3.6a (Homebrew)
  • zsh
  • CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 enabled
  • Reproduced on v2.1.118 and v2.1.123. Issue is independent of binary version.

Reproduction

  1. Orchestrator session (interactive claude) calls:

    Agent({
      subagent_type: "general-purpose",
      model: "sonnet",
      mode: "acceptEdits",
      team_name: "<team>",
      name: "test-spawn",
      prompt: "reply HELLO and end your turn"
    })
  2. Tool returns Spawned successfully with agent_id: test-spawn@<team>.

  3. Tmux pane shows the spawn shell command, optionally a compdef: command not found warning from zsh init, then Resume this session with: claude --resume <uuid>, then a fresh shell prompt.

  4. ~/.claude/teams/<team>/config.json contains the team but members is empty.

  5. Orchestrator's current-team.json shows members: []. No teammate reply ever arrives. Orchestrator hangs or times out.

Expected behavior

Child process registers itself in the parent team's config.json members array, opens IPC mailbox, processes the prompt, and replies via SendMessage.

Actual behavior

Child exits cleanly (prints "Resume this session" — the standard exit message) before completing the IPC handshake. Orchestrator sees Spawned successfully but never gets a reply.

Diagnostic results

Direct binary tests work:

echo "hi" | /Users/<user>/.local/share/claude/versions/2.1.123 --print --model sonnet --permission-mode bypassPermissions
# returns "Hey."

env CLAUDECODE=1 CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 \
  /Users/<user>/.local/share/claude/versions/2.1.123 \
  --print "reply HELLO" \
  --agent-id t@td --agent-name t --team-name td --agent-color blue \
  --parent-session-id <fresh-uuid> --agent-type general-purpose \
  --permission-mode auto --model sonnet
# stdout: HELLO, exit 0

Manual tmux pane reproduction (no orchestrator) — child binary stays alive and shows banner:

tmux new-session -d -s test
tmux send-keys -t test "env CLAUDECODE=1 CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 \
  /Users/<user>/.local/share/claude/versions/2.1.123 \
  --agent-id t@td --agent-name t --team-name td --agent-color blue \
  --parent-session-id <fresh-uuid> --agent-type general-purpose \
  --permission-mode auto --model sonnet" Enter
sleep 5
tmux capture-pane -t test -p
# Pane shows Claude Code banner, "@t" agent prompt, no errors, stays alive.

So the binary itself spawns correctly under tmux. The failure is internal to Claude Code's orchestrator-side spawn logic when invoked via the Agent tool with team_name.

Suspected cause

Orchestrator declares Spawned successfully based on tmux pane creation (or the binary returning a session id) rather than on the child completing the mailbox handshake. The child appears to start, then exits before subscribing to the mailbox — possibly because:

  • The --parent-session-id it receives doesn't match a parent that has begun listening on the corresponding mailbox path.
  • A race between team config write and child subscribe.
  • The child's interactive-mode init aborts when its stdin is the tmux pane (different from manual reproduction stdin path).

Side-quest finding (already worked around)

Independent of this bug, ~/.zshrc lines that source process substitutions (source <(ng completion script)) without an [[ -o interactive ]] guard emit compdef: command not found warnings during shell init in tmux panes. After guarding zshrc, the warning is gone and a manual tmux spawn succeeds — but the orchestrator's Agent call still fails to receive a reply, which is why I believe the spawn-vs-handshake issue is a separate bug.

Workaround

Use plain subagents (Agent without team_name) — these spawn reliably. Forfeits team mailbox / per-teammate fresh-context-window benefits.

Repo for reference

The orchestrator system that hits this consistently: https://github.com/borabekarr/claude-code-system (private/local but happy to provide minimum repro on request).

extent analysis

TL;DR

The issue can be mitigated by ensuring the parent session ID matches the one the child expects, possibly by adjusting the orchestrator's spawn logic to wait for the child to complete the mailbox handshake before declaring success.

Guidance

  • Investigate the orchestrator's spawn logic to determine why it declares Spawned successfully before the child completes the mailbox handshake.
  • Verify that the --parent-session-id passed to the child matches the one the parent is listening on, to rule out a mismatch.
  • Consider adding a delay or synchronization mechanism to ensure the parent is listening on the mailbox path before the child attempts to subscribe.
  • Review the child's interactive-mode init to see if it aborts when stdin is a tmux pane, and adjust accordingly.

Example

No code snippet is provided as the issue seems to be related to the orchestrator's logic and the interaction between the parent and child processes.

Notes

The provided diagnostic results suggest that the binary itself spawns correctly under tmux, and the issue is internal to the orchestrator's spawn logic. The suspected cause points to a potential race condition or mismatch between the parent and child session IDs.

Recommendation

Apply a workaround by adjusting the orchestrator's spawn logic to wait for the child to complete the mailbox handshake before declaring success, as the root cause is not immediately clear and may require further investigation.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Child process registers itself in the parent team's config.json members array, opens IPC mailbox, processes the prompt, and replies via SendMessage.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING