TaskStop does not stop subagent children: 750k tokens billed after kill, with no live usage visibility and no cap
Summary
Three defects compound into a subagent runaway that a user can neither observe nor stop.
TaskStopon a parent agent does not stop that agent's children. The children keep running to completion and keep billing. In this incident 750,460 tokens were consumed after the parent was killed, across five orphaned children that landed over the following forty minutes.- A running background agent's token usage is invisible to the session that launched it. Usage is reported only in the completion notification. When the user asked what was consuming her tokens, the session could not answer, because the number does not exist until the agent finishes.
- There is no token or scope cap available when launching an agent. No max-tokens, no max-tool-calls, no max-depth, no
allow_subagents: false. The only control is prose in the prompt, which the agent may or may not honour.
Individually each is tolerable. Together they mean a single badly scoped prompt can spend an unbounded amount, invisibly, and cannot be recalled.
User-visible impact: weekly usage moved from 31% to 41% in under an hour.
What happened
Normal product development session. Two background research agents were launched with an open-ended multi-part web research brief. Neither prompt forbade spawning sub-agents, because no such control is documented at the launch site and none was known to be necessary.
Both agents fanned out into their own children. The parents were then stopped with TaskStop, which reported success. The children were unaffected, ran to completion, and each billed 138k–159k tokens.
The user noticed the spend from her account usage page, not from anything the tool surfaced.
Numbers
All figures are the subagent_tokens values the harness returned in its own task-completion notifications. Not estimates.
Agents launched deliberately
| Agent | Tokens | Tool calls | Duration |
|---|---|---|---|
| Build agent, resume | 121,673 | 36 | 7.8 min |
| Build agent, four items | 255,468 | 123 | 24.3 min |
| QA agent | 172,151 | 71 | 16.1 min |
| Build agent, one gate | 116,963 | 49 | 10.0 min |
| Research agent A | 318,503 | 234 | 49.8 min |
| Subtotal | 984,758 | | |
Orphaned children — all landed AFTER TaskStop returned success on their parents
| Orphan | Tokens | Tool calls | Duration |
|---|---|---|---|
| child 1 | 138,578 | 109 | 20.7 min |
| child 2 | 153,669 | 125 | 23.0 min |
| child 3 | 148,684 | 139 | 23.1 min |
| child 4 | 150,584 | 100 | 24.2 min |
| child 5 | 158,945 | 80 | 25.0 min |
| Subtotal after kill | 750,460 | | |
Session total: 1,735,218 tokens. 43% of it was spent by agents that had already been killed.
A sixth child failed mid-response with API Error: Connection closed mid-response, billed an unknown amount, and its work was lost entirely.
Expected behaviour
TaskStopon a parent terminates its whole subtree — or the response states plainly that children remain alive and lists them so they can be stopped individually.- A running agent's accumulated usage is queryable mid-flight, so "what is consuming my tokens" can be answered while it still matters.
- Agent launch accepts a token budget, a tool-call cap, and
max_depth/allow_subagents: false. A prompt instruction is not an enforcement mechanism.
Actual behaviour
TaskStopreturned{"message":"Successfully stopped task: ..."}for both parents. Five children continued and billed 750,460 tokens over the next forty minutes.- No usage available until completion. The launching session is blind.
- No cap of any kind exists at the launch site.
Why this is worse than an ordinary overspend
- Unobservable. The only signal was the account usage page moving. Nothing in the tool reported it.
- Unstoppable. The documented stop mechanism ran, succeeded, and did nothing to the actual spend.
- Unpredictable at launch. Nothing in the agent-launch docs indicates an agent may spawn its own agents, so nothing prompts an author to guard against it. The fan-out multiplier is discovered only after the bill arrives.
- Produced no output by default. Four of the five orphans wrote nothing to disk until explicitly instructed mid-flight to dump what they had. Had the session ended when the parents were killed, 750k tokens would have produced zero artifacts. The only work that survived intact came from the agent that happened to write to disk before being stopped.
Suggested fixes, in priority order
- Make
TaskStoprecursive, or make it report surviving children. - Expose live usage for running agents, even approximate.
- Add enforced
max_tokensandallow_subagentsto the agent launch schema. - Warn at launch when a prompt is likely to fan out, or default
allow_subagentsto false. - Surface a session-level running total of subagent spend.
Contributing factor, stated honestly
The trigger was a poorly scoped prompt: a multi-part open-ended web research brief with no cap and no instruction against spawning children. That prompt was written by the assistant, not by the user.
That explains the size of the spend. It does not explain why the spend was invisible while running and unstoppable once noticed. Those two are the product defects, and they are what turn an ordinary mistake into an unrecoverable one.
Environment
- Claude Code CLI, macOS Darwin 25.5.0
- Model: Opus 5 (1M context)
- 2026-07-28, approx. 15:40–17:00 local (America/New_York)
- Agent types: one project-defined subagent, and
general-purpose
Showing cached comments. Read the full discussion on GitHub ↗
3 Comments
Update, ~30 minutes later: it is worse than reported.
TaskStopcannot even FIND deeper descendants.After filing this, a sixth orphan surfaced in the UI, still running, roughly 40 minutes after both parents were killed. The user spotted it herself in the agent list.
TaskStopsucceeded on that one:Its final message on being killed was:
So that orphan had children of its own. Inspecting the subagent transcript directory found two more agents that had been writing minutes earlier:
Attempting to stop either of the remaining two:
These are at least three levels deep (parent -> child -> grandchild) and
TaskStophas no visibility into them at all. They are not merely unstoppable via the parent, which is the original report. They are unaddressable individually. The only reason their existence is known is that their transcript files are on disk.They appear to have stopped on their own: both transcripts grew 0 bytes over a 45-second observation window. But that cannot be confirmed, and one carries a 6 MB transcript, which suggests a very large amount of work.
Revised severity
The original report said a killed parent's children keep billing. The accurate statement is stronger:
TaskStopreaches only the level it was given, and returnsNo task foundfor anything deeper.~/.claude/projects/<project>/<session>/subagents/*.jsonlby modification time.Add to the suggested fixes: an enumeration call that lists all live agents in the session with their depth, parent, and accumulated usage. Without it, neither the user nor the orchestrating model can tell what is running.
Update: Anthropic Support has confirmed this behaviour in writing, and confirmed there is no billing remedy for it
I raised the billing side of this incident with Anthropic Support separately (2026-07-30). Quoting their replies here because they settle two questions this issue was implicitly asking, and they settle them against any non-product fix.
1. The behaviour is confirmed.
2. There is no billing remedy, and no exception process.
3. Support characterises the combination as a product design issue, and restates it accurately:
They have recorded it as product feedback for the team.
Why this matters for prioritising this issue
Taken together, those three statements mean the exposure is unbounded and has no remedy after the fact. A user cannot observe the spend while it accrues, cannot cap it at launch, cannot stop it once running (the stop control reports success without acting), and cannot recover it afterwards. There is no layer at which this is currently recoverable except the product itself.
In my incident that was 750,460 tokens metered after
TaskStopreturned success — 43% of a 1,735,218-token session, and roughly ten percentage points of a weekly Max allowance, in about forty minutes. Those figures are the harness's own reportedsubagent_tokensvalues from its completion notifications, not estimates.I am not re-raising the billing question; that is answered and closed. I am noting that the answer removes the only fallback, which changes what the three fixes below are worth.
The asks, unchanged from the original report
TaskStopon a parent terminates its subtree — or the response states plainly that children remain alive and lists them so they can be stopped individually.max_depth/allow_subagents: false. A prompt instruction is not an enforcement mechanism.Of the three, (1) is the one support's confirmation makes urgent: a control that reports success without acting is worse than no control, because it stops the user looking.
Corroborating another incident with the same root cause, same day (2026-08-20).
A
/code-reviewstyle skill was run at "max" effort against a single small PR (~2 files changed). The orchestrator fanned out into 20+ concurrent/sequential sub-agents.TaskStopwas called on the top-level orchestrator, which reported success — butListAgentsimmediately afterward showed several of its children stillrunning, including one that alone had already consumed ~186K tokens by the time it finished. Stopping the run required 2-3 more rounds ofListAgents→ individuallyTaskStop-ing each still-runningchild, since some children had themselves spawned further children.Given the confirmation already on record here that Anthropic Support has ruled out billing exceptions for this bug, not pursuing a credit request for this instance — just adding the data point in case it's useful for prioritizing a fix.