Repository navigation
Description
The workflow
I run the Account Pooler with several Claude and Codex subscriptions. I keep one more Claude account as a reserve: it is signed in, disabled on purpose, and I enable it by hand only when every other account is exhausted. That creates two routine jobs:
- Re-authenticate an existing account. In each of these cases I want to give an existing pool account a fresh login and keep everything else about it:
- Logins expire. Claude Code warns 3 days ahead and then fails with
Login expired(docs). - A refresh token can also be revoked or spent.
- Disabling Account Pooler breaks Claude: running turns 503-retry for ~3 min, new threads fail with an expired local OAuth login #4352 is a reason to move accounts added with
--importonto the pool's own--logingrant.
- Logins expire. Claude Code warns 3 days ahead and then fails with
- Keep the disabled reserve usable, and find out early when it is not. Before the emergency, I need to know that the reserve's login still works and when it expires.
I cannot do either with the CLI, the RPC or the settings page today.
What happens today
Checked on bb 0.46.1 (npm bb-app, Linux x86_64, Node v24.22.1, built-in account-pool 0.1.0). Also checked in source at 1e80ca7b44bccd06c6da75ed9ca6ba497bd380f5, which is current main. The installed bundle has the same CLI rules, add defaults and refresh filter, so nothing below has changed on main.
1. An existing account cannot be re-authenticated.
-
The only sign-in path is
bb pool account add --login. Thelogin.startandcodexLogin.startRPCs take no input, so a login cannot be tied to an existing account (rpc.ts#L77-L88, cli.ts#L320-L354). -
When the login completes,
addOAuth/addCodexOAuthalways create a new record:- it gets a new UUID,
enabled: trueandpriority: 100; - the enable hook (a forced usage refresh) runs right away.
See operations.ts#L100-L123, operations.ts#L125-L156 and store.ts#L79-L102. The docs confirm that a new account is routable immediately (accounts-and-routing.md#L44-L44).
- it gets a new UUID,
-
The only way to re-authenticate is to add a new account and remove the old one:
add --login, thenlogin-completeorlogin-poll, thenpriorityorreorder, thendisable(for a reserve), thenremove <old>. This has costs:- The account id changes. Conversation pins and the per-provider active-account cursor point at the old id (hub.ts#L914-L918, hub.ts#L943-L948).
removedeletes the account's stored quota observations (operations.ts#L162-L169).- Scripts that use the old id stop working.
- Until the follow-up commands run, the new record is enabled at priority 100. For a reserve, that is exactly the state I want to avoid.
-
Open PR fix(account-pool): reject duplicate OAuth account imports #5709 would reject an OAuth add that matches an existing account, "even a disabled one", and leave the existing record unchanged. If it lands, the workaround has to become remove-then-add, and the account is missing from the pool in between.
2. --label and --priority cannot be combined with --login, and there is no --disabled.
$ bb pool account add --help
...
Rules:
Exactly one of: --login, --import, --api-key
At most one of: --login, --label
At most one of: --login, --priority
- The rules are at cli.ts#L312-L316, and
--prioritydefaults to 100 (cli.ts#L300-L309). login-completeaccepts only--sessionand--code;login-pollaccepts only--session.- No add path (
--login,--import,--api-key) can create a disabled account.
3. The login expiry is not stored or shown.
- None of the three add paths keeps the refresh-token expiry:
- Claude sign-in reads only
access_token,refresh_tokenandexpires_in(oauth-login.ts#L15-L21, oauth-login.ts#L226-L242); - token refresh does the same (claude-adapter.ts#L34-L41, claude-adapter.ts#L107-L132);
--importdropsrefreshTokenExpiresAtfrom~/.claude/.credentials.json(credentials.ts#L12-L24, credentials.ts#L171-L179).
- Claude sign-in reads only
- The account and OAuth secret schemas are
.strict()and have no field for this value (contracts.ts#L133-L162). - The information is available. Claude Code 2.1.309 reads
refresh_token_expires_infrom the token response on sign-in and on refresh and stores it asrefreshTokenExpiresAt. I saw this in the installed binary, and the key is present in this host's credential file. - So
bb pool account list,bb pool statusand the settings page cannot say "login expires in N days". The first sign of an expired login is aninvalid_granton a live request, which puts the account intoerror(hub.ts#L537-L549).
4. Disabled accounts are never checked, and account refresh does nothing for them while reporting success.
hub.refreshUsageonly handles accounts that are both enabled and OAuth:account.enabled && account.kind === "oauth"(hub.ts#L289-L305).- The 5-minute background loop (hub.ts#L173-L176) and
bb pool account refresh <id>(operations.ts#L198-L206) both go through it. - So neither touches a disabled account.
- The 5-minute background loop (hub.ts#L173-L176) and
- The CLI still prints
Refreshed usage for <id>., because it only checks that the account'serroris null (cli.ts#L628-L651). The docs describerefreshas "an immediate refresh for one account" and don't mention this exception (accounts-and-routing.md#L62-L70). - The only way to test a disabled account is
enable. That clears its error, forces a refresh and makes it routable, all in one step (operations.ts#L171-L179, server.ts#L208-L221). - Observed:
bb pool account list --jsonshows my reserve (priority 8) asstatus: "disabled", error: null.- It was added with
--importduring the 2026-10-22 episode: all enabled Claude accounts were exhausted from about 10:02Z, and the account was added at 10:12:47Z. - While enabled, it logged
OAuth refresh failed with HTTP 400. invalid_grant. … forced=false.at 11:46:58Z. - The investigation expects its stored refresh token to be spent by now, because the other holder of that imported grant has rotated it since. The pool cannot confirm or rule this out without putting the account back into routing.
- This is an inference. I did not run
refreshorenableon it, because a real refresh of a shared grant can invalidate the other holder's copy (the Disabling Account Pooler breaks Claude: running turns 503-retry for ~3 min, new threads fail with an expired local OAuth login #4352 race). Item 4 is verified in source only.
- It was added with
What you would expect
- Re-login in place.
- Add
bb pool account login <id>, a matching RPC (for examplelogin.start({ accountId })), and Sign in again in the account menu. - It runs the same PKCE or device-code flow.
login-complete/login-pollthen replace only that account's secret. - These stay the same: id, label, priority, enabled flag, conversation pins, active cursor and quota observations.
- If the new login belongs to a different account, refuse it. Compare
accountUuidorcodexAccountId, with email as a fallback. - On success, clear the account's
errorand publish the accounts-changed event. - If fix(account-pool): reject duplicate OAuth account imports #5709 lands, its duplicate error could point to this command.
- Add
- Options on every add path.
- Accept
--labeland--prioritytogether with--login, and carry them in the login session tologin-complete/login-poll. - Add
--disabledto--login,--importand--api-key. An account added with--disabledmust not run the enable hook and must not become routable. - Offer the same choices in the settings dialog.
- Accept
- Login expiry.
- Store the expiry, for example as
loginExpiresAt: fromrefresh_token_expires_inon sign-in and refresh, and fromrefreshTokenExpiresAton import. - Show it in
account list(as a column and in JSON), instatusand on the settings row. - Warn ahead of time for enabled and disabled accounts. Claude Code warns 3 days ahead.
- Where a provider does not report an expiry (Codex may not), show "unknown" together with the last successful refresh time.
- Store the expiry, for example as
- Disabled accounts.
bb pool account refresh <id>on a disabled OAuth account should do one of two things, and never printRefreshed usage:- check the account for real (token refresh plus usage) without making it routable; or
- exit with a clear message such as "account is disabled; nothing was refreshed".
- Optionally, add an opt-in periodic check for disabled accounts whose grant the pool owns (added with
--login). Leave imported grants out, because an extra refresh races with the other holder (Disabling Account Pooler breaks Claude: running turns 503-retry for ~3 min, new threads fail with an expired local OAuth login #4352).
Context and alternatives
- Workaround today: add a new login, then run
priority,disableandremove <old>straight away, and track login dates outside bb. The cost is new ids, lost pins, a short window in which a reserve is routable, and no early warning. - Alternative: with the
lastResortflag proposed in Account Pooler: last-resort accounts, per-account switch thresholds, and an opt-in order by earliest weekly reset #4468, a reserve could stay enabled (and so keep being refreshed) without taking traffic. That would make item 4 less important for this case, but would not replace items 1–3. - Investigation: bb thread
thr_agudxusj98; the reports are in that thread's storage underpool-research/. This issue covers only the account-lifecycle part. The other findings are filed separately:- how the pool handles a rejected proactive refresh (Account Pooler: a rejected proactive OAuth refresh errors an account whose access token is still valid; background refresh keeps replaying the rejected token #6167);
- when Provider Retry wakes up (Provider Retry: re-evaluate pending and declined pool-routed retries when Account Pooler availability changes #6172);
- routed threads touching the host login (Account Pooler: pool-routed Claude Code and Codex threads, and CLIs they start, should authenticate only with the hub token and leave the host's own logins untouched #6171);
- the shared
--importgrant (evidence added to Disabling Account Pooler breaks Claude: running turns 503-retry for ~3 min, new threads fail with an expired local OAuth login #4352).
- Not duplicates:
- Disabling Account Pooler breaks Claude: running turns 503-retry for ~3 min, new threads fail with an expired local OAuth login #4352 is about disabling the whole plugin and about the shared
--importgrant, not about re-authenticating a pool account. - Claude Code OAuth expiry: classify authorization failures and recover sign-in inside BB #3337 is about recovering the host's own Claude Code login, not pool accounts.
- Account Pooler: show and spend Claude and Codex usage-limit resets per account #4157 and Provider usage: show and spend Codex and Claude usage-limit resets #6153 are about usage-limit resets, not login expiry.
- Account Pooler: last-resort accounts, per-account switch thresholds, and an opt-in order by earliest weekly reset #4468 is about routing order and last-resort accounts (related alternative above).
- Show pooled Claude and Codex account usage in Settings → Usage #3243 is about showing pooled usage in Settings.
- Codex AI service reports ready with expired credentials #5689 and Use Account Pooler credentials for Codex AI helpers #5690 are about credentials for the Codex AI helpers.
- PR fix(account-pool): reject duplicate OAuth account imports #5709 rejects duplicate adds and has no in-place credential replacement.
- Account Pooler blocks Claude extra usage when subscription quota reaches the switch threshold #4475, provider-retry never retries Account Pooler 429/502 failures #4839, Fix provider retries for exhausted account pools #5283, Retry turns that fail on provider server and connection errors #5931, Account Pooler quota exhaustion leaves Codex reconnecting inside active turns and blocks the shared concurrency queue #6116 and A script automation cannot report UNKNOWN, so honest blindness auto-pauses it #2692 are about thresholds, retries, exhaustion and automations.
- Disabling Account Pooler breaks Claude: running turns 503-retry for ~3 min, new threads fail with an expired local OAuth login #4352 is about disabling the whole plugin and about the shared
- Suggested priority/effort: Medium priority, Low–Medium effort.
- It affects anyone who keeps a reserve or moves off
--import. - A workaround exists and no work is lost.
- A dead reserve is only discovered during an outage.
- It affects anyone who keeps a reserve or moves off
Checks
- I searched open and closed issues for the same request.
- If an agent wrote this, the body ends with
> AGENT GENERATED.
AGENT GENERATED
Activity
bb-slop-cop commentedon Oct 23, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotApplied and verified the missing classification:
providersThe primary request adds account-lifecycle capabilities across authentication, persisted expiry data, CLI/RPC contracts, and settings. Workarounds exist, but implementing the full scope requires more than a contained change. No existing classification values needed preservation; no conflicts occurred.
No reproduction report or pull request: the final Type is Feature, so the bug-only steps are skipped.
seklow commentedon Oct 23, 2026
One more consequence of disabled accounts never being refreshed, this time in the Provider usage panel (plugin settings and the sidebar card).
Observed vs. cause
hub.refreshUsage(id, refresh)(#L71). That method only collects enabled OAuth accounts (hub.ts#L289-L295). For a disabled account nothing is collected, and the last cached observation comes back asstatus: "ok"(usage-source.ts#L156-L173). Neither the payload nor the panel marks it as disabled or shows how old the numbers are, and a resource can't be hidden.Expected (any one of these would fix the misleading display)
disabledflag or a "not refreshed since " state, and show that in the panel.--importdiscussion in Disabling Account Pooler breaks Claude: running turns 503-retry for ~3 min, new threads fail with an expired local OAuth login #4352). With a shared refresh token, a refresh can consume a token that another holder still uses.Make the Account Pooler hold its own logins (#6691)