Repository navigation
Conversation
The pool treated any window at or above switchThreshold as exhausted and dropped the account, so it answered with its own 429 while the provider still allowed several accounts (#6169). accountAvailability() and the 429 repeated those filters, the overage claim never affected selection (#3615), and API-key accounts had no "never routes first" rule (#4468). One ranking function, routeRank(), now drives select(), the 429 text and Retry-After, provider-retry.v1.availability, and account status: below threshold, above it while the provider still allows the account (its reported status decides, so 1.0 "allowed" stays usable), then paid (extra usage or credits on a rejected account, per-family overage claims, API keys). The pool refuses only when every tier is empty. The current account follows the best tier; session pins stay on the first two tiers and move up only off paid accounts. Holds, errors, family detours, commit-on-success and the 30-second recheck are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… know The quota store reads `SELECT *` into a strict row schema, so a column added by a later migration made every quota read throw on an older build. Reverting this branch, or running an older build against the same plugin database, would therefore break the pool instead of just losing the newest fields. The row schema now ignores unknown columns. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The settings page listed accounts and statuses but never said how the pool chooses between them, and the threshold field did not say what happens past it. An info banner above the account list, styled like the thread storage explainer in Storage retention, summarizes the routing: one account at a time in list order, switching past the threshold, accounts past it still serving when none have room, paid usage last, and ongoing conversations staying on their account. It shows the configured threshold and appears once an account exists. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
added a commit
that referenced
this pull request
Nov 2, 2026
## Human comments
## What was wrong
After a server restart, the GitHub PR Status plugin restores each
environment's PR from its database and serves it right away. It also
starts a background re-check right away, often before the host daemon
has reconnected. That re-check returned `unavailable` ("machine isn't
available"), and `store.load` replaced the environment's known PR link
with that result. The sidebar row badge disappeared and stayed gone
until something re-read that row, such as opening the thread or
refocusing the page. Observed on prod: the server restarted at 13:04:14
and the daemon reconnected at 13:04:20. Afterwards the sidebar showed
only #6849 (the thread that was opened). Six other inbox threads with
open PRs (#6760, #6755, #6736, #6728, #6727, #6734) showed no badge,
although their links and snapshots were still in the plugin database.
## What changed
- `plugins/github-pr-status/store.ts`: when a re-check of a known PR URL
comes back `unavailable`, the environment's link is no longer replaced,
so the last snapshot keeps being served. The snapshot's `fetchedAt` is
still bumped, so the regular poll retries it. Discovery reads (no known
URL) behave as before.
- Behaviour change: `bb pull-request show` for an environment whose
machine is offline now prints the last PR bb saw, or `unavailable` when
it has none. Actions (`ready`/`draft`/`merge`) still refuse with the
machine message. The skill doc and README are updated.
## How you verified
- New store test, "keeps serving a restored PR when its machine is
unreachable after a restart": it restores a persisted PR, makes the
first re-check return `unavailable`, and checks that the PR is still
served, nothing is published, and the next successful check publishes
the update. It fails without the fix (`expected { outcome: 'unavailable'
} to deeply equal { outcome: 'available' }`) and passes with it.
- `pnpm exec turbo run test typecheck lint
--filter=bb-plugin-bb--github-pr-status`: 183/183 tests pass, typecheck
and lint clean.
> AGENT GENERATED
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 5.5 <[email protected]>
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
Account Pooler routing used yes/no filters in
select()(plugins/account-pool/src/hub.ts). Any window at or aboveswitchThreshold(default 0.98) counted as exhausted, and the account was dropped, so the pool answered with its own 429 while Anthropic still allowed several accounts. In #6169 that parked threads for nearly three hours, and the 429 quoted the reset of an account Anthropic had actually rejected.accountAvailability()andnoEligibleResponse()repeated similar filters to build the 429,Retry-Afterandprovider-retry.v1.availability, so the answers could disagree, the same drift as #3324. Therepresentative-claim: overageheader was stored but never used, so Fable was billed as overage on a Team account while a Max account included it (#3615). API-key accounts had no rule enforcing "Metered fallback, never routes first" (#4468).What changed
One ranking function,
routeRank()inquota.ts. It drives account selection, the 429 text andRetry-After,provider-retry.v1.availability, and account status in the CLI, RPC and Settings. Tiers:allowedstays usable; only a window without a status counts as spent at 100%.Within the paid tier, accounts below the threshold rank first. Errored, disabled and Codex-restricted accounts, and accounts the provider rejects with no paid fallback, are in no tier. The pool refuses only when every tier is empty, quoting the earliest time a rejected or held account becomes usable again.
Stickiness. The current account (the cursor) moves to the best tier with a free account, so the threshold still switches new conversations. Session pins stay on tier 1 or 2 accounts and move back up only off paid accounts, as Support Claude and Codex extra-usage fallback and availability #4531 does today.
Kept from earlier PRs: commit-on-success and the stale-completion guards (Keep Claude and Codex account pools on ordered fallbacks #3129), session pins, fork inheritance and the 65-minute TTL (fix(account-pool): preserve provider session affinity #3117, Keep pooled affinity through the extended cache interval #5265), family detours that don't move the pin or cursor (Account Pool: model-family-aware routing and guarded account_uuid rewrite #3053), holds that don't demote within a tier (fix(account-pool): synchronize short-hold session retries #3262), errored accounts staying out (Keep Account Pooler accounts usable when upstream rejects fresh tokens #4385), and the availability RPC shape and 429 message format (Fix provider retries for exhausted account pools #5283, Include known recovery time in account pool exhaustion errors #5226). The 30-second usage recheck (Recheck exhausted Account Pool usage before refusing a request #4215) now runs before refusing or before using a paid account.
Overage per family. A Claude response for a model family that carries
representative-claim: overagemarks that family as paid on that account until its weekly reset (24 hours when the reset is unknown). This adds a plugin-local quota column,family_overage_until_json, exposed asfamilyOverageUntilin JSON and an Overage column inbb pool account list. The first overage request still reaches that account, because that response is how the pool learns.Status. Account summaries gain
tier.exhaustednow means only that the provider rejects the account.Settings. The status label shows the tier, and the threshold description and quota hint are reworded.
Docs.
bb poolhelp, the skill reference,PLUGIN_OVERVIEW.md(3862 characters) anddocs/configuration.md, which no longer says the threshold stops traffic.Quota rows tolerate unknown columns. The row schema dropped
.strict(). Previously, a column added by a newer build made every quota read throw on an older build. This protects future rollbacks across quota-column additions; builds before this PR are still strict.No changes to: the Plugin SDK, the server/daemon protocol, or core.
Deviations from the original plan:
How you verified
src/server.test.ts("tiered routing"): all four fail withmain's routing code and pass with this change.ready, and statuses readabove-threshold/exhausted; at threshold 1, a window at 1.0 that is stillallowedstays usable.src/store.test.ts: fails with.strict(), passes without it.isQuotaExhaustedincodex-adapter.test.ts.pnpm exec turbo run typecheck lint test --force --filter=bb-plugin-account-pool --filter=bb-plugin-provider-retry: 370 and 33 tests pass. Lint shows the two existing React warnings.pnpm exec turbo run typecheck lint --filter='...[origin/main]': passes.pnpm exec turbo run test --filter=@bb/server -- test/threads/turn-failed-retry.test.ts test/services/plugin-catalog: 181 tests pass.generate:bb-official-marketplaceaccepts the overview.Fixes #6169
Fixes #3615
Part of #4468
🤖 Generated with Claude Code