Repository navigation
feat(claude-accounts): account pool picks the account with the most headroom for each new launch - #37572
Closed
nachumi-a2zoperations wants to merge 22 commits into
Closed
feat(claude-accounts): account pool picks the account with the most headroom for each new launch#37572nachumi-a2zoperations wants to merge 22 commits into
nachumi-a2zoperations wants to merge 22 commits into
Conversation
nachumi-a2zoperations
force-pushed
the
pr/claude-account-pool
branch
4 times, most recently
from
November 6, 2026 12:47
d7df158 to
2cc838e
Compare
The registry names the account a pane consumes. Automatic switching stays off until it is turned on, and a headless host keeps usage polled while it is on.
The polling switch takes the settings it actually reads. Tests stamp a fixed expiry and a stepping file mtime so the flaky-clock ratchet stays at its baseline.
The command is already in the account spec and the site reference. The root help is the list a user sees first.
The account commands read --on and --off as bare switches, but registering them as global boolean flags broke `orchestration worker-start --on <server>`, whose --on takes a value. The argument parser already treats a flag followed by another flag or by nothing as a switch, so the account commands keep working without the global entry.
The data-account snapshot helpers move beside the controller.
… the bar, and state the real switch lines.
The proxy stays off unless claudeAuthProxy is true. Each launch gets a loopback slot URL in ANTHROPIC_BASE_URL unless the user set one; the pane registry records the slot and the account it bills. The session mover's proxy move strategy is not part of this change.
A launch and a quota poll each kept a slot the pane never used, so a headless status listed leftovers while account list showed sessions: 0. Forget, status, and the spawn merge now drop those slots, and a reattach into an empty registry records the live account without storing a slot the process did not receive.
… policy RPCs within the line limit. The pane registry learns a launch at spawn commit, so the proxy slot and billed account of every live pane are known. The Claude policy RPC handlers and the data-account snapshots move beside the account controller, and the account CLI group gets its own module, so no file exceeds the lint budget. The two proxy tests that time a real idle timeout and a real stop() say so; the slot prune test runs on a fixed clock.
The 200 ms idle timer and the socket reset can land late when the full suite runs; the test still proves the idle cut happened after the budget.
…a loaded machine. The ticks come every 40 ms; a 2 s idle budget still proves a writing stream is kept while a loaded suite cannot cut it by delaying one tick past 200 ms.
The default is ask, and a headless host treats ask as move. A quiet wait lets background work finish, and the hand-off note still lists jobs when the job script is absent. With the auth proxy on, a move retargets the pane's loopback slot instead of restarting Claude.
The hand-off calls the durable-job listing through Reflect.apply, and the stop handle starts unset through a helper. Both stay typed without a cast.
orcad and the CLI import the language detector, so the desktop entry binds the Electron read. Root help now lists auto-switch and session-mover, the account commands this branch ships.
anti-slop rejects Reflect.apply. The hand-off note checks the script export and calls it.
The session-mover command reads them as bare switches; the parser already treats a flag followed by another flag or by nothing as a switch, so no global boolean entry is needed.
Off unless claudeAccountPool is 'on'. An Orca-made Claude launch then starts on the signed-in account with the most room left, the pane registry records the pool pick, and the rebalancer moves a session whose account runs out ahead of the others. `orca account pool --on|--off`, `orca account moves`, the Settings row, the status-bar Pool badge with per-account session counts, and the tab chip come with it.
nachumi-a2zoperations
force-pushed
the
pr/claude-account-pool
branch
from
November 6, 2026 14:23
2cc838e to
efe10de
Compare
10 of 11 tasks
Author
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.
ELI5
With the pool on, each new Claude session Orca starts goes to the signed-in account with the most room, instead of always to the selected one. The selected account stays the status-bar account and the fallback. Off by default.
What Changed
claudeAccountPool: 'off' | 'on'(default off).chooseClaudePoolAccountranks signed-in accounts with a fresh reading, no failure hold, not hand-pinned; headroom = min over the 5-hour and weekly windows; candidates need ≥ 10 points; most headroom wins, tie → fewest assigned sessions → account order. Nobody ranks → selected account, marked fallback.resolveRuntimeClaudeAuth, so new pane, worker terminal and mobile restore all get it; explicit--accountand a remembered resume account win over the pool. A pooled launch setsCLAUDE_CONFIG_DIRto the chosen folder and recordssource: 'pool'.orca account pool --agent claude --on|--off;account listprintspool: on|off; pooled panes carry an account badge in the switcher.Why
#37257. A coordinator dispatching ten workers in a minute put all ten on one account while others sat at 5%. Pairs with the auto-switch (which moves the pointer) and with #33193 (priority order fits as a tie-break).
Linked Issue
#37257, #8770, #7782, #33193. Stacked on the mover PR.
Visual Proof
account listshowing sessions spread across accounts withsource: pool.Testing
Pool policy: headroom across windows, reset window = empty, tie-breaks, stale skip, all-stale fallback, pinned exclusion, 10-point floor, signed-out/held, null when nothing selected; launch:
CLAUDE_CONFIG_DIRfollows the choice, explicit/remembered win. Fullcheck-changedon the gated sha 29/30 (unit = Mac-local). Manual: coordinator plus workers across seven accounts.