Repository navigation
Conversation
`bb pool account add --import` copied the host's Claude Code or Codex login, refresh token included. Refresh tokens are single use and rotate, so the pool and the host shared one chain and whichever refreshed first signed the other out (#6167, #4352). Routed Claude Code threads also kept refreshing the host's Claude login themselves (#6171). - Remove --import, the import RPC source, the settings item and the host credential readers for both providers. Sign-in works headless for both, so import had no unique use; --login now takes --label and --priority. - Re-login in place: login.start / codexLogin.start take a target ({ kind: "add" } or { kind: "relogin", accountId }), `bb pool account login <id>` and "Sign in again" in settings. The account keeps its id, priority, enabled state, pins and quota; the error clears; a login for a different account is refused and the stored login kept. - Routed Claude Code gets CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST=1 (and isolate mode neutralises it), so it neither reads nor refreshes the machine's Claude login. Codex app-server auth is unchanged. - Update the account-pool skill, PLUGIN_OVERVIEW and CLI help. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
deleted the
bb/account-pooler-owns-its-logins-6167-6170-6171-43-thr_6d6qv4j363
branch
October 30, 2026 21:28
hellno
added a commit
to hellno/bb
that referenced
this pull request
Nov 1, 2026
get-bb#6691 added `bb pool account login <id>`, which replaces a login and clears the account error. Drop the secret-file reread and automatic recovery that this fix added for the same case, and clear the stored rejected-token fingerprint when an account signs in again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
pushed a commit
that referenced
this pull request
Nov 2, 2026
…#6661) ## Human comments ## What was wrong The pool refreshes an OAuth token in the last 5 minutes before it expires. When the token endpoint rejected that refresh with HTTP 400 or 401, the pool marked the account as failed right away, even though its access token still worked. The background usage check did the opposite: it never marked the account as failed and resent the rejected refresh token every 5 minutes. The UI also wasn't notified when the status changed. #6691 removed the shared logins that usually caused the rejection, but a revoked login, or an account added with the old `--import`, still runs into this. Report: https://get-bb.github.io/reports/issues/6167.html ## What changed - After a rejected refresh, the pool keeps using the access token until it expires or the provider rejects it, and only then marks the account as failed. Requests and the background check follow the same rule. - The pool stores a SHA-256 hash of the rejected refresh token in plugin KV and never sends that token again, even after a restart. No database migration. - Signing in again (`bb pool account login <id>`) also clears the stored hash. - Marking an account as failed, or clearing it, now publishes `ACCOUNT_POOL_ACCOUNTS_CHANGED`. - Updated `accounts-and-routing.md`. No wire, CLI, RPC or settings changes. Decisions worth a look: - The issue also asked the pool to reread the secret file and recover when a new login shows up there (points 3 and 5). Since #6691, `bb pool account login <id>` does that and clears the error, so this PR leaves it out. - `bb pool account refresh` still retries the rejected token on purpose. `enable` clears the failure but keeps the stored hash. ## How you verified - New `src/refresh-rejection.test.ts` runs the real hub, both adapters and real SQLite for Claude and Codex. 11 of its 13 tests fail on `916d684` and pass here; the other 2 check temporary refresh failures and pass on both. - Not tested against the real Anthropic and OpenAI APIs. If they stop accepting an access token once another program refreshes the same login, the pool marks the account as failed on the first 401 and sends the same request to the next account. A test covers this. - The existing invalid_grant test in `server.test.ts` now expects 200 and no resent token. It fails on base for both providers and passes here. - Typecheck and lint pass; the full Account Pooler suite passes (378 tests). Fixes #6167 🤖 Generated with [Claude Code](https://claude.com/claude-code) > AGENT GENERATED --------- Co-authored-by: hellno <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
This was referenced Nov 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
Anthropic and OpenAI refresh tokens are single use and rotate, so two programs holding one login sign each other out at the next refresh. bb created that situation twice.
bb pool account add --importcopied the machine's Claude Code or Codex login, refresh token included, into the pool (and the docs recommended it). Pool-routed Claude Code threads also kept refreshing the machine's own Claude login even though they never use it. The result was pool accounts failing withinvalid_grant(#6167), the machine's login dying after the pool was turned off (#4352), and routed threads touching host logins (#6171). There was also no way to fix an account's login in place (#6170).What changed
--import, theaccount.addimport source, the "Import from this machine" settings item, and the host credential readers (~/.claude, the Keychain,~/.codex/auth.json). Sign-in already works without a browser on the server (paste a code for Claude, a device code for Codex), so import could do nothing sign-in can't. A warned hand-over wouldn't be real, since bb can't sign the host's Claude Code or Codex out.--loginnow accepts--labeland--priority, which used to work only with import.bb pool account login <id>, "Sign in again" in the account menu and dialog, and the RPC.login.start/codexLogin.startnow take{ kind: "add", label, priority }or{ kind: "relogin", accountId }. Only the account's secret is replaced:hub.replaceSecret).CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST=1to routed Claude Code; nested isolate mode sets it to empty. Checked on Claude Code 2.1.312:ANTHROPIC_AUTH_TOKENfrom tool subprocesses, so a nestedclaudeneedsANTHROPIC_AUTH_TOKEN="$BB_ACCOUNT_POOL_PARENT_TOKEN"(documented).bb pool bypass.account.addis now Claude API keys only ({ provider: "claude", apiKey, label, priority }). Thelogin.start/codexLogin.startinputs changed as above. No server/daemon wire change (HOST_DAEMON_PROTOCOL_VERSIONunchanged), no storage migration, no plugin SDK change.cli_auth_credentials_store="ephemeral"), but it costs routed threads their ChatGPT apps, and no Codex failure has been observed.server.test.ts.How you verified
src/account-login.test.tsruns the real hub against a fake OAuth server whose refresh tokens are single use and rotate. It covers:I mutation-checked these: removing the identity check or the error clear makes them fail.
server.test.tscases used import only to set up OAuth accounts; they now seed existing accounts through the realAccountStore. Two UI tests cover the re-login target and the in-dialog error.pnpm exec turbo run test lint typecheck --filter=bb-plugin-account-pool --filter=bb-plugin-provider-codex: 365 and 550 tests pass.turn-failed-retry.test.tspasses, and so doesgenerate:bb-official-marketplace.pnpm start:worktree, side by side with main, using the source CLI and a headless browser:--importis rejected;--login --label --priorityworks;account login <id>works for Claude, Codex and disabled accounts, and is refused for API-key accounts and unknown ids;{ kind: "relogin", accountId };provider.env-resolvedshowsCLAUDE_CODE_PROVIDER_MANAGED_BY_HOST=1from account-pool.Refs #4352, #6167, #6170, #6171
🤖 Generated with Claude Code