Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(claude): subagent usage no longer fills the context meter #6586

ClosedDeepusleepy(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/6586/headopened View on GitHub

Claude's subagent progress reports cumulative token totals across child work. T3 Code treated those totals as active parent-conversation context, so enough subagent work could make the context meter look full even when the parent chat still had room.

Subagent usage now stays on the task progress and completion rows. The context meter only changes when Claude reports usage that represents the active parent turn.

How it works:

  • task_progress and task_notification keep their typed token, tool, and duration data on the task event without emitting a parent thread.token-usage.updated event.
  • Parent input/output tokens and iteration snapshots continue to update the context meter normally.
  • A result containing only cumulative total_tokens updates total processed usage without turning that total into active context usage.
  • When a total-only result follows a real parent usage snapshot, the last known active context is preserved instead of being replaced by the child-inclusive total.

Focused Claude adapter tests cover task progress, task completion, oversized subagent totals, and total-only results.


Note

Medium Risk Changes token accounting in the Claude adapter (context meter UX), but behavior is scoped to usage interpretation with focused test coverage.

Overview Fixes the parent context meter incorrectly showing full when Claude subagents report large cumulative total_tokens.

task_progress / task_notification no longer emit thread.token-usage.updated. Child usage stays on task.progress and task.completed via typedUsage only. The helper that promoted task totals into parent active context was removed.

Turn result usage only updates the parent meter when usage reflects active context (input/output tokens or an iteration snapshot). Results with only total_tokens no longer drive usedTokens; when a prior parent snapshot exists, that active context is kept instead of treating the cumulative total as the window fill.

Adapter tests were updated to assert no parent usage events for task progress, total-only results, and subagent-heavy flows, while real input/output result usage still updates the meter.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 35fab5c3e8919fc7081a16341a6acfe81b588006. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Fix subagent usage filling the parent context meter in Claude adapter

  • Subagent token usage from task_progress and task_notification events no longer emits thread.token-usage.updated; usage is instead attached as typedUsage on task.progress and task.completed events respectively.
  • Result events that only contain total_tokens (cumulative subagent work) are treated as non-active context and no longer produce a thread token-usage snapshot.
  • normalizeClaudeTaskProgressTokenUsage is removed from ClaudeAdapter.ts as no callers remain.
  • Behavioral Change: previously, subagent totals would update the parent thread's context meter; they now only appear on task-scoped events.
Macroscope summarized 35fab5c.
    1. Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: 73cf75df-39bb-4b03-9572-d8876bd87eaf

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. Approvability

      Verdict: Approved 35fab5c

      Straightforward bug fix that removes code incorrectly promoting subagent token usage to the parent context meter. The change is a net code deletion with comprehensive test coverage verifying the corrected behavior.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Note

      🤖 GPT-6 Astra (preview) responding on behalf of Theo

      This was closed as part of an automated cleanup pass. If you believe it was closed in error, reply here and we will get it reopened.

      Closing in favor of #8453. That patch keeps cumulative usage separate from the parent context meter and uses the parent model's context window. Review continues there. The total-only result cases from this branch are recorded on the retained PR, so the result fallback does not mistake cumulative work for active context.

Sign in to join this conversation.