You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Claude usage: 429 from /api/oauth/usage is not cached, Retry-After is ignored, and the last good value is dropped #6669
confirmed-reproBug reproduced again from a clean trusted checkout; see linked reportprovider-claude-codeBuilt-in plugin: provider-claude-codeprovidersCross-provider bridges, models, login
Several readers poll provider usage: the Provider usage settings section every 60 s, the sidebar footer card every 2 min and on focus, plugins through sdk.system.usageLimits(), and the CLI through bb settings usage. Anthropic then answers 429 on GET https://api.anthropic.com/api/oauth/usage. From then on claude-code reads status: "error" ("Anthropic temporarily throttled this usage check…") with no windows, often for long stretches. On 30 Oct we sampled once per minute from 14:44Z to 15:04Z: 17 errors out of 21 reads.
Why it self-sustains (from the shipped code)
server/src/services/system/usage-limits.ts: ttlMs is 10_000 for a good result and 0 for an error. While Anthropic throttles, every reader triggers a new upstream call, which prolongs the throttling.
provider-claude-codegetClaudeProviderUsage (dist/host.js) maps a 429 to an error but discards the Retry-After header. Claude Code CLI 2.1.314 handles the same endpoint differently: it remembers a 429 per bearer for Retry-After, or 5 min without one (capped at 1 h), and shows "last-known usage".
The provider-usage.v1.getResource source in provider-claude-code caches only ok results (60 s) and overwrites the stored value with the error state. Consumers outside the bundled Provider usage plugin therefore lose the last good windows; only observedAt survives.
Suggested fix
Cache an error result until Retry-After (default about 5 min, capped), keyed like the good result, so that every reader shares one backoff.
Keep the last good windows next to the error state (for example lastGood: { windows, observedAt }) so that plugins can show a stale value with its age instead of nothing.
Optionally, raise the good-result TTL to the order of minutes: weekly and 5-hour percentages do not need 10 s freshness.
Workaround on our side: a plugin reads usageLimits() once every 5 min, backs off 10, 20, then 30 min on errors, keeps the last good value with its age, and serves it to our other readers. The native panel still polls on its own.
Root cause: the provider discards retry timing, server errors receive zero cache lifetime, and the usage resource replaces successful windows with an uncached error.
Evidence:provider/resource tests and server test reproduce three assertion failures in two clean checkouts of 9662c45478. All 11 existing focused tests pass. Responses are synthetic; live Anthropic throttling duration was not verified.
No PR: a complete repair needs cross-boundary retry/stale-result contracts and policy decisions, outside this rule’s simple-fix limits.
confirmed-reproBug reproduced again from a clean trusted checkout; see linked reportprovider-claude-codeBuilt-in plugin: provider-claude-codeprovidersCross-provider bridges, models, login
Activity
bb-slop-cop commentedon Oct 30, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotproviders,provider-claude-code,confirmed-repro.9662c45478. All 11 existing focused tests pass. Responses are synthetic; live Anthropic throttling duration was not verified.Show stale and rate-limited usage honestly in the usage panel (#8455)
Show stale and rate-limited usage honestly in the usage panel (get-bb…