Repository navigation
Description
1. Summary
In a multi-account Claude pool (7 OAuth accounts), when accounts are exhausted or past switchThreshold, Account Pooler bursts /api/oauth/usage requests across every account in parallel on startup, every 5 minutes, and every 30 seconds during traffic, even for accounts whose blocking resetAt is hours or days in the future. Anthropic responds with HTTP 429 on /api/oauth/usage, and after #8455 those accounts then show only "Anthropic is rate-limiting usage checks for this account." in Provider usage with no quota bars, plan badge, or reset times even though bb pool status --json already has current limitWindows persisted in SQLite.
2. Versions and environment
- bb version:
0.50.2-nightly.46711705056.1(installed via bb updater; reproduced onmainat4d7a9af609) - Plugin:
builtin:account-pool0.1.0,builtin:provider-usage - OS / Node: Linux
7.0.0-43-generic, Nodev24.22.3 - Setup: 7 enabled Claude OAuth accounts (5 Team 5x, 1 Max 5x, 1 Max 20x) + 1 Codex OAuth account,
switchThreshold: 0.95, 3 enrolled hosts routed through one Account Pooler hub.
3. Steps to reproduce
Live observation on a 7-account Claude pool:
- Run Claude traffic until accounts cross
switchThreshold(0.95) or hit their 5h/7d limit (with known futureresetAtvalues, 1h to 4d ahead). - Let normal Claude requests continue arriving (or restart the bb server while accounts are exhausted) and open the Provider usage sidebar popover.
- Compare the Provider usage popover against
bb pool status --json.
Minimal deterministic repro in plugins/account-pool/src/server.test.ts (against 4d7a9af609):
- Configure an OAuth account whose
/usagereturnsfive_hour: { utilization: 100, resets_at: now + 3600s }. - Send
POST /v1/messagesatnow,now + 30_000, andnow + 60_000. Observe/usageis called again every 30s despite the futureresets_at. - Return HTTP 429 (without
Retry-After) from/usage, then callprovider-usage.v1.getResourcewith{ resourceId, refresh: false }on a coldprovider-usagecache while the cached window'sresetAtis still in the future. Observe{ status: "error", message: "Anthropic is rate-limiting usage checks for this account." }instead of the valid cached windows.
4. Expected vs actual
Actual (observed live on 0.50.2-nightly.46711705056.1):
- In Provider usage (Account Pooler tab), 5 of the 7 Claude accounts (
[email protected],[email protected],[email protected],[email protected],[email protected]) rendered only"Anthropic is rate-limiting usage checks for this account."with no plan label, bars, or reset times. - At the same time,
bb pool status --jsonalready held current, error-free quota observations for all 5 accounts (excerpt):
{
"email": "[email protected]",
"error": null,
"status": "exhausted",
"observedAt": 1796210898158,
"limitWindows": [
{ "slot": "primary", "windowMinutes": 300, "utilization": 1, "resetAt": 1796212800059, "status": "rejected", "source": "usage" },
{ "slot": "secondary", "windowMinutes": 10080, "utilization": 0.52, "resetAt": 1796227200059, "status": "allowed", "source": "usage" }
]
}{
"email": "[email protected]",
"error": null,
"status": "exhausted",
"observedAt": 1796210898134,
"limitWindows": [
{ "slot": "secondary", "windowMinutes": 10080, "utilization": 1, "resetAt": 1796558400037, "status": "rejected", "source": "usage" }
]
}Expected:
- Exhausted/past-threshold accounts with a known future
resetAtshould not be polled every 30s on every incoming request;isRefusedWindow/isWindowPastThresholdalready auto-clear them atresetAt, and the 5-minute background loop plus manual refresh cover mid-window changes. - Multi-account refreshes for the same provider should not fire all accounts concurrently in one
Promise.allburst, and 429 responses withoutRetry-Aftershould back off exponentially (not 1s) without being locked out for 5 minutes afterretryAtexpires. - When
provider-usagehas a cold cache (for example after a server restart) and callsgetResource({ refresh: false }),account-poolshould return its current persisted/headerlimitWindows(status: "ok") while at least one window is still un-reset, and still reportstatus: "error"on explicitrefresh: trueor once all cached windows have reset (preserving Show stale and rate-limited usage honestly in the usage panel #8455).
5. Evidence
Root cause in main at 4d7a9af609:
- 30-second recheck ignores known future
resetAt:forward()callsrefreshExhaustedUsage()wheneverselected === nullorisPastThreshold(selected.quota, ...)(hub.ts#L528-L544).refreshExhaustedUsage()runsPromise.allover every OAuth account matchingisPastThresholdatEXHAUSTED_USAGE_REFRESH_INTERVAL_MS(30s) (hub.ts#L342-L367), even whenresetAtis hours or days ahead, despiteisRefusedWindow/isWindowPastThresholdauto-clearing onceresetAt <= now. - Cold-cache
refresh: falsehides valid persisted windows:registerUsageSource()returns{ status: "error" }wheneverhub.usageCheckFailure(account.id)is non-null, regardless ofrefreshor whetheraccount.limitWindowshas un-reset windows (usage-source.ts#L143-L167).provider-usageonly keeps cached bars alongsiderefreshError("Showing last update.") if its own in-memorymeasurementsmap previously received astatus: "ok"(provider-usage/server.ts#L191-L203, provider-usage/server.ts#L364-L369). Whenaccount-pool's startup burst 429s beforeprovider-usagecaches a reading, all bars disappear. - Unstaggered
Promise.allbursts and 429 backoff conflated withlastUsageRefreshAt:refreshUsage()fans outPromise.allacross all OAuth accounts at once on hub start and every 5 minutes (hub.ts#L184-L187, hub.ts#L324-L340). On 429 withoutRetry-After,failedUsageRefresh()usesretryAfterMilliseconds()which defaults to1_000ms with no exponential backoff (provider-adapter.ts#L76-L88, quota.ts#L295-L304). MeanwhilerefreshAccountUsage()stampslastUsageRefreshAtbefore the fetch (hub.ts#L379-L382), so after a 429, passive checks (minIntervalMs = 5m) skip retrying even afterretryAthas passed, leavingusageFailuresstuck for 5 minutes.
6. What you ruled out
- Not an OAuth/login failure:
account.errorwasnullon all 7 accounts andplugins/account-pool/logs/plugin.logshowed normal scheduled OAuth refreshes succeeding for every account. - Not a duplicate of Account Pooler: Provider usage keeps showing old readings after the plugin is disabled, and failed usage refreshes are silent #7739 (disabled plugin / silent refresh failures), Provider usage: an Account Pooler account with a rejected login (invalid_grant) keeps showing its last usage unmarked, with only a group-wide "Couldn’t refresh. Showing last update." notice #7417 (rejected
invalid_grantlogin), or Provider usage: show a source-reported accounterrorstate on that account's row instead of treating it as a failed refresh of the whole group #7421 (per-row error rendering inprovider-usage): this is a multi-account/api/oauth/usagepolling storm and cold-cache interaction introduced/exposed after Show stale and rate-limited usage honestly in the usage panel #8455. - Still present on
mainat4d7a9af609.
7. Suggested priority and effort
Affects any user with multiple OAuth accounts in Account Pooler once accounts near switchThreshold or exhaust; no data loss, workaround is inspecting bb pool status --json. Small, plugin-local fix in plugins/account-pool.
AGENT GENERATED
Activity
bb-slop-cop commentedon Dec 2, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotTriage: Bug · Medium priority · Medium effort ·
providersREPRODUCED · High confidence ·
confirmed-repro· Reproduction and root-cause report. Five assertions exposed the same failures in two cleanmaincheckouts with a simulated provider. The hub rechecks accounts before known quota resets, sends same-provider checks concurrently, and mixes retry timing with the normal refresh interval. After a 429, the usage source returns an error on a passive read even when an unexpired quota window is saved.No new PR: open PR #8556 already links this issue.