[BUG] Agent Teams: Lead agent requires manual stdin input to process teammate notifications — breaks unattended orchestration

Status Open
Maintainer reply None cached
Activity 6 comments · opened Apr 22, 2026

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?

Context

Project Setup: Production environment using a custom submodule/plugin named brain.
Role of brain: Acts as the session's main entry point and agent orchestrator.

Environment
Claude Code Version: v2.1.116 / Model: Opus 4.7 (1M context) · Claude Max / OS: macOS / Linux / Shell: zsh / bash / Experimental Flags: CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1

The Issue
When the brain orchestrator delegates tasks to Teammates, the entire session enters a "zombie" state once the teammate completes its work and sends a notification. Even though the notification is visible in the terminal, the Lead Agent (controlled by brain) stays idle. There is no visual feedback indicating that the system is waiting for manual intervention.

Technical Observations
Invisible Deadlock: The system is actually waiting for a stdin event (an Enter keypress) to process the teammate's synthetic message into the Lead's context.

Multi-cycle Scaling: The problem compounds in complex remediation loops (e.g., security-qa → fix → quality-gate → pr-governance). Each transition requires a separate manual Enter, making unattended long-running tasks impossible.

UX Failure: The tool looks frozen or crashed. The cursor blinks, but no reasoning or tools are triggered until a manual keypress occurs.

Visual Proof
As seen in the attached screenshots, the system stays in an Idle state even after the teammate has finished. The output from @pr-governance only renders after a manual keystroke is detected.

Before keystroke: System is stuck in Idle.
<img width="1615" height="217" alt="Image" src="https://github.com/user-attachments/assets/22ff519a-3f72-459d-b9b9-35de010f92ef" />

After keystroke: Teammate message and PR creation process appear instantly.
<img width="1605" height="237" alt="Image" src="https://github.com/user-attachments/assets/acf41b2f-7fd0-4fc2-8606-3b5a63900f3f" />

_Manual Enter: Breaks unattended automation and forces "chair-coupling" for the developer.

Running without Agent Teams: Results in loss of parallelism and teammate isolation, which is critical for complex multi-agent systems.

/loop command: Not designed for this specific inter-agent signaling use case and adds unnecessary overhead._

What Should Happen?

  1. Visual State Indicator: If the reasoning loop is paused waiting for a manual trigger to process an agent notification, display: [ACTION REQUIRED] Press Enter to allow 'brain' to process teammate response.
  1. Auto-process Flag: Allow a configuration (via settings.json or CLI flag) to let orchestrators like brain auto-consume teammate notifications without manual stdin events when confidence is high.

Error Messages/Logs

Steps to Reproduce

  1. Load a project with an agent orchestration submodule (like our brain plugin).
  2. Start a session with Agent Teams enabled.
  3. Trigger a task where a teammate must report back to the orchestrator.
  4. Teammate sends SendMessage(to="team-lead") upon completion.
  5. Notification appears in terminal as a teammate-message block.
  6. Lead Agent (brain) does NOT process it automatically.
  7. User must press Enter for brain to read the notification and continue the flow.
  8. Workarounds (None satisfactory)

Claude Model

Opus

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

Version: v2.1.116

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

6 Comments

github-actions[bot] · 4 months ago

Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/46691
  2. https://github.com/anthropics/claude-code/issues/51167

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

Dich01 · 4 months ago

Not a duplicate. While the symptoms are similar to #38932 and #46691, this report confirms that the regression persists in v2.1.116 on macOS.

My case provides additional technical evidence:

Visual Proof: The attached screenshots clearly show that the teammate's output is already rendered in the terminal, yet the Lead Agent remains in a "zombie" Idle state. This confirms the deadlock is in the event loop's consumption of the buffer, not in the teammate's execution.

Orchestration Complexity: This occurs during complex handoffs managed by a custom orchestrator submodule ('brain'), showing that current stdin coupling breaks advanced automation workflows.

Version Gap: Reports like #38932 were filed on much older versions. This issue proves that previous fixes have not fully resolved the architectural coupling between the reasoning loop and terminal input events.

prodan-s · 3 months ago

Reproduces in claude -p (non-interactive) on v2.1.139 — not limited to Enter/TTY interaction

I hit this on v2.1.139 (macOS) and the symptom set looks broader than the original report suggests. The lead never surfaces queued teammate messages even when there is no TTY/stdin in the picture, so this doesn't appear to be solely a "needs Enter keypress" issue.

Repro

Non-interactive harness via claude -p:

mkdir -p /tmp/t51959 && cd /tmp/t51959
claude \
  --setting-sources project,local \
  --print \
  --permission-mode bypassPermissions \
  --output-format stream-json \
  --include-hook-events \
  --no-session-persistence \
  --model opus \
  --settings '{"env":{"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS":"1"}}' \
  "TeamCreate({team_name: \"t51959\", description: \"probe\", agent_type: \"researcher\"}).
  Agent({subagent_type: \"general-purpose\", team_name: \"t51959\", name: \"a\", model: \"sonnet\", prompt: \"sleep 20; SendMessage to team-lead with exactly 'TOKEN_A'; go idle.\"})
  Agent({subagent_type: \"general-purpose\", team_name: \"t51959\", name: \"b\", model: \"sonnet\", prompt: \"sleep 20; SendMessage to team-lead with exactly 'TOKEN_B'; go idle.\"})
  Then wait up to 90s via Bash sleep calls for both <teammate-message> blocks. Do NOT call SendMessage as a wakeup. Report a JSON with token_a_arrived_as_teammate_message and token_b_arrived_as_teammate_message booleans."

Observed

  • Both teammates write tokens to ~/.claude/teams/t51959/inboxes/team-lead.json at ~t0+25s and ~t0+28s (visible by reading the file directly)
  • All inbox entries stay read:false through the full 90s wait
  • Zero <teammate-message> blocks ever appear in the lead's conversation (verified via stream-json output)
  • Agent self-reports verdict: "REPRODUCES_51959". Lead sent 0 wakeup pings (teammates did call SendMessage to write the tokens, but the lead never called it).

Why this looks broader than stdin/TTY

  • Repros in claude -p where there is no user keystroke to wait on
  • The inbox file shows the entries, but the lead never surfaces them as teammate-message blocks
  • The lead's other tool calls (Bash sleeps, file reads, ToolSearch) all fire normally throughout the wait window — only the inbox-to-conversation delivery is dead

I don't know which internal component owns the delivery step, but whatever it is, it isn't being driven during -p mode either.

Monitoring

I've put this probe on a weekly cron — same harness runs every Sunday, classifies the outcome as BUG_REPRO / FIX_DETECTED / HOOK_BLOCKED / UNKNOWN, and writes a ledger row. If two consecutive runs come back FIX_DETECTED, I'll comment back with the CC version that landed the fix.

Happy to share the exact command or a redacted stream-json excerpt if useful.

Environment

  • CC v2.1.139 (macOS Apple Silicon)
  • opus-4-7 lead, sonnet teammates, in-process backend (no tmux)
  • CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 via --settings flag (verified reaching the spawned process)
  • --setting-sources project,local (skips my user-scope hooks so they don't interfere)
m13v · 3 months ago

the underlying coupling is that the lead agent's loop reads from stdin as a discrete event, so teammate-message blocks don't enter the lead's context until a keystroke pumps the event loop. wrapping claude code outside the terminal (native UI, ACP transport) breaks this assumption: with no stdin in the picture, teammate messages can be injected as context events directly. as long as the lead is bound to a tty you'll keep hitting this in CI and headless flows too. the auto-process flag suggestion sidesteps the architectural piece, which is the real cost.

Dich01 · 2 months ago

Here's how I ended up solving this. I moved orchestration out of the model into a small MCP-based layer: a server drives the workflow, validates each transition, and won't let agents skip steps or stall during unattended runs. Every execution is logged, making runs reproducible and auditable.

It fixed the issue for me. Happy to share access if anyone wants to try it — I'd genuinely appreciate feedback or criticism from others building agent workflows.

kcarriedo · 1 month ago

The manual stdin requirement is the thing that makes Agent Teams impractical for any unattended or scheduled orchestration -- it means your orchestrator has to be interactive, not a daemon.

We ran into this building a scheduled polling runner that dispatches Agent Teams jobs on a cron. The lead session stalls waiting for stdin on the teammate notification path even when there is nothing a human needs to see or respond to -- it is just an internal coordination message. This turns a batch workload into an interactive one, which defeats the purpose.

The MCP-based workaround that Dich01 described (a server driving the workflow and validating transitions) is the right structural fix at the application layer. We went a similar direction: move orchestration state out of the session and into an external coordinator, so the session itself handles execution but does not own the flow. That way the stdin requirement only affects the human-facing entry points, not the internal agent-to-agent handoffs.

Three things that would make this workable at the platform level:

  1. A non-interactive mode flag for the lead session -- something like CLAUDE_CODE_AGENT_TEAMS_NONINTERACTIVE=1 that auto-confirms teammate notifications without requiring stdin.
  1. A webhook or file-based notification path for teammate status events, so an external orchestrator can observe completion without the lead needing to relay it.
  1. The ability to inject messages via a named pipe or socket rather than stdin directly -- this would let a daemon-style orchestrator send the confirmation without the session being attached to a terminal.

The use case (scheduled, unattended multi-agent jobs) is large enough that it is worth a dedicated non-interactive mode rather than requiring everyone to build an external orchestration layer.