Repository navigation
fix(accounts): launches a WSL host starts itself use the account selected for its distro - #28464
Conversation
|
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 6 minutes. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: 🔵 Low · up to
|
…ount The desktop now pushes the account env it selected for a WSL host's distro to that host's orcad (accounts.setHostLaunchEnv, capability-gated). orcad lays it over every terminal create (CLI, orchestration, automations, bare commands and presets), structured chats and AI commit text, as the desktop's own launches into the distro do. `orca account` on the host now points at the desktop that owns the accounts.
…spaces Review follow-ups: terminal splits and structured chats' child agents take the host account env too; an SSH workspace's terminals never get distro paths; orcad saves the pushed env so a launch before the desktop reconnects keeps the account; a failed push retries unless a newer one supersedes it.
8c1cca8 to
bb8e858
Compare
ELI5
When a WSL distro is added as a host (still behind an internal-only gate), the Orca server inside that distro has no account manager of its own. Agents it starts by itself (from the
orcaCLI, orchestration, automations, chats, and AI commit messages) ran on whatever login the distro happened to have, not the account the user picked in Orca. Now the desktop tells that server which account was picked for the distro, and the server uses it.What Changed
orca account listinside the host failed with "Account services are not configured on this runtime".claude/codexcommand is still recognised), over terminal splits, over structured chat launches and their child agents, and over AI commit text. What a caller passes explicitly still wins. SSH workspaces on that host are skipped (their shells run on another machine).orca accountnow says the accounts are managed in the desktop app for that WSL host.accounts.setHostLaunchEnvRPC (accounts-admin; refused for phones; refused by any host that has account services of its own, such as the desktop). The payload is the same narrow, validated account env (AgentLaunchAccountEnv: four variables, absolute guest paths) the desktop already sends per launch. The server saves it in its own data folder, so after a server restart a launch that runs before the desktop reconnects keeps the account. A failed push is retried with backoff unless a newer push supersedes it.Why
The alternative was porting the account services into the server (tracked as D5). That is a large change, and the desktop already prepares these exact homes for its own launches into the distro. Pushing the result once per change reuses that work and covers every launch path from one place. Sending env with each RPC (the existing shim) cannot reach launches that never pass through the desktop.
Wire compatibility: the push is gated on a new capability,
accounts.host-launch-env.v1. An older host gets no push, and the existing one-time "account not applied" notice fires when a managed account is selected. Older desktops never send it.Linked Issue
N/A (maintainer; WSL-via-orcad Track E, step E3, plus the
orca accountpart of E2)Visual Proof
N/A: no UI change. The behaviour is server-side launch env, covered by unit tests.
Testing
pnpm tc;pnpm run check:code-quality:changed;pnpm run verify:rpc-params-catalogNew tests:
host-account-launch-env.test.ts(precedence, SSH skip, structured env, commit-text env, CLI message, restore/save),wsl-orcad-host-account-push.test.ts(wire validity, older host, unknown host retry, ordering, supersession),orcad-host-account-launch-env-store.test.ts, a split case inorca-runtime-terminal-split-authority.test.ts, and an RPC case inaccounts.test.ts.Ran
src/main/runtime,src/main/wsl, and the RPC suites locally. One unrelated test,orca-runtime-agent-session-operation.test.ts > shapes the launch…, fails on a cleanmaincheckout on this Mac too.Real-host verification on Windows is pending; this code is dark behind the internal WSL host gate.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
An adversarial review (two rounds) found the split bypass, the missed child-agent env, the missing retry, the unknown-capability retry, and the SSH-workspace leak. All are fixed here. Remaining, documented in the tracker:
CODEX_HOMEcan still override the selected one. This predates this PR and also affects the existing desktop shim.Agent skill upstream boundary
Notes
Security: only an owner or paired runtime client can call it, and phones are refused. Values are restricted to four account variables with absolute paths and no
.., and the saved file is mode 0600. Cross-platform: the server side runs in Linux distros, and the desktop side runs only where WSL hosts exist. SSH: SSH workspaces are skipped explicitly, and SSH-managed servers never receive a push. Mobile: no change. Compatibility: the push is capability-gated and the field set is additive.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)