[BUG] Async subagent loops are silently dropped when the parent has concurrent activity

Resolved 💬 4 comments Opened Apr 27, 2026 by hesnotsoharry Closed Jun 15, 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?

When a subagent is dispatched with run_in_background: true and the parent session has any concurrent activity
(user typing, parent assistant turns, parent tool calls) during the child's run, the child's tool-use loop is
silently dropped mid-cycle. The child's transcript ends with:

  • last_role: user (the harness wrote a tool_result for the most recent tool_use)
  • stop_reason: tool_use carried over from the prior assistant turn
  • No subsequent assistant record — the next API call to advance the child never fires

The child sits in this dead state for the remainder of the parent session (often hours). The parent receives
<task-notification><status>completed</status> for the dropped task, so the orchestrator believes the work is
done.

What Should Happen?

Expected

  1. Async children should resume their tool loop after parent activity, not have their next-turn API call dropped.
  2. If a child is genuinely unrecoverable, the harness must NOT report <status>completed</status>error or

cancelled is needed so the orchestrator doesn't trust the result.

Actual

  1. Child's loop silently drops mid-cycle.
  2. Parent is told the task completed cleanly.

Error Messages/Logs

Evidence (from one user's transcripts on 2.1.119, single project)

  22 cut async sonnet-implementer transcripts across 6 parent sessions:
  - 100% had a parent activity record within **10s** of the child's last transcript timestamp
  - Median gap: **3.2s**; 16/22 within 5s
  - Cuts happen at every duration tested (min 1.9 min, max 26.2 min) — not a wall-clock timeout
  - Parent stayed alive for thousands of seconds after the cut in most cases — this is not parent-death

  Comparison cells from the same dataset:

  | Cell | n | Clean rate (`stop_reason=end_turn`) |
  | --- | --- | --- |
  | built-in sync | 365 | 77% |
  | built-in async | 261 | 72% |
  | custom sync | 65 | 80% |
  | **custom async, sonnet-implementer** | 22 | **23%** |
  | custom async, other agents (haiku-implementer, sonnet-explorer, codex-rescue, …) | 9 | 89% |

  The pathology is concentrated in custom agents whose workflow generates many harness round trips per task (Read +
  Edit + Write + Bash + multi-step instructions including run-tests and re-read-diff). Other custom async agents
  (read-only, no-tests, or external-delegation) are not affected.

  The failure rate has worsened over recent 2.1.x point releases — occasional in late March, dominant by late April.

Steps to Reproduce

Reproducer

  1. Parent session active (Opus or Sonnet, doesn't matter I believe - only tested with Opus spawning Sonnet / Haiku subagents)
  2. Dispatch a custom agent with run_in_background: true whose definition includes Read + Edit + Write + Bash and a multi-step workflow.
  3. While the child runs, actively chat with the parent — user messages and parent tool calls.
  4. Open the child transcript at ~/.claude/projects/<project>/<session-id>/subagents/agent-*.jsonl.
  5. Observe: last record is a user-role tool_result, with no following assistant API call. Parent's

task-notification reports completed.

Claude Model

Not sure / Multiple models

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

CLI version: 2.1.119

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

Workaround

Force run_in_background: false for all subagent dispatches. Sync dispatch is unaffected by the bug (custom-sync
clean rate is 80% on the same agents and shapes). Cost: loses parallelism; the parent blocks until each child
returns.

Platform: Windows 11 Pro 10.0.26200
Subagent kind affected most: custom agents whose definition combines multi-file edits + Bash + a multi-step
workflow (e.g. one that runs scoped tests and re-reads its own diff).

View original on GitHub ↗

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