Repository navigation
fix(orcad): orca serve owns its Claude and Codex accounts again - #29209
Conversation
orcad never wired account services, so every accounts.* RPC failed once orca serve moved onto orcad. Build the same account services the desktop builds (now in provider-account-services.ts), made Electron-free, and install them in orcad except on a WSL host, whose desktop owns its accounts.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 25 minutes. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬆️ High Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to
|
…G_CONFIG_HOME is set
…host's managed accounts Create orcad's account services before the runtime so its structured Codex launch/read resolvers and catalog-probe prep are constructor deps, as on the desktop. A client-sent account home still wins, and a WSL host keeps them unset so the desktop-pushed CODEX_HOME applies. AI Vault session discovery now includes this host's managed Codex homes.
…sion was recorded in Share the desktop's resume launch prep as a factory and wire it into orcad's PTY registration and AI Vault resume, so a pane restored after an account switch resumes from its origin home. A client-sent account home keeps resuming from itself.
…ODEX_HOME orca serve (#29209) skips resume prep for a launch whose env names a client-sent CODEX_HOME.
* test(pty): pin where the two spawn lanes build a daemon spawn's host env differently Characterization on main's code before the host-env step merges: which failed env builds sweep per-PTY state (minted ids only, both lanes), the empty-id split, the host-only WSL Pi/OMP guest readiness wait, and that a host create operation still waits on a managed Codex login. * refactor(pty): one host-env step for both terminal spawn lanes The window (pty:spawn) and host (runtime controller) lanes each carried a copy of Codex resume, Codex home selection, the managed-auth wait, backfill recovery and the daemon host-env build. Both now call resolvePtySpawnHostEnv. Lane differences are explicit inputs: two TEMPORARY ones (the host-only WSL Pi/OMP guest readiness wait; the host skipping host env for an empty id) and three that mean the same in both lanes. The resume step's launchEnv was never read and is gone. * test(pty): pin that both lanes hand Codex resume prep the request's CODEX_HOME orca serve (#29209) skips resume prep for a launch whose env names a client-sent CODEX_HOME. * test(pty): type the new lane-pin requests instead of asserting them * test: pin selected Codex home on terminal restart
#29845) Since #29209 a full orcad on Windows runs wsl.exe in its profile directory. On windows-11-arm the WSL service keeps that empty directory busy for ~60s after every process in the test's tree has exited, past removeTestRoot's ~45s retry budget, so the recipe and D7 cases fail cleanup with EBUSY.
#29853) * fix(wsl): run wsl.exe probes from the system root, never the profile WSL holds wsl.exe's working directory busy for about its idle timeout after the probe exits. Since #29209 the orcad startup probe ran in the profile, so a temporary orca serve profile could not be deleted for about a minute (diagnosed in #29845). * test(orcad): drop the WSL profile-hold wait from serve parity Reverts #29845's extended EBUSY retry: wsl.exe no longer runs in the profile, so nothing outside the test's process tree holds it. * build(cli): list the WSL spawn-directory module in the CLI typecheck project
ELI5
On a headless machine running
orca serve, every account command (orca account list, switching Claude or Codex accounts, usage) failed with "Account services are not configured on this runtime". The server never set up its account manager. Now it does, the same way the desktop app does.What Changed
orca serveon Linux runs on the headless Node server (orcad) instead of a windowless desktop app. That server never created the Claude/Codex account services, so everyaccounts.*call failed. This affected the CLI, phones, and paired desktops. Managed SSH hosts also run orcad and failed the same way. The only workaround wasORCA_SERVE_RUNTIME=electron.accounts.list, select, remove, add, and Claude sign-in work againstorca serve. Terminals and agents that the server launches use the account selected on that host, as the desktop serve did before 1.4.225.accounts.setHostLaunchEnv, and a host that has its own services refuses that push.src/main/provider-account-services.ts. The desktop and orcad both call it. Desktop-only extras stay in the desktop file: the Codex session migration scheduler, the model-catalog refresh, keybindings, and the legacy OpenCode key migration.codex-runtime-home-launch-preparation.ts) that both hosts share.electron.app.SecretStoreport instead ofsafeStorage. On the desktop that port is the same guarded keychain.partitionSessionon the main HTTP client. Only the desktop provides it.ORCA_USER_DATA_PATHto its own profile, as the desktop already does. Otherwise an inherited value could point the Codex home paths at another profile.Why
Reusing the desktop's construction means one implementation of account behaviour. A separate orcad version would drift. Only one piece genuinely needs the desktop app: MiniMax and OpenCode Go usage read from a pasted browser session cookie, which needs a Chromium cookie jar. On orcad that usage now reports "…usage from a session cookie needs the Orca desktop app and is not available on this server" in its usage entry, instead of crashing. The MiniMax API-key path still works. No
accounts.*RPC is desktop-only.Root cause of the version boundary: #27404 (68dc48a) unpacked the orcad serve-selection entry from
app.asar. Before it, packagedorca servecould not run the selector and fell back to the desktop app. After it, the Linux .deb selected orcad, which had never wired account services (the gap dates from #24863).Linked Issue
Fixes #28962
Visual Proof
N/A: server-side only, no UI change. The before and after are the CLI output in the issue.
Testing
Built orcad (
pnpm build:orcad). It reports zero electron imports. I ran it in the background with an isolatedHOMEandORCA_USER_DATA, ranorca account listwith the built CLI, and gotok: truewith the Claude/Codex/usage snapshot. Then I stopped the server and removed the temp directories. On main the same command fails as described in the issue.New
src/main/orcad/orcad-account-services.test.tsuses a real Store and runtime.accounts.list,accounts.selectClaude, andaccounts.selectCodexsucceed. A WSL host gets no services and still accepts the desktop's account push.New case in
opencode-go-usage-fetcher.test.ts: with no Chromium session, cookie usage returns the clear error.Existing tests that mocked
electron.apporsafeStoragenow install the host ports instead. The desktop path itself is unchanged.pnpm tc:node,pnpm tc:cli,pnpm run check:code-quality:changed, and the runtime electron ratchet pass. The orcad, codex-accounts, rate-limits, minimax, zcode, opencode, startup, and host suites pass locally, except load-timing flakes that pass when rerun alone.Platforms: macOS locally; Linux and Windows through CI.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
An adversarial review (Opus) covered credential safety, wire and version compatibility, desktop parity, and orcad startup and shutdown. It found no P0/P1 issues. Two lower-priority notes remain:
CODEX_HOMEexported in an SSH host's environment now yields the Orca-managed home for host-started launches, which is the same as the desktop's behaviour.wsl.exedistro query at startup, with errors caught.Agent skill upstream boundary
Notes
SecretStoreport there is the same guarded keychain. orcad cannot use an OS keychain (existing documented posture). Its account stores only read the provider key files here: a sealed key reads as "could not decrypt", never as plaintext. The one desktop write path that could store plaintext, the legacy OpenCode key migration, stays desktop-only.accounts.*against a new server now succeed. New desktops talking to older servers see the same error as before. The WSL push path is untouched.