Subagent burns entire turn budget on research, never reaches explicit "write code" instruction in the same prompt

Status Open
Maintainer reply None cached
Activity 0 comments · opened Aug 29, 2026

Summary

When a subagent (Agent tool, subagent_type other than fork) is given a brief that both (a) explicitly instructs it to write code/files and (b) asks it to verify several things against real sources first, the verification steps can consume the entire turn budget before the agent ever reaches the write step — even though the instruction to write was explicit and unambiguous, not implied.

This has recurred across multiple separate sessions for me, not a one-off.

Repro

  1. Dispatch two Agent tool subagents (async/backgrounded) with a detailed multi-file implementation brief for a C++ codebase (Unreal Engine project in my case).
  2. Each brief explicitly instructs: "implement this story and write the test," with concrete file paths for both the implementation and the required test file spelled out.
  3. The brief also includes several "verify X against the real source/engine headers before writing" steps ahead of that explicit write instruction.
  4. Both agents hit the harness's turn cap after exactly 20 tool uses — spent entirely on the verification/research steps — with zero Write/Edit calls made. Neither had produced a report.

Expected

Given an explicit, unambiguous instruction to write code, the agent should either prioritize reaching that step before exhausting its budget on preliminary research, or receive some signal as it approaches the cap that lets it wrap up and write partial output instead of continuing to research.

Actual

The agent has no visibility into its own approaching turn limit, so it has no way to prioritize the explicit "write code" instruction over the preceding research steps once budget is running low. The orchestrator only finds out after the fact, once the budget is already spent and nothing was written.

One partial improvement I did observe: the task notification included an explicit marker — "Agent '<name>' stopped at its 20-turn limit (partial result; SendMessage to task-id to continue)" — so this wasn't silently reported as completed. That part seems to already be handled, per #73372.

Environment

Windows 11, Claude Code CLI.

Related

  • #55707 — same underlying phenomenon (agents terminating at ~20–30 tool uses with no signal for graceful wrap-up) and the exact fix I'd want (an ~80%-of-budget nudge to the agent to wrap up). That issue is closed and locked, so I can't comment there directly — filing this fresh since the pattern is still live.
  • #73372 — related but different angle: that one's about the parent not being told the subagent was cut off; this one's about the agent itself never being warned so it can reprioritize.

View original on GitHub ↗