Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(usage): pool subscription limits per provider across accounts and environments #10300

Mergedjuliusmarmingemerged 8 commits intomain fromrefs/pull/10300/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

Usage → Limits repeated the same subscription across environments and made people add separate account quotas mentally. This change merges accounts by provider and email, then shows one segmented bar per window. Segments sort by reset time; each account contributes equally to the pooled percentage.

The freshest snapshot supplies the usage figures. Reset credits and their action come together from the freshest native instance. Filtering environments recomputes the pools, and accounts contribute only to windows they report, keeping monthly allowances separate from session and weekly limits.

Below 672px of available bar width, numbered segments map to tappable account rows. Wider bars retain inline labels. Tap or hover for account details, blurred email, plan, environments, and reset credits. Use reset closes the popover before opening its confirmation. Popovers fit down to 320px.

The CLIProxy adapter maps Codex five-hour windows to primary, matching native Codex. No wire contract changes. Web and Electron share this UI; the native mobile app retains its existing per-account view for the next pass.

Before and after

The base renderer at eee05575eb and current implementation use the same uneven-environments synthetic snapshot and matching viewports, scroll, and dark theme. The base renderer receives the fixture at its data boundary; its rendering code is unchanged.

Phone, 390 × 844:

BeforeAfter
Before: per-account limits at phone widthAfter: pooled account bars at phone width

Tablet, 768 × 1024, sidebar open:

BeforeAfter
Before: per-account limits at tablet widthAfter: pooled account bars at tablet width

Desktop, 1280 × 820:

BeforeAfter
Before: per-account limits at desktop widthAfter: pooled account bars at desktop width

Interaction and edge-case demos

These recordings use synthetic accounts and environments through the real environment picker. No reset credit is consumed.

Phone: account details, reset confirmation and cancellation, then MacBook Pro with Codex and Claude, nucbox-1 with Claude only, Mac Mini with Codex only, and back to all.

https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/826d604f8673b9a6/uneven-environments.mp4

Tablet: one Codex account reported natively on two machines and by a hub. Filtering shows the selected machine’s snapshot without double-counting the account.

https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/06e0627a575514cd/same-account.mp4

Phone: session and weekly on one account, monthly only on another, and weekly-only hub accounts. Includes the empty environment selection.

https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/9e40a21ffd400d86/codex-window-mix.mp4

Tablet: duplicate hub configuration, a hub account without email, an unsupported API-key account, a failed probe, and an unavailable hub. Filtering to the failed environment shows notices instead of bars.

https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/e7f1237352296639/failures-and-strays.mp4

Account details and reset confirmation:

DetailsConfirmation
Phone account detail popoverReset confirmation after the account popover closes

Account details fit within a 320px phone in light mode

Verification

  • 38 focused tests pass across shared usage-limit logic and the CLIProxy adapter.
  • Web typecheck and targeted lint pass. React Doctor reported no correctness errors; its six warnings concern complexity, shared exports, and memoization.
  • Browser verification covers 320px light mode, 390px phones, 768px tablets, and desktop widths; filtering, partial window availability, reset confirmation/cancellation, and both trigger handles.
  • Keyboard checks confirm each handle positions the popover relative to itself and receives focus back after dismissal. The final 320px check reports a 320px document width and a 306px popup.
  • Whole-PR source review includes the shared collectors, adapter, composer reset-credit callers, and unchanged native mobile consumers. Connection modes use existing environment state and commands.

Pooling is an unweighted mean because the contract has no comparable plan-capacity units. Accounts without email use source identity, so the same hub reached through different configured identities can still count twice.

Initial implementation: Claude Fable 5 in Claude Code. Web completion: GPT-6 in Codex, via T3 Code.

Note

Add pooled subscription limits across accounts and environments

  • Aggregates accounts across native providers and hubs into provider pools via collectLimitAccounts and collectLimitPools, preferring the freshest usage snapshot and merging duplicate environments
  • Adds UsageLimitsPooled and related components to render interactive segment bars, account detail popovers, and aggregate quota summaries per provider
  • Fixes Codex five_hour quota mapping to use the primary window identifier in cliproxyAccountToUsageLimits, aligning it with native Codex rows
  • Adds development fixture support via limitsFixture query parameter in UsagePage to test pooled views with synthetic data
  • Risk: UsageLimitsSection in UsageLimits.tsx removes prior local-provider and source-account group rendering; out-of-tree consumers expecting the old layout will break
Macroscope summarized 83eaf1b.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. 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.6 KiB13.6 KiB−5 B (−0.0%)15.1 KiB✅
      CodexThread snapshot wire7.0 KiB7.0 KiB+1 B (+0.0%)7.3 KiB✅
      CodexLive turn WebSocket wire6.6 KiB6.6 KiB−6 B (−0.1%)7.8 KiB✅
      CodexLive turn WebSocket decoded57.1 KiB57.1 KiB0 B (0.0%)66.4 KiB✅
      CodexLive turn messages10100 (0.0%)21✅
      ClaudeTotal thread wire13.6 KiB13.6 KiB+19 B (+0.1%)15.1 KiB✅
      ClaudeThread snapshot wire7.0 KiB7.0 KiB−2 B (−0.0%)7.3 KiB✅
      ClaudeLive turn WebSocket wire6.5 KiB6.5 KiB+21 B (+0.3%)7.8 KiB✅
      ClaudeLive turn WebSocket decoded57.8 KiB57.8 KiB0 B (0.0%)66.4 KiB✅
      ClaudeLive turn messages990 (0.0%)21✅

      Baseline: 0c200c5 · PR result: 83eaf1b · 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.

    3. packages/shared/src/usageLimits.ts lines 394 to 394OutdatedResolvedby juliusmarminge
    4. Bugbot is paused — on-demand spend limit reached

      Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

      A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

    5. Bugbot is paused — on-demand spend limit reached

      Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

      A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

    6. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — This changes the default Usage → Limits experience and adds substantial production logic for merging accounts, pooling quotas, rendering interactive cards, and redeeming reset credits. The scope crosses server normalization, shared runtime calculations, and web UI behavior, making human review appropriate.

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

    8. juliusmarminge merged thisb273d1c

    9. juliusmarminge closed this

Sign in to join this conversation.