[BUG] Subagent output discarded when spend limit terminates fanout — tokens billed, zero results returned
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?
Cowork dispatched four parallel subagents for a research task. All four were
terminated mid-execution by the monthly spend limit. Every agent's accumulated
work was discarded on termination — each returned only a single fragmentary
status line.
The four agents consumed ~285,000 tokens across ~110 tool calls before being
killed:
| Agent | Tool uses | Tokens | Output returned |
|-------|-----------|---------|-----------------|
| 1 | 25 | 102,027 | one status line |
| 2 | 43 | 72,449 | one status line |
| 3 | 15 | 52,268 | one status line |
| 4 | 28 | 58,919 | one status line |
Each returned: Agent terminated early due to an API error: You've hit your
monthly spend limit
Net result: full daily allowance plus $45 in purchased overage consumed, zero
deliverable produced. The tokens bought nothing and, given the architecture,
could not have. There appears to be no budget check before fan-out and no
partial-result recovery on termination.
The failure is silent — it's only visible after the balance is gone.
What Should Happen?
Either of the following would prevent total loss:
- Pre-flight budget check — fan-out to N parallel agents should estimate cost
against remaining balance and refuse or reduce concurrency if the budget
can't cover it.
- Partial-result recovery — when an agent is killed by a spend limit, its
accumulated findings should be flushed back to the parent rather than
discarded. These agents had done substantial retrieval work that was
thrown away.
At minimum, a user should not be billed in full for parallel work that is
structurally incapable of being returned.
On the checkboxes:
Do actually click through to existing issues and search spend limit subagent and subagent terminated. If someone's already filed this, add your token table as a comment on theirs instead — a second data point on an existing issue carries more weight than a duplicate.
The "latest version of Claude Code" box is awkward for you. Cowork bundles its own runtime and doesn't surface a version the way the CLI does. Check that Claude Desktop itself is updated, tick it, and note in the environment field that you're on Cowork desktop rather than the CLI so no one wastes time asking.
There are likely more fields below the fold — steps to reproduce, environment, model. For environment: Claude Desktop, Cowork mode (research preview), Windows, Opus 4.8, 2026-07-15.
Error Messages/Logs
Steps to Reproduce
Preconditions: an account with a monthly spend limit that will be crossed
during the task. Setting a deliberately low limit makes this deterministic.
- In Cowork, start a session with files attached to a project.
- Give a research/extraction task broad enough that the assistant dispatches
multiple parallel subagents in a single Agent tool block. (In my case:
"compile clinical trial endpoints across ~25 trials" → 4 parallel agents.)
- Observe the agents dispatch and begin making tool calls (web search, fetch).
- Allow cumulative usage to cross the spend limit while agents are in flight.
- Observe: every in-flight agent is terminated. Each returns only:
Agent terminated early due to an API error: You've hit your monthly spend followed by a single fragmentary status line.
limit
Result: all accumulated agent work is discarded. Tokens consumed are billed in
full. No partial findings are recoverable by the parent session or the user.
Note: reproducing this deliberately requires being near a limit, which is the
core problem — there is no pre-flight check, so the condition is only
discoverable by hitting it. Setting an artificially low spend limit should
reproduce it on demand.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
Claude 1.21459.0 (f7518f)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
<img width="1210"
<img width="1210" height="917" alt="Image" src="https://github.com/user-attachments/assets/97a79528-fc89-412e-b210-3b19e1f00ea9" />
height="917" alt="Image" src="https://github.com/user-attachments/assets/03ec50c7-b515-4a7e-813f-ba840ccf5635" />
3 Comments
Adding related public pattern context for Anthropic Billing Platform / cost-control triage, because this thread describes tokens/purchased overage being consumed while spend-limit termination discards the deliverable.
Related open Anthropic-owned cost/billing reports:
Sanitized public evidence hub collecting related manual-credit, extra-usage, entitlement-routing, auto-topup, and support-routing examples: https://coolak.github.io/anthropic-claude-billing-incident/
Request: please route this failure family to a human Billing Platform / cost-control owner. A spend limit that bills tokens/overage and returns no recoverable work needs billing-ledger reconciliation and product-level spend-gate review, not only generic usage-limit guidance.
Second data point, from the Claude Code CLI rather than Cowork, and from a session limit rather than a monthly spend limit — same discard-on-termination behavior, so the failure family looks broader than the billing surface it was first reported on.
Three independent occurrences across three worktrees of the same project, v2.1.220, Opus 5, Claude Pro:
| Date | Agents dispatched | Killed | Tool uses (killed) | Tokens (killed) | Output returned |
|---|---|---|---|---|---|
| 2026-07-29 | 3 × Explore (foreground) | 2 | 25, 30 | 74,102 + 68,910 | preamble sentence only |
| 2026-07-30 | 1 × Plan (background) | 1 | — | — |
"I'll verify the key files before designing."|| 2026-07-31 | 2 × Explore (foreground) | 1 | 25 | 67,570 |
"I'll explore these components in parallel."|~211,000 tokens across 80 tool calls in the foreground cases, and what came back was each agent's opening sentence — the text it emitted before its first tool call. None of the retrieval work survived.
The transcript structure for a killed foreground agent:
Two things worth adding to the picture here:
The termination is recorded as success.
status: "completed",is_errorabsent. In the terminal the killed agents render asDonewith their token counts, indistinguishable from agents that actually finished. I've filed that separately as #82829 since it's a distinct defect from the discard itself.There is no pre-flight check on the CLI either. In the 2026-07-31 case the
You've used 99% of your session limitwarning was already on screen while the agents were mid-flight. Everything they burned after that point was structurally unrecoverable, and nothing stopped the fan-out or warned before dispatch. That matches the "no budget check before fan-out" point in the original report.Adding this because the original report is scoped to Cowork + monthly spend limits; the same architecture discards work on the CLI under ordinary subscription session limits, which is a much more frequently hit condition.
Your table shows the real shape of this: 285k tokens across 4 agents, and the loss isn't just "no partial recovery" — it's that the four agents had no shared budget accounting. Each one independently kept spending until the account limit tripped, so there was never a point where agent 2 could know agent 1 had already consumed the remaining headroom. A pre-flight check on the parent (your fix #1) helps decide whether to fan out at all, but once they're in flight the missing piece is a shared, decrementing budget the agents draw from — otherwise N agents race the same limit and all of them lose when it hits. Pre-flight sizing and a shared runtime budget are two different controls; you want both.
On partial-result loss (your fix #2), the reason it's total rather than partial is architectural: only an agent's final return value propagates to the parent. All the intermediate tool results — the 25–43 tool calls each agent made — are real work that lived only in that agent's context, and the context dies with the agent. That's genuinely thrown away, and it's why "one status line" is all that came back.
But that same fact gives you a workaround that works today, before any fix: have each subagent checkpoint its findings to disk as it goes — append each retrieved result to a scratch file (
findings/agent-3.ndjson) the moment it has it, not at the end. Then a spend-limit kill costs you only the last in-flight step; everything already written survives in the filesystem, and the parent (or a rerun) reads the scratch files instead of re-fetching. For your clinical-trials case that's the difference between losing 110 tool calls' worth of retrieval and losing one. It also makes the run resumable: on restart, skip trials already present in the scratch files. The durability boundary you want is the disk, precisely because it's the one thing that outlives an API-terminated agent.