Skip to content

fix(orcad): orca serve owns its Claude and Codex accounts again - #29209

Merged
nwparker merged 4 commits into
mainfrom
OrcaWin/orcad-account-services
Oct 16, 2026
Merged

nwparker merged 4 commits into
mainfrom
OrcaWin/orcad-account-services

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 37 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​321 $\color{#cf222e}{\Huge{\mathbf{−}}}$​48 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​273
Prod 20 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​633 $\color{#cf222e}{\Huge{\mathbf{−}}}$​381 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​252

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

  • Before: Starting with 1.4.225, orca serve on Linux runs on the headless Node server (orcad) instead of a windowless desktop app. That server never created the Claude/Codex account services, so every accounts.* call failed. This affected the CLI, phones, and paired desktops. Managed SSH hosts also run orcad and failed the same way. The only workaround was ORCA_SERVE_RUNTIME=electron.
  • After: orcad creates the same Claude account, Codex account, and usage services the desktop creates, and gives them to the runtime. accounts.list, select, remove, add, and Claude sign-in work against orca serve. Terminals and agents that the server launches use the account selected on that host, as the desktop serve did before 1.4.225.
  • Exception: a WSL host is skipped. Its Windows desktop owns that distro's accounts and pushes them with accounts.setHostLaunchEnv, and a host that has its own services refuses that push.
  • Mechanism:
    • The account and usage setup moved out of the desktop-only startup file into 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 launch preparation became a factory (codex-runtime-home-launch-preparation.ts) that both hosts share.
    • The services were made Electron-free, so orcad's bundle can include them:
      • Codex account paths read userData from the host app environment instead of electron.app.
      • The MiniMax, GLM Coding Plan, and API-key file stores use the existing SecretStore port instead of safeStorage. On the desktop that port is the same guarded keychain.
      • The MiniMax and OpenCode Go cookie jars come from a new optional partitionSession on the main HTTP client. Only the desktop provides it.
    • orcad now sets ORCA_USER_DATA_PATH to its own profile, as the desktop already does. Otherwise an inherited value could point the Codex home paths at another profile.
    • orcad now ships the two worker entries these services start: the Claude account setup worker and the off-thread CLI probe worker.

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, packaged orca serve could 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 isolated HOME and ORCA_USER_DATA, ran orca account list with the built CLI, and got ok: true with 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.ts uses a real Store and runtime. accounts.list, accounts.selectClaude, and accounts.selectCodex succeed. 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.app or safeStorage now 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:

  • A custom CODEX_HOME exported 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.
  • A Windows SSH host's orcad makes one background wsl.exe distro query at startup, with errors caught.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Security: no secret is stored differently on the desktop, because the SecretStore port 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.
  • Wire compatibility: no RPC, param, or capability changes. Older clients calling 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.
  • SSH: managed SSH hosts run orcad and now own their accounts, consistent with "a server owns its provider accounts" (Remote provider account UI silently reads and mutates local accounts #7973).
  • Desktop-only on orcad (follow-ups):
    • the Codex session history migration scheduler
    • Codex pane-account lifecycle hooks and session-resume preparation
    • MiniMax and OpenCode Go cookie usage
    • background usage polling: usage refreshes on demand, as the windowless desktop serve did

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.
@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 95bd33e7-cf77-481b-99c3-186bbea0af2d
📥 Commits

Reviewing files that changed from the base of the PR and between 0ba038a and fa70cbd.

📒 Files selected for processing: 7
  • src/main/codex/codex-session-resume-launch-preparation.ts
  • src/main/orcad/orcad-account-services.test.ts
  • src/main/orcad/orcad-account-services.ts
  • src/main/orcad/orcad-codex-account-homes.ts
  • src/main/orcad/orcad-entry.ts
  • src/main/orcad/orcad-push-startup.test.ts
  • src/main/startup/codex-session-resume-launch.ts

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9f5fa7fd-09ff-40d6-a18b-43aaa8575408
📥 Commits

Reviewing files that changed from the base of the PR and between b9456de and 0ba038a.

📒 Files selected for processing: 1
  • src/main/orcad/orcad-account-services.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

📝 Walkthrough

The change adds account-service installation and launch preparation to Orcad startup, and centralizes provider account-service construction. It routes managed runtime paths through the shared app environment, and moves credential and cookie encryption to the shared secret-store interface. MiniMax and OpenCode Go rate-limit requests now obtain partition sessions through the main HTTP client. The Orcad build and artifact lists include two worker entries.

Priority: ⬆️ High

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 0ba03

No merge-blocking behavior is identified; the reported account-service and build checks support merging after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 13.04% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 50 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: restoring Claude and Codex account ownership for orca serve.
Description check Passed The description is complete and aligned with the template. It explains the user impact, mechanism, rationale, linked issue, testing, platform coverage, compatibility, and known limitations. The omitte…
Linked Issues check Passed Issue [#28962] requires account commands and accounts.* RPCs to work on a headless Linux orca serve runtime. installOrcadAccountServices installs provider services for non-WSL orcad hosts and co…
Out of Scope Changes check Passed The changes remain connected to [#28962]. Shared provider-service construction, Electron-free host ports, Codex launch preparation, the orcad user-data path, worker bundle entries, and test isolation …
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…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.
@nwparker
nwparker merged commit 16eaceb into main Oct 16, 2026
88 checks passed
brennanb2025 added a commit that referenced this pull request Oct 16, 2026
…ODEX_HOME

orca serve (#29209) skips resume prep for a launch whose env names a client-sent CODEX_HOME.
brennanb2025 added a commit that referenced this pull request Oct 16, 2026
* 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
nwparker added a commit that referenced this pull request Oct 16, 2026
#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.
nwparker added a commit that referenced this pull request Oct 17, 2026
#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: orca serve (orcad) runtime never gets account services — all accounts.* RPC fail on 1.4.225+

2 participants