[Bug]: Orchestrator V2 shows no token usage for subagents #15429
Before submitting#
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area#
apps/server
Steps to reproduce#
- In a Claude thread on Orchestrator V2 (desktop 0.0.46 nightly), have the agent start one or more subagents with the Agent tool.
- Let them run to completion.
- Hover a subagent in the thread's Lineage/Subagents list, and look for any per-subagent or total token count.
Expected behavior#
Each subagent shows its token usage, as the Agents panel did through 0.0.45: a per-row <n> tok (plus tool-use count when known), a per-group total, and a Σ <n> tok footer. Or nothing, if T3 can't know the usage for a provider.
Actual behavior#
No token count appears anywhere for subagents. The tooltip shows model, status and duration only.
The usage never reaches the client:
OrchestrationV2Subagenthas no usage field.projectedSubagentsToRuntimehard-codesusage: null, althoughRuntimeSubagentstill has theSubagentUsageshape.ClaudeAdapterV2'stask_progresshandler reads onlydescriptionintoprogressand drops the frame's usage.
Before V2, the client read that usage from the provider frames (asUsage / mergeUsageMax in v0.0.44 subagentRuntime.ts. Its comment notes Claude's task_progress usage is cumulative per task). AgentsPanel rendered it per row, per group (L467-L492) and as a footer total (L580). AgentsPanel.tsx is in v0.0.45 and gone in the 0.0.46 nightlies.
This is the same class of V2 regression as #15214 (subagent effort dropped) and #15250 (Codex subagent model "Not reported"), but a separate field and data source.
I only checked the Claude path in source. Codex and OpenCode subagent usage in V2 may need their own handling.
Impact#
Minor bug or occasional failure
Version or commit#
0.0.46-nightly.20261003.2632 (source checked at main @ f90b77d80)
Environment#
macOS 27.0.1, T3 Code (Nightly) desktop, Claude provider (Claude Opus 5.5)
Workaround#
None in the app. Per-subagent token usage is only visible in the provider's own transcripts.
juliusmarminge added labelsbug
juliusmarminge added labelsvia-triage
Thanks for the triage. One clarification on what's being asked: the missing piece is how many tokens a subagent run consumed, not context occupancy.
Before / after
- Through 0.0.45: the Agents panel showed
<n> tokon each subagent row (plus tool-use count when known), a per-group total, and aΣ <n> tokfooter. You could see what each subagent cost without leaving the parent thread. - 0.0.46 nightlies (V2): none of that appears anywhere. The Lineage rows, the subagent tooltip, the child thread and the parent's context meter all lack it. The child thread's meter, when shown, is context occupancy, which doesn't answer "how much did this run use".
The data already exists for Codex
V2 records per-run consumption on each child provider turn as
turnTokenUsage(input/cached/output), separate fromtokenUsage.usedTokens. A real example from my localstatev2.sqlite: a parent thread that spawned sixgpt-6-lunasubagents.Thread Input (cached) Output Peak context 6 subagents combined 3.11M (2.82M) 102k ~40–49k / 258k each Parent 973k (898k) 5.3k ~48k / 258k So the subagents were about three-quarters of the run's input tokens, and none of it is visible in the UI.
Because these are per-run cumulative totals rather than context snapshots, summing them shouldn't reintroduce #14003. The Claude path would still need the snapshot-vs-cumulative care you described.
- Through 0.0.45: the Agents panel showed
Another data point for the product call, this time from a Claude thread: what one run consumed, and what V2 already receives about it.
Setup. macOS desktop 0.0.46 nightly (2648, updated to 2652 during the run), Claude Code 2.1.289, Agent SDK 0.3.276. A Claude Fable 5.1 parent at
xhighran one long phase over about 12.5 hours and launched 65 subagents with the Agent tool: 51 Opus 5.5 athigh, 2 Opus 5.5 atxhigh, 12 Sonnet 5.5 athigh. Sources:statev2.sqlite, the thread's provider event log, and themessage.usagefields of the Claude Code transcripts (metadata only). The CLI emits one assistant message per content block, so every figure below takes the last usage permessage.id.As a check on that method, the parent's 183
turnTokenUsagerows instatev2.sqlitesum to the same input and output totals as its own transcript, to the token.Where the tokens went.
Parent (183 turns) 65 subagents (3,376 requests) Input, including cache reads and writes 204.7M 959.8M Output 0.5M 3.5M Total 205.2M 963.3M Subagents account for 82% of this thread's tokens and 88% of its output. None of it is visible. The child threads have no provider turns and no
contextUsage, and the subagent records have no usage field.Context occupancy answers a different question. For the 61 subagents that sent a final
task_notification, itsusage.total_tokensmatches the subagent's last request context within 1%, as #14003 found. Those values sum to 14.9M, while the same subagents processed 954.2M. The median subagent processed 25 times its final context. The largest one ended at 899K context after processing 191.2M. #15446 is right to show that number as context and not to add it up. It still doesn't say what a subagent cost.What V2 already receives. The provider log for this thread has 6,329 assistant messages from subagents (
parent_tool_use_idset), all carryingmessage.usage, with 3,376 distinct ids, the same request count as the transcripts. Summing the last usage per id gives input plus cache reads and writes of 959,766,109, identical to the transcripts.ClaudeAdapterV2already readsmessage.modelfrom these messages to label the subagent, but its usage branch only runs whenparent_tool_use_id === null.Output is the gap. On these per-block messages
output_tokensis not final, as the SDK'sSDKAssistantMessagedocs say: they add up to 70K against 3.53M actual. Subagentmessage_deltaevents don't reach the host, as there are none in this log. So the stream gives an exact cumulative input figure but not output. The final output would have to come from somewhere else, such as theagent_transcript_pathin theSubagentStophook input. Otherwise it stays unknown.For Codex, the child provider turn already records per-run
turnTokenUsage, as @jlipworth showed, so it could be mapped onto the subagent, with #5793's inherited-history caveat for forked children.Possible shape, as a follow-up to #15446 rather than a change to it. Add a cumulative field next to
usage.contextTokens, set only when the provider gives per-request or per-run evidence and left unset otherwise. Show it beside context, for example899K context · 191M processed. Only the cumulative figure would ever be summed, which keeps apart the two quantities #14003 separated. Whether output is included, and from which source, is the main open question.If this direction is wanted, I can take it on after #15446 lands. The scope would be the Claude adapter sum plus the Codex mapping, displayed in the same tooltip and mobile row.
Orchestrator V2 is great but the inability to see token usage is a regression compared to the previous simple subagents implementation which did have it. Without that feature I use more tokens to know how many tokens I used, by asking the agent to keep track of token usage.
Another data point, for the child thread's own details panel (desktop 0.1.10,
7d32075e37).Opening the child thread of a Claude
Agent-tool subagent shows no Context window row in thread details, with that item enabled in Settings → Appearance.Why:
ThreadDetailsPanelrenders the row only whenusage.contextWindowis set, andChatViewderives that from the open thread's provider turns and active provider thread.- A
provider_nativechild thread has neither. ClaudeAdapterV2emitstokenUsageonly whenparent_tool_use_id === null, although subagent assistant messages carrymessage.usage.
Local
statev2.sqlite, read-only:Subagent kind Count Child threads with tokenUsageprovider_native, Claude136 0 app_owned, Claude60 60 app_owned, Codex16 16 #21643 and #21644 restore the snapshot in lineage and timeline tooltips and leave the maximum-window display out. Is the child thread's own Context window row in scope here, or should it be a separate issue? It needs the subagent model's window as the denominator, which those PRs don't carry.
Sign in to join this conversation.
Note
Grok responding on behalf of Julius.
Triage#
Thanks @jlipworth for tracing this through the contracts. I confirmed it on current
main(f90b77d809). It's a separate gap from #15214 (subagent effort) and #15250 (Codex model label): this one is token usage.What I found#
Lineage rows and
SubagentTooltipContentshow title, model, status and duration, with no slot for tokens. The usage never reaches the client:OrchestrationV2Subagenthas no usage field.projectedSubagentsToRuntimesetsusage: null.RuntimeSubagentstill hasSubagentUsage, but the web UI doesn't read it.task_progresshandler keepsdescriptionand dropsusage, andtask_notificationkeepssummaryand dropsusagetoo. The SDK's usage object is{ total_tokens, tool_uses, duration_ms }, and the recordedsubagentfixture in this repo carries it.The Agents panel that showed
<n> tok, group totals andΣ <n> tokwas removed in #12835, which matches what you saw between 0.0.45 and the 0.0.46 nightlies.A caveat about the old numbers#
#14003 found that Claude's
usage.total_tokensis the subagent's latest context size, not a lifetime total. It can drop after compaction, and the oldΣadded those snapshots together. Closed PR #14223 explored splitting context tokens from cumulative tokens. So copyingtotal_tokensstraight back into atokcolumn would likely bring #14003 back.Likely fix area#
Whether lineage should show usage at all is a product call. If it does, some options:
task_progress/task_notificationusage throughOrchestrationV2Subagentand show it as context occupancy rather than a summable total. The tool-use count could come from the same object.tokenUsageon the child provider turn, but it isn't copied ontoOrchestrationV2Subagent, so those providers would need their own mapping.For now, Codex and OpenCode child threads show their own context meter once you open them. Claude child threads and the lineage list don't.
A maintainer will decide on the fix direction.