Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): render and filter usage as environments respond #9860

Mergedjuliusmarmingemerged 3 commits intomain fromrefs/pull/9860/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

Usage waits for the slowest environment before showing any results. Render each response as it arrives and keep scan status in a permanent breadcrumb dropdown, so completing a scan does not move the page. The same dropdown filters costs, tokens, and limits; all environments start selected.

Validation: focused usage state/page tests cover progressive responses, selected totals, deduplication, cached refreshes, and empty/failed selections. Web typecheck and scoped lint pass. The web UI is shared with desktop; server contracts and native mobile UI are unchanged.

Both captures use the actual base/head at 1440×1000 with the same synthetic data and one of two environments still pending.

BeforeAfter
Before: all results hidden while one environment scansAfter: available usage renders while the second environment scans

Progressive-loading recording

Implemented with GPT-6 in Codex.


Note

Medium Risk Changes how usage totals are computed and displayed (merge scope, deduplication, loading semantics); behavior is covered by new state tests but wrong edge cases could misreport costs.

Overview Usage no longer blocks the whole page until every environment finishes scanning. useUsage now accepts an optional environment selection, merges only selected answered summaries, and treats isPending / isPartial relative to that selection so totals can appear incrementally while others are still scanning.

A permanent environment dropdown in the Usage header replaces the old device strip and inline coverage banner. It filters cost, tokens, and limits (including UsageLimitsSection), shows per-environment scan/status (including incompatible server versions via exported isCompatibleUsageContractVersion), and embeds coverage/dedup notices so layout does not jump when scans complete. Refresh and limits refresh respect the current filter.

User docs note the new filter. New and updated tests cover progressive responses, filtered totals, dedup within a selection, cached refresh, and empty/failed selections.

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

Note

Filter UsageLimitsSection by selected environment and update empty-state

Adds a selected-environment ID prop to UsageLimitsSection in UsageLimits.tsx. The component now filters environment presentations before collecting limit groups and sources, so provider limits render only for the chosen environments. The empty-state message now refers to the selected environment when no limits are reported.

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

    2. juliusmarminge changed the title

    3. Stale Bugbot comment from a previous run.

      apps/web/src/components/usage/UsageLimits.tsx line 440Resolvedby juliusmarminge
    4. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — This PR introduces a new environment-filtering experience and changes production usage aggregation and loading behavior across web and desktop, including costs, tokens, limits, refreshes, and partial-result display. The state tests provide coverage, but the breadth of the user-facing behavior warrants human review.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. github-actions[bot](GitHub profile, opens in a new tab)commented

      Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire13.5 KiB13.7 KiB+226 B (+1.6%)15.1 KiB✅
      CodexThread snapshot wire7.0 KiB7.0 KiB+12 B (+0.2%)7.3 KiB✅
      CodexLive turn WebSocket wire6.5 KiB6.7 KiB+214 B (+3.2%)7.8 KiB✅
      CodexLive turn WebSocket decoded57.0 KiB58.5 KiB+1.5 KiB (+2.6%)66.4 KiB✅
      CodexLive turn messages810+2 (+25.0%)21✅
      ClaudeTotal thread wire13.6 KiB13.6 KiB−24 B (−0.2%)15.1 KiB✅
      ClaudeThread snapshot wire7.0 KiB7.0 KiB+1 B (+0.0%)7.3 KiB✅
      ClaudeLive turn WebSocket wire6.6 KiB6.5 KiB−25 B (−0.4%)7.8 KiB✅
      ClaudeLive turn WebSocket decoded57.8 KiB57.8 KiB0 B (0.0%)66.4 KiB✅
      ClaudeLive turn messages990 (0.0%)21✅

      Baseline: d7fe47f · PR result: ed79de6 · 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: 113.8 KiB
      • Claude decoded thread snapshot: 114.5 KiB

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

    6. Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

      Fix All in Cursor Bugbot Autofix is [ON](https://www.cursor.com/dashboard/bugbot), but a cloud agent failed to start. Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit c5365fd1c732bbaacdf2f878d0d4532fc95cc4d6. Configure [here](https://www.cursor.com/dashboard/bugbot).
      apps/web/src/components/usage/UsagePage.tsx line 695Resolvedby juliusmarminge
    7. juliusmarminge merged this7ee52b0

    8. juliusmarminge closed this

Sign in to join this conversation.