Repository navigation
Description
Summary
With the default switchThreshold of 0.98, Account Pooler does not just switch away from an account at 98 % utilization; it stops using that account completely. On 2026-10-21 the last Claude account below 98 % crossed the threshold. Four of the six enabled accounts were at 98–99 % with every window still allowed, but the pool answered every Claude request with its own 429. That 429 quoted the reset of one of the two accounts that upstream had actually rejected, so Provider Retry parked the thread for 2 h 47 min, while the same four accounts served traffic as soon as switchThreshold was set to 1. Expected: when no account is below the threshold, the pool routes to an account that upstream still allows instead of refusing.
Versions and environment
- bb 0.46.1, installed through npm (
bb-app), running as a systemd user service. desktop-v0.46.1 is the latest release. Debian 13 (trixie), Linux 6.12, x86_64, Node v24.22.1. - Built-in Account Pooler (
account-pool) 0.1.0.switchThresholdwas at its default 0.98 during the incident. Provider Retry 0.1.0 withmaximumWaitset to "6 hours". - Claude Code 2.1.308 during the incident (2.1.309 now), model
claude-opus-5-5. The pool's Codex accounts (codex-cli 0.163.0) were not involved. - Pool: six enabled Claude OAuth accounts (Max and Pro), called A–F below in priority order. All had
error: nullandheldUntil: null, and extra usage was off (extraUsage.status: "rejected"). - Unchanged on
mainat1e80ca7b44bccd06c6da75ed9ca6ba497bd380f5:git diff desktop-v0.46.1 1e80ca7b44 -- plugins/account-pool/src/quota.ts plugins/account-pool/src/hub.ts plugins/account-pool/src/contracts.tsis empty;- the installed
server.jshas the sameactiveWindowandselect()filters.
Steps to reproduce
Live (this happened on 0.46.1; I did not drain the accounts a second time on purpose):
bb plugin enable account-pool, add two or more Claude OAuth accounts, keep extra usage off and leave the default threshold (bb pool configshowsswitchThreshold: 0.98).- Use the pool until every enabled Claude account has a 5h or 7d window at 0.98 or more, while at least one account has every window below 1 and
"allowed"inbb pool account list --json.- Accounts are used one after another until each reaches the threshold (accounts-and-routing.md).
- So after a heavy week this is the normal state, not a corner case.
- Send a turn in a pooled Claude thread, for example
bb thread spawn --project <proj> --provider claude-code --prompt "Reply only with ok.". - The turn fails with the 429 shown below.
bb provider-retry explain <thread> --jsonshowsblockedwith the farretryAt. - Run
bb pool config set switchThreshold 1, thenbb provider-retry retry <thread>. The turn now succeeds on one of the accounts the pool had excluded.
Source-level (deterministic, on main at 1e80ca7, Node ≥ 23.6 for type stripping, no install needed): save this as repro.mts in the repo root and run node repro.mts. It passes the pool state from the incident to the quota.ts predicates that select() and accountAvailability() use.
repro.mts
// repro.mts: run from the repo root at 1e80ca7 with Node >= 23.6: node repro.mts
import * as q from "./plugins/account-pool/src/quota.ts";
const now = Date.parse("2026-10-21T23:13:02.259Z"); // first pool 429
const family = q.modelFamily("claude-opus-5-5");
const at = (s: string | null) => (s === null ? null : Date.parse(s));
type W = [number, string, string | null]; // utilization, status, resetAt
const quota = (h5: W, d7: W) => ({
usageRestriction: null, extraUsage: null, heldUntil: null, error: null, // extra usage off
representativeClaim: null, limitWindows: [], observedAt: now,
familyWeekly: { fable: null, sonnet: null, opus: null, haiku: null, other: null },
fiveHourUtilization: h5[0], fiveHourStatus: h5[1], fiveHourResetAt: at(h5[2]),
sevenDayUtilization: d7[0], sevenDayStatus: d7[1], sevenDayResetAt: at(d7[2]),
});
// Pool state at the incident (bb pool account list --json, usage poll 23:15Z)
const accounts = {
A: quota([0.26, "allowed", "2026-10-22T02:50:00Z"], [0.98, "allowed", "2026-10-26T23:00:00Z"]),
B: quota([0, "allowed", null], [0.99, "allowed", "2026-10-22T22:00:00Z"]),
C: quota([0, "allowed", null], [0.98, "allowed", "2026-10-26T06:00:00Z"]),
D: quota([0, "allowed", null], [1, "rejected", "2026-10-22T02:00:00.044Z"]),
E: quota([0.99, "allowed", "2026-10-22T03:30:00Z"], [0.76, "allowed", "2026-10-26T01:00:00Z"]),
F: quota([0, "allowed", null], [1, "rejected", "2026-10-24T05:00:00.434Z"]),
};
for (const threshold of [0.98, 1]) {
// the predicate select() and accountAvailability() apply (hub.ts L862-L871, L1312-L1317)
const rows = Object.entries(accounts).map(([name, a]) => {
const exhausted = q.isQuotaExhausted(a, family, threshold, now) && !q.hasExtraUsage(a);
const reset = q.blockingResetAt(a, family, threshold, now);
return [name, exhausted ? `excluded until ${new Date(reset!).toISOString()}` : "eligible"];
});
console.log(threshold, Object.fromEntries(rows));
}Output at 1e80ca7 (Node v24.22.1):
0.98 {
A: 'excluded until 2026-10-26T23:00:00.000Z',
B: 'excluded until 2026-10-22T22:00:00.000Z',
C: 'excluded until 2026-10-26T06:00:00.000Z',
D: 'excluded until 2026-10-22T02:00:00.044Z',
E: 'excluded until 2026-10-22T03:30:00.000Z',
F: 'excluded until 2026-10-24T05:00:00.434Z'
}
1 {
A: 'eligible',
B: 'eligible',
C: 'eligible',
D: 'excluded until 2026-10-22T02:00:00.044Z',
E: 'eligible',
F: 'excluded until 2026-10-24T05:00:00.434Z'
}
At 0.98 the earliest "excluded until" is exactly the time quoted in the 429. It belongs to D, one of the two accounts that upstream had actually rejected.
Did not reproduce:
- With
switchThreshold1: the same accounts served 14 turns until the next reset (see Evidence). - When an account has extra usage allowed: the Support Claude and Codex extra-usage fallback and availability #4531 fallback skips the threshold for it.
Expected vs actual
Actual: the pool returned its own 429 in two threads, and no request reached Anthropic:
- thr_t9xt22j7id at 23:13:02.948Z (shown below);
- thr_biw5z6pxki at 23:13:41.585Z, quoting 02:00:00.165Z, which is the same window observed again.
API Error: Request rejected (429) · No Account Pooler account is currently eligible. Next account is expected to be available at 2026-10-22T02:00:00.044Z (in 10018 seconds).
Fields from bb pool account list --json at 23:19:19Z, with threshold 0.98. Labels are replaced; the other values are verbatim:
{"label": "A", "fiveHourUtilization": 0.26, "sevenDayUtilization": 0.98, "fiveHourStatus": "allowed", "sevenDayStatus": "allowed", "heldUntil": null, "error": null, "status": "exhausted"}
{"label": "B", "fiveHourUtilization": 0, "sevenDayUtilization": 0.99, "fiveHourStatus": "allowed", "sevenDayStatus": "allowed", "heldUntil": null, "error": null, "status": "exhausted"}
{"label": "C", "fiveHourUtilization": 0, "sevenDayUtilization": 0.98, "fiveHourStatus": "allowed", "sevenDayStatus": "allowed", "heldUntil": null, "error": null, "status": "exhausted"}
{"label": "D", "fiveHourUtilization": 0, "sevenDayUtilization": 1, "fiveHourStatus": "allowed", "sevenDayStatus": "rejected", "heldUntil": null, "error": null, "status": "exhausted"}
{"label": "E", "fiveHourUtilization": 0.99, "sevenDayUtilization": 0.76, "fiveHourStatus": "allowed", "sevenDayStatus": "allowed", "heldUntil": null, "error": null, "status": "exhausted"}
{"label": "F", "fiveHourUtilization": 0, "sevenDayUtilization": 1, "fiveHourStatus": "allowed", "sevenDayStatus": "rejected", "heldUntil": null, "error": null, "status": "exhausted"}
After switchThreshold was set to 1 at 23:20:28.9Z, bb pool status --json at 23:21:00Z showed A, B, C and E as "status": "ready" with the same utilization. D and F stayed exhausted.
Expected:
- The threshold works as a switch point. While any account is below it, that account wins, as it does today.
- When no enabled, non-errored, non-held account is below it for the request, accounts above the threshold that upstream still allows (no window
rejected, utilization below 1) stay routable as a fallback tier.- Preferably the account with the lowest utilization on the window that crossed the threshold goes first, ties by priority. Plain ring order would also work.
select()already has this two-tier preference for extra usage (hub.ts L872-L884).- Conversations would move back to a below-threshold account when one recovers, as they already do for extra usage.
- In that case
accountAvailability()returnsready.- That flows through to
provider-retry.v1.availability, the 429 text andretry-after, so a reset is quoted only when no account is upstream-allowed. bb pool account listandbb pool statusshow these accounts as usable (ready, or a separatefallbackstatus), notexhausted.
- That flows through to
- Hitting the real limit stays safe. On an upstream quota rejection, the pool already records the
rejectedstatus from the response headers and tries the next account within the same request (hub.ts L583-L599). - If a hard reserve is wanted (Account Pooler: last-resort accounts, per-account switch thresholds, and an opt-in order by earliest weekly reset #4468 asks for per-account thresholds "to leave 30 % for another tool"), it should be an explicit per-account or opt-in setting, not what the pool-wide default does.
From the code, not observed: even at the maximum value 1, activeWindow excludes a window whose utilization is 1.0 and whose status is allowed. Where the pool has an upstream status, the fallback tier should go by that status.
Evidence
Timeline (UTC, 2026-10-21/22). Times come from createdAt in bb thread log <thr> --json and from the bb pool captures in thr_v6a8gpnpii:
- 23:11:03–23:12:51: the last successful pooled turn (thr_8mbj8rkgtg) ran on E, the active account according to the pool's affinity table. After it, E's 5h window read 99 %, and no account was below 0.98.
- 23:13:02.259: first pool 429. A running workflow in thr_t9xt22j7id failed, then that thread's main turn failed at 23:13:02.948. thr_biw5z6pxki and its workflow failed at 23:13:41.585.
- 23:15:24: usage poll. At 23:17:40 and 23:19:19,
bb pool account list --jsonshowed all six accountsexhausted. A, B, C and E had every windowallowed; D and F showedsevenDayStatus: "rejected"at 1.0. - 23:20:28.934:
switchThresholdset to 1. At 23:21:00, A, B, C and E wereready. - 23:23:48.629: thr_biw5z6pxki was sent ahead of Provider Retry's schedule. From then until 01:59:56 it completed 14 turns with no provider error. In that window D was at 100 % until 02:00Z and F until 10-24, so every one of those turns ran on accounts that the 0.98 threshold had excluded.
- 02:00:23.441: Provider Retry resumed thr_t9xt22j7id ("Please continue.",
retryAttempt2). That matchesretryAt02:00:00.044 plus 15–45 s of jitter. The thread stalled for 2 h 47 min 20 s.
The stored allowed status alone doesn't prove the accounts could serve. When the usage API omits a status, the pool derives allowed from utilization below 1 (usage.ts L82-L92). The 14 completed turns are the proof.
Code at 1e80ca7:
- quota.ts L146-L158:
activeWindowcounts a window as active atutilization >= threshold, even when its status isallowed. - quota.ts L312-L325:
accountStatusreports such an account asexhausted. - hub.ts L853-L871:
select()drops every account at or above the threshold; extra usage is the only bypass. - hub.ts L464-L480: the usage recheck before refusing (Recheck exhausted Account Pool usage before refusing a request #4215) applies the same threshold.
- hub.ts L1294-L1332:
accountAvailabilityreturnsblockedwith the earliest reset among the excluded accounts. hub.ts L1334-L1360 turns that into the 429. - provider-retry/server.ts L55-L109: Provider Retry takes that
retryAtonce per failed turn and schedulessendAtfrom it. - contracts.ts L3-L8: the default is 0.98.
- The docs disagree on what the setting means:
- configuration.md L923-L925 says an account "stops receiving matching traffic";
- the skill reference says the pool "advances to the next eligible account" (L84-L88) and describes the extra-usage tier at L96-L101.
Investigation: thr_agudxusj98 (item R3 of its pool-research report). Diagnosis and config change: thr_v6a8gpnpii. Affected threads: thr_t9xt22j7id, thr_biw5z6pxki.
What you ruled out
- Not Account Pooler: last-resort accounts, per-account switch thresholds, and an opt-in order by earliest weekly reset #4468. That issue asks for last-resort flags, per-account thresholds and ordering by reset time. Its prototype (
feat/pool-last-resort) keeps the threshold a hard cutoff, now per account. Nothing in it routes to accounts above the threshold when all of them are past it. This report fits alongside it: an explicit per-account reserve from Account Pooler: last-resort accounts, per-account switch thresholds, and an opt-in order by earliest weekly reset #4468 can stay hard. - Not Account Pooler blocks Claude extra usage when subscription quota reaches the switch threshold #4475 / Support Claude and Codex extra-usage fallback and availability #4531. That fallback applies only when extra usage or credits are allowed, and extra usage was off on all six accounts.
- Not Account Pooler: all-exhausted error doesn't say when an account frees up #5224 / Include known recovery time in account pool exhaustion errors #5226. Those added the reset time to the 429 message. Here the message quotes the reset of a 100 % account while usable accounts are ignored.
- Not stale data. The usage poll was at 23:15Z, the recheck before refusing (Recheck exhausted Account Pool usage before refusing a request #4215) uses the same threshold, and all accounts had
error: nullandheldUntil: null. - Not an upstream limit. The 429 comes from
noEligibleResponse, and the same accounts served traffic as soon as the threshold changed. - Separate from Provider Retry: re-evaluate pending and declined pool-routed retries when Account Pooler availability changes #6172, which is about Provider Retry not re-checking parked retries after a pool change. That is why thr_t9xt22j7id kept waiting after 23:20; it is not part of this report.
- Still happens on
mainat 1e80ca7. The diff is empty, and the source-level repro above runs against it. - Codex: Codex accounts go through the same
select()andaccountAvailability(), but I only observed this with Claude.
Suggested priority and effort (optional)
Medium. Every pool on the default threshold hits this at the end of a heavy week. There's a workaround (bb pool config set switchThreshold 1), but it gives up switching early. No data is lost, but running workflow agents fail and threads stall for hours. Effort is probably low to medium: the fix extends the existing extra-usage fallback tier in select() and accountAvailability().
Checks
- I reproduced this on the latest release or on
main, or I say above that I could not. - I searched open and closed issues for the same problem.
- If an agent wrote this, the body ends with
> AGENT GENERATEDand links the thread or report.
AGENT GENERATED
Activity
bb-slop-cop commentedon Oct 23, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotproviders,provider-claude-code,confirmed-repro.origin/mainat1e80ca7b4.hellno commentedon Oct 30, 2026
I'd like to fix this, but it changes documented behavior (docs/configuration.md) says accounts past
switchThresholdstop receiving traffic), so checking first.my suggestion: when every account is past the threshold, keep routing to the ones upstream still allows (lowest utilization first, before extra usage) instead of returning the pool's own 429. Hard reserves would come from per-account thresholds (#4468).
OK to go ahead?
Keep Account Pooler accounts past the switch threshold usable until t…