Add Account Pool plugin: multi-account Claude hub - #3036
Draft
SawyerHood wants to merge 3 commits into
Draft
Conversation
SawyerHood
force-pushed
the
bb/account-pool-hub
branch
from
September 4, 2026 02:39
1b606d8 to
43b39bc
Compare
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.
Stack layer 2 of 3. Prerequisite: the provider env contribution hook PR (layer 1) below it in this stack; this layer does not use the hook yet, layer 3 wires the plugin to it.
Human comments
What was wrong
BB had no server-side account pool for Claude traffic, so one Claude Code process could use only its local credential and could not rotate away from an exhausted subscription. BB-88 establishes the first stack layer: a manually configured Anthropic-compatible hub with durable account, secret, and quota state.
What changed
account-poolbuilt-in plugin with provider-keyed account metadata in plugin KV, per-account 0600 token files, a generated 0600 hub bearer key, and SQLite quota/hold/error state.HEAD /api/hello, with request-header rewriting, query forwarding, byte-streaming responses, quota tracking, threshold-aware selection, quota-429 rotation, per-minute pacing, OAuth refresh serialization/writeback, and graceful drain. The hub accepts requests before account setup, reports a 503 while no account is enabled, and uses newly added or enabled accounts without reload.bb pool account add|list|remove|enable|disableandbb pool status, mirrored through plugin RPC, plus built-in catalog registration and CLI guide, skill, and configuration documentation.bb.http.routeSDK supports exact paths only and this stack layer explicitly forbids an SDK change; unknown plugin paths retain BB's standard 404.How you verified
pnpm exec turbo run typecheck test --filter=bb-plugin-account-pool --continue— 9 tests passed; typecheck passed.pnpm exec turbo run typecheck test --filter=@bb/server --filter=@bb/plugin-api-map --filter=@bb/templates --continue— 13 tasks passed; server 227 files/2202 tests, template and plugin-map suites passed.pnpm exec oxlint plugins/account-pool/srcand targeted Prettier checks passed.HEAD /api/helloreturned 200; the hub streamed fake upstream SSE chunks every 20 seconds through the real mounted plugin route for at least 200 seconds;bb pool statusshowed the service accepting traffic and recorded 42% 5-hour / 64% 7-day quota utilization.https://api.anthropic.com, and ranANTHROPIC_BASE_URL=<dev hub> ANTHROPIC_AUTH_TOKEN=<hub key> claude -p "Reply with exactly: POOL OK". It exited 0 withPOOL OK; account quota changed from unknown to 18% five-hour and 32% seven-day utilization.Task: BB-88