Repository navigation
feat(cli): select the Claude or Codex account from orca account select - #26870
pawel-kotowski wants to merge 2 commits into
Conversation
`orca account select` only handled OpenCode and Devin profiles, so the CLI could list Claude and Codex accounts but not switch them. It now accepts `--agent claude|codex` with an account id, email, or `system`, and calls the same runtime switch the status-bar switcher uses. `orca account list` prints account ids and the System default row so there is something to select. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (10)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe CLI now supports selecting Claude and Codex accounts by ID or email, or selecting the system account. Claude system-account selection is rejected for WSL targets, and Codex selection can target a configured WSL distro. Account output includes IDs and a system-default row. The command help, specification, and guide describe the expanded selection options and their effect on subsequently launched agents. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to No actionable merge-blocking issue is established. The change is mergeable after normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)✅ Passed checks (4 passed)Full details: Docstring CoverageExplanation Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 9 files. (1 skipped: 1 unsupported.)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
474ddc7 to
8d724d2
Compare
ELI5
The goal: run any of your Claude (or Codex) subscriptions on any workspace, on one machine or several, picked from the terminal.
This PR adds the missing terminal command for that:
orca account select. Before, only the account menu in the Orca app could switch accounts, so a script that creates workspaces could not choose which subscription they run on.How much of the goal this reaches depends on per-account Claude folders. They were reverted before release in #26638 and are being re-landed in #26801 (with the upgrade fixes from #26769). Until that merges, this PR covers different subscriptions on different machines, but not different subscriptions in parallel on one machine. See "What this gives today, and later" below.
What Changed
Before:
orca account listshowed Claude and Codex accounts by email only, andorca account selectaccepted only OpenCode or Devin.After:
orca account select --agent claude|codex --account <id|email|system>calls the runtime's existingaccounts.selectClaude/accounts.selectCodex. These are the same methods the status-bar switcher and mobile already use, so there is no runtime or wire change.accounts.listfirst, matching emails case-insensitively. If one email belongs to several accounts (one sign-in in two organizations), it refuses and prints their ids instead of guessing which subscription to bill.orca account listnow prints each Claude/Codex account's id and asystemrow, mirroring the OpenCode/Devin format.What this gives today, and later
mainorca servehosts)orca account selecton each host.So on current
mainthis PR does less than it could: it makes the account a script runs on choosable, one account per machine at a time. Its full value — any subscription on any workspace — arrives when #26801 merges. Nothing in this PR would need to change then; the sameselect→worktree createflow simply stops affecting workspaces that are already running.Why
The runtime has supported switching accounts over RPC for a long time; only the CLI was missing it. Coordinating agents and scripts already create workspaces with
orca worktree create --agent claude, and choosing the subscription is the one step that still needed a person in the app.Alternatives I considered and didn't take:
--accountflag onworktree create/terminal create. On currentmainit could only switch the whole machine and then launch. That would quietly move every other session too, and two launches at once would race. It makes sense as a small follow-up once Re-land Claude per-account folders (#24434, #26405) with the upgrade and proxy fixes #26801 lands.--environmentto switch another machine's account from this one. The account commands deliberately run only on the local host today (seerejectAccountRemoteSelectionFlags), and changing that is a separate decision.Linked Issue
Fixes #26875
Visual Proof
N/A — CLI-only change; output examples are above.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
New
provider-account-selection.test.ts:system→ null;--accountis refused;accounts.selectCodexForTarget;systemfrom WSL is refused, since the Claude RPC has no target and would reset the Windows host;accounts.selectData;All
src/clitests pass (142 files, 1685 tests).tc:cli,tc:node, andcheck:code-quality:changedare clean. The branch is merged with the latestmain.Real switches on macOS, against an Orca built from
mainjust before Revert Claude per-account folders (#24434, #26405) before release #26638 (so it still had per-account folders), with three saved Claude accounts:orca worktree create --agent claude: the new agent ran on account B (checked withclaude auth statusagainst its config folder);Not yet tested against a runtime built from current
main(no per-account folders). There, the same command drives the same switch the status-bar menu does.AI Disclosure
Written with Claude Code (Claude Opus 5.5), reviewed by me.
Review
Agent skill upstream boundary
Notes
accounts-adminRPCs; the CLI stays pinned to the local runtime and still rejects--environment/--pairing-code.systemfrom WSL is refused rather than silently resetting the host.account-list-format.ts,account.tsandaccount.test.ts. The conflicts are small: Re-land Claude per-account folders (#24434, #26405) with the upgrade and proxy fixes #26801 adds a "sign in again" note to each account line, and this PR adds the id. I've already combined the two in a local build (tests pass) and will rebase whichever lands second.account listhuman output gains an id column and asystemrow;--jsonoutput is unchanged.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred) — ran the CLI subsets above; CI covers the rest🤖 Generated with Claude Code