[BUG] TaskOutput deprecation note causes agents to Read full sub-agent conversation history, triggering autocompact thrashing

Status Fixed / completed
Reported on v2.1.92
Maintainer reply None cached
Activity 10 comments · opened Apr 7, 2026 · closed Apr 8, 2026

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?

When a background local_agent task completes, the TaskOutput tool's deprecation message instructs the agent to Read the task's .output file directly:

DEPRECATED: Prefer using the Read tool on the task's output file path instead.
Background tasks return their output file path in the tool result, and you receive
a <task-notification> with the same path when the task completes — Read that file directly.

This guidance does not distinguish between task types. For local_bash tasks, the .output file contains stdout/stderr — reading it is appropriate.
For local_agent tasks, however, the .output file contains the full raw conversation history JSON of the sub-agent, which can be 80K+ characters.

The Agent tool already returns a summarized result directly when the task completes. But following the deprecation note, the agent reads the .output file anyway — injecting the entire sub-agent conversation dump into the main agent's context window. When multiple sub-agents run in the same session, this causes rapid context saturation and triggers autocompact thrashing.

What Should Happen?

The deprecation guidance should distinguish between task types:

  • local_bash tasks: Reading the .output file is appropriate — it contains command stdout/stderr.
  • local_agent tasks: The Agent tool result already contains the sub-agent's summarized output. The agent should not Read the .output file — it

contains the full conversation history JSON and will inflate the context unnecessarily.

Suggested fix to the TaskOutput prompt:

DEPRECATED: Prefer using the Read tool on the task's output file path instead.

  • For bash tasks: Read the output file path to get stdout/stderr.
  • For agent tasks: use the Agent tool result directly. Do NOT Read the .output file —

it contains the full sub-agent conversation history and will overflow your context window.

Error Messages/Logs

SDK AssistantMessage carries error=invalid_request | text_len=257 
 SDK API error (fatal): error=invalid_request | 
 raw={'content': [TextBlock(text='Autocompact is thrashing: the context refilled to the limit 
 within 3 turns of the previous compact, 3 times in a row. A file being read or a tool output 
 is likely too large for the context window. Try reading in smaller chunks, or use /clear to 
 start fresh.')]} 
 
 The oversized Read that triggered the issue: 
 tool_call Read | input: {'file_path': '/tmp/claude-1000/.../tasks/aa8bd3ced112e5ae5.output'} 
 tool_result Read | ok | output: {"parentUuid":null,"isSidechain":true,"promptId":"747dfb10...", 
 "type":"user","message":{"role":"user","content":"In the repo at ... <- 87,286 chars 
 
 Comparison — Agent tool result vs .output file: 
 Agent tool return value : 4,087 chars (summarized result, appropriate) 
 .output file via Read : 87,286 chars (full conversation history JSON, 21x larger) 
 
 3 compacts each saving ~167K tokens, all triggered within the same turn: 
 SDK compact triggered: count=1 pre_tokens=167199 tokens_saved=167199 text=SDK auto compact 
 SDK compact triggered: count=2 pre_tokens=167883 tokens_saved=167883 text=SDK auto compact 
 SDK compact triggered: count=3 pre_tokens=167202 tokens_saved=167202 text=SDK auto compact

Steps to Reproduce

  1. Use Claude Code (v2.1.92) with a long-running agent session.
  2. Launch a sub-agent using the Agent tool with run_in_background: true.
  3. When task_notification fires, observe the main agent immediately calling Read on the path /tmp/claude-1000/.../tasks/<task_id>.output.
  4. The file read returns the full sub-agent conversation history JSON (~87K chars per sub-agent).
  5. With 3+ sub-agents in one session, context fills to the 800K token compact threshold.
  6. After 3 consecutive compacts where context refills within a few turns each time, the SDK raises invalid_request: Autocompact is thrashing.

Claude Model

None

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.92

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

10 Comments

github-actions[bot] · 4 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/17591
  2. https://github.com/anthropics/claude-code/issues/24764
  3. https://github.com/anthropics/claude-code/issues/42123

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

wishacloud · 4 months ago
Found 3 possible duplicate issues: 1. [[Bug] TaskOutput returns raw JSONL transcript instead of subagent summary (regression in 2.0.77) #17591](https://github.com/anthropics/claude-code/issues/17591) 2. Read tool can overflow context window, making autocompact unrecoverable #24764 3. [[BUG] Explore sub-agent infinite read loop on single file — never completes (v2.1.89, Windows) #42123](https://github.com/anthropics/claude-code/issues/42123) This issue will be automatically closed as a duplicate in 3 days. If your issue is a duplicate, please close it and 👍 the existing issue instead To prevent auto-closure, add a comment or 👎 this comment 🤖 Generated with Claude Code

It's not quite the same as these issues.

Alpha2Zulu1872 · 4 months ago

Affected since April 6 — two separate incidents, 74:1 and 175:1 input/output ratios, $21.69 consumed, account driven negative. Support ticket 215473797766657 open with no human response after 15+ hours. This has shut down my commercial operation for two days. No communication received from Anthropic about this known issue despite it apparently existing since March 23.

Alpha2Zulu1872 · 4 months ago

To everyone affected in this thread — Anthropic announced Project Glasswing today on LinkedIn, a $100M initiative to secure the world's critical software, partnering with Apple, Microsoft, Google and Amazon.

The announcement is here:

https://www.linkedin.com/posts/anthropicresearch_introducing-project-glasswing-an-urgent-activity-7447353390273114112-xy5y?utm_source=share&utm_medium=member_desktop&rcm=ACoAAGG3uFcBnFLDeZ6TCa348wNOzETNVMi5HyE

I've been documenting my case publicly in the comments — two days offline, 74:1 and 175:1 token ratios, $21.69 consumed, ticket 215473797766657 unanswered for 24+ hours. Video evidence of idle credit drain is now also posted.
If you've been affected and want Anthropic to hear real commercial impact — not just GitHub comments but on their most visible public announcement of the year — share your experience there. Your own words, your own case, your own experience.

We've done their debugging for them. The least they can do is answer us on the day they announce they're securing the world's critical software.

Not asking anyone to pile on — just making sure people know where the conversation is happening today.

Alpha2Zulu1872 · 4 months ago

New data point — bug confirmed firing on a manually disabled key

Adding to this thread as the behaviour has escalated beyond runaway sessions.

April 8, 2026 — Usage dashboard for key NEW_040626:

  • Total tokens IN: 864,077
  • Total tokens OUT: 1,792
  • Ratio: 482:1
  • Key status: manually disabled in Anthropic console
  • User activity: none — occurred ~02:00-03:00 EDT while offline
  • Model: claude-sonnet-4-6

This is the fourth token spike on this account in three days. Previous ratios were 74:1 (Incident 1), 175:1 (Incident 2), and a platform authentication incident (Incident 3, Apr 7 14:32-15:12 UTC). Each incident has worsened.

The disabled-key consumption cannot be explained by #44703's TaskOutput deprecation loop alone — that requires an active session to trigger. This suggests either:

  1. The disabled key flag is not being validated before requests are processed
  2. Token attribution in the billing engine is operating independently of actual API activity
  3. A server-side process associated with the key is running without user initiation

Support ticket 215473797766657 — no human response in 72+ hours. Flagging here in the hope of engineering visibility.

Happy to provide console screenshots or usage export data if useful.

<img width="1661" height="808" alt="Image" src="https://github.com/user-attachments/assets/76c2006e-5d45-434b-9104-0250d1c718f4" />

Alpha2Zulu1872 · 4 months ago

Critical update — hourly breakdown confirms server-side origin

Drilling into the 03:00 UTC hour on April 8 reveals the following:

Token usage chart (Image 1):

  • Spike is not gradual — it is a single violent burst at precisely 3:10-3:15 AM UTC
  • 864,077 tokens consumed in approximately 5 minutes
  • Complete silence before and after
  • Key was manually disabled. No user activity. No active session.

Rate Limit + Caching chart (Image 2) — this is the critical data:

  • At exactly 3:10 AM UTC, uncached tokens spike to ~150,000 per minute
  • Simultaneously, Cache Rate hits 100% — vertical line to the top of the chart
  • Both collapse instantly back to zero at ~3:15 AM UTC

A 100% cache rate coinciding precisely with the token spike means Anthropic's caching infrastructure delivered a massive cached context payload — 864,077 tokens — to this key in a single burst at 3:10 AM UTC.

This cannot be client-side. The key was disabled. There was no user session. No code was running.

Anthropics own caching infrastructure made calls against a disabled key at 3:10 AM UTC and billed the account holder for them.

This is no longer a bug report. This is a platform billing event originating from Anthropic's own infrastructure, charged to a manually disabled key, with zero user involvement.

Support ticket 215473797766657 — 72+ hours — zero human response.

Screenshots attached. Export data available on request.

<img width="1917" height="926" alt="Image" src="https://github.com/user-attachments/assets/17e2d280-f4f7-4a62-a6d2-814373b077f8" />
<img width="1919" height="635" alt="Image" src="https://github.com/user-attachments/assets/67ad9e41-1474-4f84-bf61-f69d6c9428f9" />

Alpha2Zulu1872 · 4 months ago

Independent expert validation — cache re-read mechanism identified

Following my earlier comments on the disabled-key drain, a Senior Cybersecurity and GRC Lead (ITIL v3 Expert) who has independently built a dashboard specifically to detect Anthropic billing anomalies (https://github.com/fgrosswig/claude-usage-dashboard) has provided the following technical explanation:

"Regression and cache re-reads with interrupts melt your usage"

His assessment of the pattern across multiple affected accounts:

"This anomalies seems not a just cause pattern — this is kinda real concerning for paying customers"

This provides an independent technical explanation for the 100% cache rate spike observed on my disabled key at 3:10 AM UTC April 8. The caching system is re-reading cached contexts repeatedly when interrupted, billing the full token count on each re-read rather than serving cached content at reduced cost. This explains:

  • Why cache rate hits 100% simultaneously with token spikes
  • Why input tokens are massively inflated relative to output
  • Why the pattern occurs even on a disabled key with no active session
  • Why the anomaly is not isolated to one account

A Sankey chart mapping expected vs actual token delivery is in development by the same researcher and will provide further independent evidence.

This is no longer a single-account billing dispute. This is a systemic platform billing integrity issue confirmed by independent technical analysis.

Support ticket 215473797766657 — now 96+ hours — zero human response.

Alpha2Zulu1872 · 4 months ago

v2.1.94 — New 'API Usage Billing' header — technical questions for engineers

Posting this as a technical observation following today's update to v2.1.94.

The CLI startup header now reads:

Claude Code v2.1.94
Sonnet 4.6 (1M context) with high effort · API Usage Billing
/mnt/claude-storage/Alpha2Zulu

'API Usage Billing' has never appeared in this header before. Confirmed via grep across all historical session logs on my system:

grep -i "billing" /path/to/agent-logs/cron.log | tail -20
# Returns: empty — zero matches

This label appears for the first time in v2.1.94, released today with no changelog and no release notes.

Technical questions for anyone who can answer:

  1. Is 'API Usage Billing' a new billing MODE introduced in v2.1.94, or purely a disclosure label added to an existing mode?
  1. If it is a new mode — does it explain the aggressive 1M context window loading on startup? On an aborted boot today (session terminated at GPG passphrase prompt, no authentication completed, no work performed) the usage dashboard recorded 269,164 tokens IN / 1,324 tokens OUT — a 203:1 ratio.
  1. Previous versions did not show this label. Did the billing behaviour change between versions, or only the disclosure?
  1. Is there a changelog or release notes for v2.1.94 anywhere that explains this addition?

For context — this is the same account that recorded 864,077 tokens IN / 1,792 tokens OUT on a manually disabled key at 3:10 AM UTC April 8 with no active session. The 1M context aggressive loading on v2.1.94 startup may be related to the broader token inflation pattern documented in this thread.

Support ticket 215473797766657 — 96+ hours — no human response.

Screenshots available.

Alpha2Zulu1872 · 4 months ago

Closed as completed with no fix confirmation, no engineer comment, no explanation of the billing mode change in v2.1.94, and no response to the four technical questions posted today. Support ticket 215473797766657 remains unanswered at 96+ hours. Closing an issue is not the same as fixing it.

github-actions[bot] · 4 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.