Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: Refreshing providers keeps showing Claude usage up to five minutes old #28721

Openryoppippi(GitHub profile, opens in a new tab) opened this issue 2 comments

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

  • apps/server

Steps to reproduce

  1. Start T3 Code with a signed-in Claude provider and wait for the initial Claude check.
  2. Refresh providers (the Usage page refresh, the provider settings refresh button, or server.refreshProviders with an empty payload).
  3. Refresh again a minute or two later, still within five minutes of the initial check.
  4. Compare Claude's usageLimits.checkedAt after each refresh.

Expected behavior

An explicit refresh returns a freshly read Claude usage reading, as it does for the other providers.

Actual behavior

Claude's usageLimits.checkedAt stays at the initial check for up to five minutes, so every refresh in that window shows the same reading while Codex, Grok and the others come back freshly probed.

ClaudeDriver caches capabilities with fresh usage for CAPABILITIES_PROBE_TTL (five minutes). ManagedServerProvider.refresh forces a provider check but never calls invalidateUsageCache, so the check reads the cached probe. Only refreshUsage (after a turn) and the reset redemption invalidate it.

Impact

Minor bug or occasional failure

Version or commit

T3 Code (Beta) 0.1.3; reproduced on main at 1d626d02d9.

Environment

macOS, Claude Pro account, native Claude provider.

Logs or stack traces

Two refreshes against a dev server on main (vp run dev:server --no-seed):

refresh started 15:58:43 -> Claude usageLimits.checkedAt 15:58:40.443Z (startup check)
refresh started 15:59:06 -> Claude usageLimits.checkedAt 15:58:40.443Z

Workaround

None from the UI; waiting five minutes before refreshing.

#27772 reports that Claude's /api/oauth/usage is rate-limited per account and asks for one throttle across refresh routes. A fix here should therefore not let explicit refreshes read the endpoint without a bound. Proposed fix: #28720, which re-reads usage on an explicit refresh only when the published reading is at least a minute old.

  1. tanstack-source added labelsbug

  2. The fix for this is in #28720. The CI-runnable proof for it, stacked on that branch, is here: https://github.com/ryoppippi/t3code/pull/1

    The proof drives the real Claude driver with a mocked Claude Agent SDK query and the repository's fake claude fixture, so it needs no signed-in Claude account: a refresh inside the one-minute floor is answered from the capabilities cache, and a refresh past the floor re-reads Claude. Reverting #28720's change to packages/provider-core/src/server/managedProvider.ts makes the new test fail with AssertionError: expected 12 to be 88.

    The proof is one commit (52d5a4581) and can be cherry-picked onto #28720's branch.

  3. Another data point: still reproducible on main @ dfeaf7b13 (Nov 16), with a common trigger: a reset redeemed outside T3 Code.

    Steps

    1. A Claude subscription account hits its weekly limit. Usage → Limits shows the Weekly row and the model-scoped weekly row at 0% left.
    2. Redeem a full weekly reset on claude.ai (outside T3 Code).
    3. Click refresh on Usage → Limits.

    Expected: the rows refill on that refresh.

    Actual: the rows stay at 0% left. Each server.refreshProviders RPC returns in ~0.2–2.5 s (server trace log), so the refresh is answered from the ClaudeDriver capabilities cache (CAPABILITIES_PROBE_TTL, 5 min), not a fresh get_usage. The correct value shows up only once that cache entry expires (here about a minute after the first refresh).

    A reset redeemed on claude.ai never goes through the in-app path that clears the cache (refreshUsage → invalidateUsageCache, which only runs after a turn fails on a usage limit), so the Limits refresh button is the only recovery path, and it doesn't re-probe. #28720 looks like it would cover this.

Sign in to join this conversation.