# fix\(server\): preserve hub usage readings after provider rate limits · PR \#19820 · pingdotgg/t3code

[View on GitCafe](https://git.cafe/pingdotgg/t3code/pull/19820)

Repository: [pingdotgg/t3code](https://git.cafe/pingdotgg/t3code)

Visibility: public

State: open

Source repository: Unavailable fork

Source branch: fix/limits-hub-probe-throttle

Target branch: main

Head commit: df2da49b4f2482cb82e134a6b645f90c3d42029a

[Discussion and reviews](https://git.cafe/pingdotgg/t3code/pull/19820)

[Commits](https://git.cafe/pingdotgg/t3code/pull/19820/commits?format=markdown)

[Files changed](https://git.cafe/pingdotgg/t3code/pull/19820/diffs?format=markdown)

## Description

---

## Problem

Repeated Limits refreshes can make the hub hit Claude’s usage endpoint with bursts of requests. A provider 429 then replaces valid usage bars with an unavailable message. See [#19807](https://github.com/pingdotgg/t3code/issues/19807).

## Change

Keep per-account pacing inside the hub API: successful probes are reused for one minute, consecutive failures back off for two, four, then eight minutes, and failed probes retain a successful reading until it is fifteen minutes old. Account identity includes the hub URL, file, provider, email, and workspace. Reset-credit attempts invalidate the account’s cached reading after success, uncertain failure, or interruption; an explicit provider rejection with 429 preserves the reading and backoff.

Rebuilt from @JustYannicc’s [original contribution](https://github.com/pingdotgg/t3code/pull/19820), preserving the contributor commits and merging main. Removed the generic throttled-reader abstraction and consolidated sixteen added tests into five behavior cases in the existing API suite. Management diagnostics and URL-prefix behavior already exist on main and are unchanged here.

Two rounds of independent Opus and Sol reviews completed; the final round found no confirmed issues. The first round’s refresh-documentation clarification is included.

## Scope and approval

This maintainer takeover follows the reported bug in [#19807](https://github.com/pingdotgg/t3code/issues/19807). Maintainer review is still needed for the one-minute refresh, two-to-eight-minute backoff, and fifteen-minute retention policy identified by Macroscope. Unmerged.

## Verification


- [Focused suites: 24 passed](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/38121374ebc18156/19820-implementation-tests.log) across the API and usage-source service; targeted lint, formatting, and server-only typecheck pass.
- [All five regression cases fail without the fix](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/a673e15588493a33/19820-test-red-without-fix.log); the concurrency case also fails when reset invalidation loses coordination with in-flight reads.
- [Headless HTTP before/after proof](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/8fda8418b0ce6704/19820-http-proof.json) uses the actual API code, a local simulated hub, and a controlled clock. Across eight refreshes of two Claude accounts, main makes 16 probes, receives 14 rate limits, and returns 14 blank readings; the rebuilt code makes 6 probes, receives 4 rate limits, and returns no blank readings.

This changes the shared server path consumed by web, desktop, and mobile. No UI rendering or wire contract changed. The HTTP proof uses fixture accounts, not live provider credentials. Actual upstream timing, real credit redemption, macOS, Windows, Electron desktop, iOS, and Android were not verified. The existing Codex fallback when usage succeeds but its separate credit lookup fails remains unchanged; the combined partial result may now be reused for one minute.

CI on `ef207fca70`: lint, build/typecheck, package tests, and all eight server shards passed. Web, Rust, native static analysis, and release smoke jobs skipped for this server-only scope. One duplicate fingerprint run was cancelled; another fingerprint run on the same head succeeded. CodeRabbit completed a full review of the rebuilt head with no actionable findings, following two independent delegated whole-PR review rounds. There are no unresolved review threads.

Implementation: Codex GPT-6.1-Sol (high), tests: Codex GPT-6-Astra (high), independent reviews: Claude Opus 5.5 and Codex GPT-6-Sol, through T3 Code’s delegated agents and Codex harness.

Fixes #19807
GitCafe: https://git.cafe/pingdotgg/t3code/issues/19807

