Skip to content

Account Pooler: re-authenticate an existing account in place, add accounts disabled or with a priority, and show login expiry #6170

Description

@seklow

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:

  1. 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:
  2. 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. The login.start and codexLogin.start RPCs 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 / addCodexOAuth always create a new record:

    • it gets a new UUID, enabled: true and priority: 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).

  • The only way to re-authenticate is to add a new account and remove the old one: add --login, then login-complete or login-poll, then priority or reorder, then disable (for a reserve), then remove <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).
    • remove deletes 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 --priority defaults to 100 (cli.ts#L300-L309).
  • login-complete accepts only --session and --code; login-poll accepts 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:
  • 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_in from the token response on sign-in and on refresh and stores it as refreshTokenExpiresAt. 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 status and the settings page cannot say "login expires in N days". The first sign of an expired login is an invalid_grant on a live request, which puts the account into error (hub.ts#L537-L549).

4. Disabled accounts are never checked, and account refresh does nothing for them while reporting success.

  • hub.refreshUsage only handles accounts that are both enabled and OAuth: account.enabled && account.kind === "oauth" (hub.ts#L289-L305).
  • The CLI still prints Refreshed usage for <id>., because it only checks that the account's error is null (cli.ts#L628-L651). The docs describe refresh as "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 --json shows my reserve (priority 8) as status: "disabled", error: null.
    • It was added with --import during 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 refresh or enable on 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.

What you would expect

  1. Re-login in place.
    • Add bb pool account login <id>, a matching RPC (for example login.start({ accountId })), and Sign in again in the account menu.
    • It runs the same PKCE or device-code flow. login-complete / login-poll then 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 accountUuid or codexAccountId, with email as a fallback.
    • On success, clear the account's error and publish the accounts-changed event.
    • If fix(account-pool): reject duplicate OAuth account imports #5709 lands, its duplicate error could point to this command.
  2. Options on every add path.
    • Accept --label and --priority together with --login, and carry them in the login session to login-complete / login-poll.
    • Add --disabled to --login, --import and --api-key. An account added with --disabled must not run the enable hook and must not become routable.
    • Offer the same choices in the settings dialog.
  3. Login expiry.
    • Store the expiry, for example as loginExpiresAt: from refresh_token_expires_in on sign-in and refresh, and from refreshTokenExpiresAt on import.
    • Show it in account list (as a column and in JSON), in status and 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.
  4. Disabled accounts.

Context and alternatives

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

  1. added
    providers
    on Oct 23, 2026
  2. bb-slop-cop commented on Oct 23, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    Applied and verified the missing classification:

    • Type: Feature
    • Priority: Medium
    • Effort: High
    • Labels: providers

    The 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.

  3. seklow commented on Oct 23, 2026

    @seklow
    Author

    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

    • Account Pooler lists every pool account as a usage resource, disabled ones included (usage-source.ts#L49-L62). That matches the source's description, "independent of routing settings" (#L187).
    • Fetching a resource calls 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 as status: "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.
    • Example: the reserve account, disabled since 2026-10-22T12:35Z, still shows 5-hour 73% and weekly 57% from its last observation at 2026-10-22T12:34Z. At 2026-10-23T02:16Z, a terminal account switcher that holds its own login for the same account read 5-hour 0% and weekly 59%.

    Expected (any one of these would fix the misleading display)

    1. Mark disabled accounts in the usage payload, e.g. a disabled flag or a "not refreshed since " state, and show that in the panel.
    2. Collect usage for disabled accounts independently of routing. This is safe only once the account has a grant of its own (see the re-login request above and the --import discussion 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.
    3. Allow hiding individual resources in Provider usage.

    AGENT GENERATED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    providers

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions