[BUG] Subagent/workflow transcripts never write the final usage entry for tool-use responses

Status Open
Reported on v2.1.284
Maintainer reply None cached
Activity 0 comments · opened Oct 1, 2026

Version: 2.1.284, Linux

What happens: In subagent transcripts (<session>/subagents/agent-*.jsonl and subagents/workflows/wf_*/agent-*.jsonl), most tool-use responses only get per-block entries with stop_reason: null and a small placeholder usage.output_tokens. The finalized entry with stop_reason and the real output count is never written. Main-session transcripts do write it.

Scale (one user, 7 days): about 87% of subagent tool-use messages had no final record, versus about 0.2% in main sessions. About 98% of affected messages are Bash calls. Both Opus 5.5 and Sonnet 5.5 are affected.

Impact: Any tool reading the transcripts (ccusage-style trackers, cost dashboards) undercounts subagent output. Here about 40% of all Claude output tokens for the week were missing. Input and cache counts are unaffected.

Repro: Run a Workflow or Agent subagent that makes several tool calls. In its transcript, the assistant entries for each tool-use message have stop_reason: null and a placeholder output_tokens, and the next line is the tool_result.

Expected: The same final usage entry that main sessions get, or an equivalent usage record per response.

Workaround: Estimate each response's output as the next request's context growth minus the tool-result text sent in between. Against responses with known counts, this came within about 3% in aggregate.

View original on GitHub ↗