Repository navigation
[Feature]: Account switch must not require restarting running sessions — restart is unusable when orchestrating dozens of concurrent Claude panes #34422
Description
Problem or use case
I run multi-agent workflows in Orca: one coordinator plus dozens of Claude Code worker panes running in parallel, each in its own worktree, often for hours. I keep several Claude Max accounts. When the active account hits its 5-hour or weekly limit, I switch accounts in Orca.
Up to v1.4.224, switching accounts just worked: every running session kept going on the new account at its next request. Nothing restarted, and no conversation, in-flight turn or worker state was lost. It is the main reason I use Orca.
Since v1.4.225, with the per-account claude-profiles/<id>/home routing (still the case on v1.4.242, macOS 27.0.1), each claude process gets its CLAUDE_CONFIG_DIR when it starts. A running session can no longer move to another account. The only option left is the "When you switch accounts while Claude is running" setting (claudeAccountSwitchRunningSessions: Ask / Always restart / Never restart), and restarting does not work at this scale:
- Every switch restarts dozens of sessions at once. Every in-flight turn (tool calls, builds, test runs, git operations) is cut off, and the coordinator has to reconcile every worker afterwards.
- Restart is not reliable with more than 8 panes. [Bug]: Account switch with >8 running Claude panes: daemon live_cap defers the rest — some panes are killed and never relaunched, others stay on the old account #34285 shows that with more than 8 running Claude panes, the daemon
live_capdefers the rest. Some panes are killed and never come back; others stay on the old account. With dozens of panes, "Always restart" would destroy most of the run. - "Never restart" / "Keep as is" leaves the whole run on the account that is already at its limit. All sessions stay stopped until they are restarted by hand.
So the new model forces me to choose between a mass restart that loses work and a stalled run. If this is how it stays, I can no longer use Orca for this workflow.
Proposed solution
Bring back the pre-v1.4.225 behaviour as an opt-in setting, as proposed in #29999: a "shared login" mode where switching accounts updates the shared credential that running sessions read. Running Claude Code sessions then switch at their next request, with no restart.
Per-account profile isolation can stay the default for people who want sessions pinned to an account. People who orchestrate many long-running agents need running sessions to move without a restart.
Alternatives or additional context
- Related: [Feature]: Opt-in "shared login" mode so an account switch applies to running Claude Code and Codex sessions (the pre-v1.4.225 behaviour) #29999 (opt-in shared login mode, same request), [Bug]: Regression: switching Claude accounts no longer updates existing Claude Code sessions #29870 (regression report), [Bug]: Account switch with >8 running Claude panes: daemon live_cap defers the rest — some panes are killed and never relaunched, others stay on the old account #34285 (restart breaks with more than 8 panes), [Bug]: Claude account switch relaunches sessions in the wrong folder, drops the effort level and leaves duplicate sessions (regression from 1.4.224) #31545 (restart relaunches in the wrong folder and drops the effort level).
- What I checked on 1.4.242: the
claudeshell function re-readsORCA_CLAUDE_PROFILE_POINTERonly at launch and exportsCLAUDE_CONFIG_DIRfor the profile, so a running process can't move. I found no setting indefault-global-settingsto go back to the shared credential model. - Other workarounds I considered (an API gateway, downgrading and pinning Orca at 1.4.224) either drop native Claude Code features or lose all later fixes.
Activity
nachumi-a2zoperations commentedon Nov 2, 2026
We run the workflow described here (one coordinator, many long-lived worker panes, several subscription accounts) and have had restart-free moves working in a local build since 2026-10-29. Posting the design because it is small, keeps #26801's per-account folders intact, and we would like to contribute it.
Why a running session cannot move today
A Claude Code process reads its login once, from its own
CLAUDE_CONFIG_DIR. After #26801 every managed account has its own folder, so the process is pinned to one account for life. Orca can only change the account by stopping the process and starting another one. That is what "Restart session" does, and it is what breaks the orchestration case: dozens of panes mid-turn, each with a conversation, background monitors, and a coordinator waiting on them.The idea: separate "which folder the process runs in" from "which account pays for the next request"
Claude Code honours
ANTHROPIC_BASE_URL. Orca already owns the launch environment. So Orca starts one loopback HTTP listener per execution host and gives each Claude session a slot URL:The proxy forwards every request to
https://api.anthropic.comunchanged (method, path, query, body, streamed response including SSE) except for one header:Authorizationis replaced withBearer <token>for the account currently assigned to that slot. The token is re-read from that account's credential store on every request, so the proxy never caches or refreshes a token itself.A move is one in-memory write: slot 7 now maps to account B. The process keeps running. Its next request is billed to B. Nothing is restarted, no conversation is lost, no worker notices.
What stays on the original account, on purpose
claude --resumefrom a shell/statusemail,.claude.jsonorca account listattributionWe chose to accept this instead of relaunching under another folder, because that relaunch is exactly the restart everyone here is trying to avoid. The registry records both ids (
accountId= spawn,assignedAccountId= billed) so every surface that reports "which account is this pane on" shows the billed one.How it plugs into what exists
launchEnv/prepareLaunchForadd the slot URL when the proxy is listening and the setting is on. A user-setANTHROPIC_BASE_URLis never overridden (logged once). Off = today's behaviour exactly.assignedAccountIdandproxySlot. Usage attribution, the auto-switch "running sessions" scan, andaccount listread the assigned id when it differs from the spawn id. Live statusline posts carry the pane key, so a moved pane's usage is billed to the right account and not dropped for a config-dir mismatch.movedwith the same pty id. No spawn, no hand-off note. Only a pane without a slot (started before the proxy, or with a user-set base URL) falls back to today's restart path. Mid-turn and background-work waits are skipped for a proxy move because there is no process to protect.--resumeof that session id, with no explicit account, launches on the remembered billed account.orca servehosts too ([Feature] Switch running Claude sessions to the new account on a headless/remote host (account switch via RPC/CLI, usage-limit event) #31476). A move there is driven by the same rate-limit event or by the CLI.Surface
orca account auth-proxy --agent claude --on|--off;account listprintsauth-proxy: on|offand, after a move,pane <ptyId>: account <id>; JSON carriesauthProxyandpaneAssignments.Verified in use
servehost; the pid stayed, the response organisation and weekly fraction switched to the target on the next prompt;/statusstill showed the spawn email as described above.Limits we know
We would open this as two PRs on
main: (1) the proxy and slot registry, defaults off; (2) the mover's proxy strategy on top. Both small enough to read in one sitting. Does that shape work for you?