Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): show limits for Claude setup-token accounts #24128

Openkoushikxd(GitHub profile, opens in a new tab)wants to merge 15 commits intomain fromrefs/pull/24128/headopened View on GitHub

Fixes https://git.cafe/pingdotgg/t3code/issues/24114. Claude accounts signed in with claude setup-token (CLAUDE_CODE_OAUTH_TOKEN) never appear in Usage → Limits. The token lacks the profile scope, so get_usage returns rate_limits_available: false and T3 marks the account unsupported, which also drops every streamed reading. Their turns do stream all windows in rate_limit_info.unifiedWindows, an @internal field the pinned SDK does not type.

Summary

 checkClaudeProviderStatus
   claudeUsageResponseToLimits
-    rate_limits_available false  → unsupported
+    rate_limits_available false, tokenSource is CLAUDE_CODE_OAUTH_TOKEN[_FILE_DESCRIPTOR]
+                                 → probeFailed + "Limits appear after this account's next turn."
+    otherwise unchanged (API key, Bedrock, ANTHROPIC_AUTH_TOKEN stay unsupported)

 ClaudeAdapterV2 rate_limit_event
   claudeRateLimitEventToUpdate
-    top-level rateLimitType + utilization only (absent for setup tokens → nothing)
+    every window in unifiedWindows, each decoded on its own   → { windows, complete: true }
+    then the event's own top-level window overrides its entry (the CLI can skip refreshing the snapshot)

 applyUsageLimitsUpdate
+  complete update clears a failed probe; unsupported still short-circuits

resolveUsageLimitsAfterProbe already keeps published windows through a later probeFailed probe, so once a turn has reported, the bars survive provider refreshes.

Evidence

Ran end to end against two real setup-token Claude instances (Claude, dar) on isolated dev state, headless.

  • Before: after a turn on each instance, only Codex shows. No Claude section, no notice. before
  • After, at startup: each setup-token instance shows a notice instead of disappearing. after startup
  • After, one turn each: Session and Weekly bars for both accounts. after turn
  • After a provider refresh: the readings stay. after refresh

Tests, each red on main first:

claudeUsageResponseToLimits
  setup-token source + rate_limits_available false → probeFailed; no token source → unsupported
claudeRateLimitEventToUpdate
  event captured from a setup-token turn (no top-level utilization) → five_hour 20%, seven_day 59%, complete
  top-level five_hour 75% vs snapshot 25% → 75%, seven_day still read from snapshot
  one malformed snapshot window → skipped, the valid ones kept
applyUsageLimitsUpdate
  complete update clears probeFailed (and works with no previous), leaves unsupported alone

vp run check:changed: format, lint, knip, typecheck (29 packages), tests all pass.

Merge Danger

Door: two-way

complete is an optional field on a server-internal update; older readers ignore it. Reverting restores the previous behavior with no persisted state to migrate.

Blast Radius: Claude-limits

  • Every Claude account now reads unifiedWindows, not just setup tokens. For subscription logins that already worked, a turn now also refreshes the windows the event didn't name, and clears a transient probeFailed so the bars survive the next failed probe instead of vanishing.
  • The event's top-level window still wins over the snapshot, matching https://git.cafe/pingdotgg/t3code/pulls/14441, so the two should rebase cleanly in either order apart from the mapper conflict.
  • Codex never sets complete; its path is unchanged.
  • After a server restart a setup-token account shows the notice again until its next turn.

Related: https://git.cafe/pingdotgg/t3code/pulls/24119 targets the same issue with a broader auth gate; https://git.cafe/pingdotgg/t3code/pulls/14441 parses unifiedWindows for already-supported accounts.

Claude Opus 5.5 in Claude Code (via T3 Code); end-to-end run by GPT-6.1 Sol in Codex.

Fixes pingdotgg/t3code#24114

    1. Pushed9a3afbd

    2. @juliusmarminge can we merge or close this pr

Sign in to join this conversation.