Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): stop querying Claude context usage after turns #8610

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/8610/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Claude queried detailed context usage after every completed turn. If native token counting failed, that query could trigger extra model requests.

This change stops the automatic detailed query. Completion now uses the final main assistant usage when available, keeps cumulative result usage as processed tokens, and falls back to the existing result, iteration, and stream snapshots.

Focused Claude adapter tests verify usage, cumulative totals, turn completion, and zero detailed context queries.

Tradeoff: the context meter omits its automatic compaction note because normal SDK messages do not expose the effective policy. Claude Code's automatic compaction behavior is unchanged.

Refs #7338

Built by GPT-5.6 Sol in the Codex harness.

    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: 812f85ad-1a5a-4378-b552-dbc6ff570ddb

      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

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

    3. Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire13.3 KiB13.3 KiB−9 B (−0.1%)15.1 KiB✅
      CodexThread snapshot wire6.9 KiB6.9 KiB−6 B (−0.1%)7.3 KiB✅
      CodexLive turn WebSocket wire6.4 KiB6.4 KiB−3 B (−0.0%)7.8 KiB✅
      CodexLive turn WebSocket decoded55.6 KiB55.6 KiB0 B (0.0%)66.4 KiB✅
      CodexLive turn messages11110 (0.0%)21✅
      ClaudeTotal thread wire13.3 KiB13.3 KiB+24 B (+0.2%)15.1 KiB✅
      ClaudeThread snapshot wire6.9 KiB6.9 KiB−4 B (−0.1%)7.3 KiB✅
      ClaudeLive turn WebSocket wire6.4 KiB6.5 KiB+28 B (+0.4%)7.8 KiB✅
      ClaudeLive turn WebSocket decoded56.4 KiB56.4 KiB+44 B (+0.1%)66.4 KiB✅
      ClaudeLive turn messages1011+1 (+10.0%)21✅

      Baseline: 702a6ad · PR result: 73916c2 · Source CI: success

      Scenario and decoded snapshot size

      10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

      • Codex decoded thread snapshot: 109.4 KiB
      • Claude decoded thread snapshot: 110.1 KiB

      Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

    4. Approvability

      Verdict: Would Approve

      Macroscope's review found this PR approvable — This is a localized Claude adapter bug fix that removes unintended context-usage queries and adds targeted usage/compaction coverage without changing schemas, defaults, deployment, or sensitive paths. A separate unresolved Medium finding flags lost automatic-compaction metadata, leaving a correctness risk recorded for follow-up.

      Not approved because:

      • 1 blocking correctness issue found at or above your repo's Minimum Blocking Severity
      Adjust the Minimum Blocking Severity for this repo — including turning it Off — in [Settings](https://app.macroscope.com/pingdotgg/settings#Repos). You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).

Sign in to join this conversation.