Sub-agent pane steals keyboard focus from the main input while typing

Status Closed — not planned
Reported on v2.1.228
Maintainer reply None cached
Activity 3 comments · opened Aug 12, 2026 · closed Aug 23, 2026

What happened

While typing a prompt in the main input, a sub-agent that was spawned earlier in the turn becomes
active and the keyboard focus moves to that sub-agent's pane. The half-typed text is left behind in
the main input and the keystrokes that follow go to the sub-agent view, which does not accept a
prompt. The result is that the message cannot be sent until focus is moved back manually.

It happens reliably when several sub-agents are spawned in one turn and their panes open or update
while the user is mid-sentence. With a fan-out of 10 to 30 agents it is almost every time, because
a pane appears every few hundred milliseconds.

What I expected

The main input keeps focus while the user is typing. A sub-agent pane opening, updating or going
idle is a background event and should never take the caret away from a prompt in progress.

Steps to reproduce

  1. Spawn several sub-agents in one turn (10 or more makes it obvious).
  2. While they are still running, start typing a new prompt in the main input.
  3. Wait for one of them to open its pane or report idle.
  4. Focus jumps to the sub-agent pane, the typed text stays behind in the main input, and further

keystrokes are swallowed.

Environment

  • Claude Code 2.1.228
  • macOS 26.4.1
  • TERM=xterm-256color
  • CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS not set in the project settings; agents spawned via the

Agent tool with run_in_background at its default.

Why it matters

Any long fan-out makes the input unusable for the duration of the fan-out, and the text already
typed is easy to lose. It also pushes toward spawning fewer agents than a task actually needs,
purely to keep the prompt usable.

View original on GitHub ↗

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