TaskStop does not stop subagent children: 750k tokens billed after kill, with no live usage visibility and no cap

Status Open
Maintainer reply None cached
Activity 4 comments · opened Jul 28, 2026

Summary

Three defects compound into a subagent runaway that a user can neither observe nor stop.

  1. TaskStop on 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.
  2. 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.
  3. 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

  1. TaskStop on a parent terminates its whole subtree — or the response states plainly that children remain alive and lists them so they can be stopped individually.
  2. A running agent's accumulated usage is queryable mid-flight, so "what is consuming my tokens" can be answered while it still matters.
  3. 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

  1. TaskStop returned {"message":"Successfully stopped task: ..."} for both parents. Five children continued and billed 750,460 tokens over the next forty minutes.
  2. No usage available until completion. The launching session is blind.
  3. 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

  1. Make TaskStop recursive, or make it report surviving children.
  2. Expose live usage for running agents, even approximate.
  3. Add enforced max_tokens and allow_subagents to the agent launch schema.
  4. Warn at launch when a prompt is likely to fan out, or default allow_subagents to false.
  5. 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

View original on GitHub ↗

3 Comments

simplysdm · 1 month ago

Update, ~30 minutes later: it is worse than reported. TaskStop cannot 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.

TaskStop succeeded on that one:

{"message":"Successfully stopped task: af298e0ee977dc606 (Research retrieval and resurfacing)","task_type":"local_agent"}

Its final message on being killed was:

"Agent 2 delivered. Retrying the Meyer essay while agent 1 finishes."

So that orphan had children of its own. Inspecting the subagent transcript directory found two more agents that had been writing minutes earlier:

662360   17:04  agent-af298e0ee977dc606.jsonl   <- killed successfully
6001921  17:04  agent-a5e1a037f67b50abf.jsonl   <- 6 MB transcript
622154   17:01  agent-a3000dc7d4f4e4875.jsonl

Attempting to stop either of the remaining two:

TaskStop(a5e1a037f67b50abf) -> No task found with ID: a5e1a037f67b50abf
TaskStop(a3000dc7d4f4e4875) -> No task found with ID: a3000dc7d4f4e4875

These are at least three levels deep (parent -> child -> grandchild) and TaskStop has 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:

  • A subagent tree can nest at least three levels deep.
  • TaskStop reaches only the level it was given, and returns No task found for anything deeper.
  • There is no enumeration API for the tree. Discovering the descendants required listing ~/.claude/projects/<project>/<session>/subagents/*.jsonl by modification time.
  • Therefore there is no supported way to stop a runaway subagent tree, only the level you happen to hold an ID for.

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.

simplysdm · 1 month ago

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.

"child agents may not stop when a parent process is stopped"

2. There is no billing remedy, and no exception process.

"there is no exception process for billing adjustments on consumed usage, including cases where a stop command reports success but subagents continue running. Our Credit Terms apply uniformly to all API usage regardless of the underlying cause, and this policy does not have exceptions."

3. Support characterises the combination as a product design issue, and restates it accurately:

"You've identified a legitimate product design issue: the combination of a stop command that reports success without stopping child agents, no real-time visibility into running agent token usage, and no budget controls at launch creates a scenario where usage can run beyond what a user can observe or halt."

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 TaskStop returned 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 reported subagent_tokens values 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

  1. TaskStop on a parent terminates its subtree — or the response states plainly that children remain alive and lists them so they can be stopped individually.
  2. A running agent's accumulated usage is queryable mid-flight, so "what is consuming my tokens" can be answered while it still matters.
  3. Agent launch accepts a token budget, a tool-call cap, and 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.

gbrmachado · 10 days ago

Corroborating another incident with the same root cause, same day (2026-08-20).

A /code-review style skill was run at "max" effort against a single small PR (~2 files changed). The orchestrator fanned out into 20+ concurrent/sequential sub-agents. TaskStop was called on the top-level orchestrator, which reported success — but ListAgents immediately afterward showed several of its children still running, including one that alone had already consumed ~186K tokens by the time it finished. Stopping the run required 2-3 more rounds of ListAgents → individually TaskStop-ing each still-running child, 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.

Showing cached comments. Read the full discussion on GitHub ↗