Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(usage): distinguish subagent context from cumulative tokens #14223

Closedkvnloo(GitHub profile, opens in a new tab)wants to merge 7 commits intomain fromrefs/pull/14223/headopened View on GitHub

Problem

Claude's task_progress.usage.total_tokens is current context occupancy, not lifetime processed work. It can decrease after compaction.

T3 currently normalizes that field to RuntimeTaskUsage.totalTokens, max-merges it, renders it as tok, and includes it in the Agents-panel Σ. That turns a context snapshot into an ever-growing lifetime number and can mix unlike quantities across providers.

Fix

Split the task-usage contract into two explicit quantities:

  • totalTokens: cumulative attributable work; max-mergeable and safe to sum.
  • contextTokens: current context occupancy; latest snapshot wins and may shrink.

Claude task progress/notification maps total_tokens to contextTokens. Codex keeps its cumulative totalTokens path unchanged.

The Agents panel and inline agent rows now label the quantities separately as tok vs ctx. The footer keeps separate aggregates, so Claude context occupancy is never added to Codex cumulative work.

Regression coverage

  • Claude task progress emits contextTokens, not totalTokens.
  • Context occupancy can shrink across progress frames.
  • A mixed Claude-context + Codex-total panel keeps separate aggregates.

Local execution is not available from this connector session, so this is intentionally a draft for CI/local verification.

Fixes #14003.

Model: GPT-5.6 Sol. Harness: ChatGPT.

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. Note

      This comment is posted by Julius' dot

      Closing for missing verification. #14003 establishes the token-accounting problem, but this PR says the new regressions have not been run and supplies no before/after evidence for the changed agent rows and totals. Please report the focused test results and add UI captures, then request reconsideration. Draft status does not defer these requirements.

    3. juliusmarminge closed this

Sign in to join this conversation.