claude-code - 💡(How to fix) Fix [Bug] Tool/sub-agent results deliver with multi-minute buffering delay causing model busy-wait polling

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…

Fix Action

Fix / Workaround

Repro context: A Claude Code skill that dispatches several sequential sub-agents within one turn — a custom project sub-agent plus apple-platform-build-tools:builder. The delay appears tied to sub-agent/tool-result delivery, not to any single tool. It is intermittent (some runs are clean; others spiral).

Observed signature: After dispatching a sub-agent, the main loop runs long streaks of commands like: echo "POLL-MARKER-A $(date +%H:%M:%S)"; pgrep -fl 'xcodebuild|xctest' | wc -l echo "post-poll125 $(date -u +%H:%M:%S)" echo "merge-poll250 $(date -u +%H:%M:%S)" then later narrates "All tool output has now arrived (it was buffered, not lost)."

Code Example

[]
RAW_BUFFERClick to expand / collapse

Bug Description Title: Tool/sub-agent results delivered with multi-minute buffering delay → model busy-waits with hundreds of no-op shell commands

Environment: Claude Code v2.1.157 · Opus 4.8 (1M) · macOS (darwin 25.5.0)

Summary: Tool and sub-agent results intermittently deliver with a severe buffering delay — the result returns empty/pending to the model, then "flushes" minutes later. The model misreads the empty result as "work still running" and busy-waits, emitting hundreds of no-op shell commands (echo "pollN $(date)", pgrep … | wc -l, true) to poll for completion. The polling is pure waste: the awaited work has already finished, and polling never makes a buffered result arrive sooner.

Impact / severity: In one github-pr-evaluator run, the model emitted ~500 no-op poll commands across four separate bursts and had to be manually interrupted. Every burst fired after the sub-agent it was "waiting for" had already completed. In one burst it gave up on a buffered builder result and re-ran a 3-minute test gate in the foreground, duplicating finished work. This consumes large amounts of context, tokens, and wall-clock time, and makes long skill runs effectively unusable.

Repro context: A Claude Code skill that dispatches several sequential sub-agents within one turn — a custom project sub-agent plus apple-platform-build-tools:builder. The delay appears tied to sub-agent/tool-result delivery, not to any single tool. It is intermittent (some runs are clean; others spiral).

Observed signature: After dispatching a sub-agent, the main loop runs long streaks of commands like: echo "POLL-MARKER-A $(date +%H:%M:%S)"; pgrep -fl 'xcodebuild|xctest' | wc -l echo "post-poll125 $(date -u +%H:%M:%S)" echo "merge-poll250 $(date -u +%H:%M:%S)" then later narrates "All tool output has now arrived (it was buffered, not lost)."

Request: Deliver sub-agent/tool results promptly, or surface an explicit "result pending" signal so the model waits instead of polling. A built-in circuit-breaker for repeated near-identical/no-op Bash calls within a turn would also help (today there is none for PreToolUse).

Note: Prompt-level guidance does not mitigate this — in the captured run the model quoted its own instruction "a result that seems slow is buffered, not lost — wait, don't probe" and spiraled anyway.

Environment Info

  • Platform: darwin
  • Terminal: ghostty
  • Version: 2.1.157
  • Feedback ID: 5e5f0ed5-55a8-4393-a5c3-a786addbce7e

Errors

[]

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [Bug] Tool/sub-agent results deliver with multi-minute buffering delay causing model busy-wait polling