You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(wsl-hosts): pin the host's Linux user, refuse a second account's server, and let Remove always drop an unreachable host - #49360
WSL hosts ran every wsl.exe call as the distro's default Linux user. A managed orcad keeps its install, data and E2EE host key (~/.orca/orca-e2ee-keypair.json) under that user's home.
So when the default user changed (root to qauser in the real-WSL repro), the next connect:
deployed and started a new orcad for qauser, on 127.0.0.1:6800 (managed orcads listen on 6800 or the next free port);
then refused that orcad as foreign-port, because its key isn't the pinned one. The refusal comes from verifyWslOrcadPairing → resolveWslOrcadPairing;
left the card on "Reconnecting" indefinitely, because liveness retried the refusal forever.
The host also couldn't be removed:
Remove: took about 26 s, then failed and kept the host.
orca environment rm: printed SSH-only advice.
orca environment stop and orca environment forget: said "not managed through an orcad SSH deployment".
Fix
1. Pin the Linux account (wsl -u). The deploy's single facts probe reports the account it runs as, and the host record stores it as linuxUser at Add. The pin is applied to:
Pins come from each read of the host records. Two operations override them for their own duration, through withWslHostLinuxUser, and a records re-read can't clear that override:
a removal under a distro's new name;
the migration's trial connect.
A pin never moves.
Why pinning instead of re-pairing or redeploying for the new user:
The pairing stays tied to one server. Re-pairing to whatever server answers would undo "a different host key is never trusted automatically".
Nothing is stopped behind the user's back. Redeploying would stop the old account's server and terminals.
2. Never deploy for the wrong account (the repro). For an unpinned host, the facts probe also reads the default account's public key from ~/.orca/orca-e2ee-keypair.json. If that key isn't the saved pairing's key, the connect is refused before anything is deployed, with the final error WslHostAccountChangedError. Its message is neutral, since a reset identity looks the same. Because the error is final, liveness publishes it as failed, so the card shows the error instead of "Reconnecting".
Liveness treats only sealed proofs as final:
WslHostAccountChangedError and unsupported distros;
unpaired (pairing rejected);
a key-rejection close (4001/4003), or a repair that read a different, readable key from the slot (both now marked sealed; an unparseable published offer is not);
replaced-server.
A catch-all foreign answer (a status.get error, or a port briefly answered by something else during a restart) keeps the old backoff and is not given "remove and add again" wording.
3. Migration for hosts saved before pinning.
On the user's Connect, one wsl -u root probe reads every account's ~/.orca/orca-e2ee-keypair.json.
It reads only regular files that aren't symlinks (and not through a symlinked ~/.orca), and only the first 4 KiB.
It prints the public half only.
It runs under a guest-side timeout 10 when available, plus a 15 s desktop abort, so an abandoned probe can't leave a root scan running.
If exactly one account holds the saved pairing's key, Orca connects as that account under a token-scoped override. It runs one trial per host: a second Connect joins it. The trial is bounded at 10 minutes.
The pin is saved, and written to the in-memory pins, only after that connect verified the server, so the holder and liveness stay on that account right away.
A failed or timed-out trial saves nothing and leaves no override.
If no account matches, or root is unavailable, the error is final: remove the WSL host and add it again.
Remove on an unpinned, changed host runs the same search and stops the server as the matched account.
When a pinned account differs from the distro's current default user, Settings shows "Runs as . To use , remove the host and add it again." Reading the current default user costs one unpinned id -un, only for pinned hosts, in parallel with the context probes.
4. No port refusal (simplified). A managed orcad listens on 6800, or moves up the fallback ladder when that port is taken. Every connect dials the port its own account's server published. So two accounts' servers coexist on different ports, and a connect never meets the other account's server. The earlier port-based refusal never fired, and it guarded no real conflict, so it is gone.
The real conflict in the repro was Orca starting the new account's server, which 2 now prevents. If another account's managed orcad does run in the distro, the probe logs it once per distro so it isn't silent.
5. Holder account.
The holder is spawned with -u <pinned user>, so it watches that account's ~/.orca release file.
A recorded holder whose command line runs as another account, such as a default-user holder from before migration, is stopped and replaced. This happens only once a records read has succeeded, so an unreadable host store never gets pinned holders replaced. Every holder ensure and recovery path reads the records first.
spawnDetachedHolder moved to wsl-distro-holder-command.ts, with its row in the blocking-helper baseline.
6. Remove and the CLI.
Remove: a first Remove that can't prove the stop keeps the host pending, as before (E11). Removing it again drops it only when the stop verdict is unverifiable. A live verdict and a removalUnrecorded record stay listed.
Renamed distro: removal stops the server as the record's account even after a records re-read.
orca environment forget: drops a WSL host without contacting its distro.
orca environment rm: on a WSL host, explains how to remove a WSL host.
orca environment stop, update, rollback, recover and cancel-stop: refused with a WSL message that points to Remove or forget.
Other desktop-side wsl.exe and \\wsl.localhost paths
Hook relay: only for desktop-spawned local WSL terminals, not on the WSL host path.
$HOME probe and \\wsl.localhost: both run as the default user. On the host path, the Claude/Codex account services use them to prepare a WSL target's account home, which is then handed to orcad. Left unpinned because \\wsl.localhost writes always run as the default user.
Root pinned with a non-root default: root can read the default home, so this keeps working.
Non-root pinned with root as default: per-account Claude/Codex sign-in for that host breaks. Remove the host and add it again.
Other discovery, filesystem and execution wsl.exe callers: serve local WSL projects, not the host transport.
Tests
Each test fails if its fix is reverted:
wsl-orcad-account-facts.test.ts, which runs the real probe in sh/dash:
the facts output still parses
the probe's own shell is never reported as another account's server
another account's managed orcad is named
the repro: an unpinned host whose default account lacks the paired key is refused before deploy
wsl-host-other-account-refusal.test.ts:
the account-changed error is final, and liveness stops with failed after one attempt
an unsealed foreign answer keeps backing off, while a sealed one stops
the root probe is valid sh
the account search pins only a single holder of the key
pin only after verify: a failing trial saves nothing; a verified one saves the pin and keeps it in memory
single-flight and bounded: concurrent trials join, and a hung trial is aborted at the cap (through the connect's signal, which ends its deploy and wsl.exe calls) and drops its override
wsl-distro-holder-user.test.ts:
the holder argv carries -u
a holder is kept while pins are unloaded, and replaced once it runs as another account than the pin
wsl-orcad-public-key-read.test.ts: the Add-time SSH conflict read, the facts probe's key line and the root probe all run in sh against a pretty-printed and a single-line key file holding a fake secret. Each prints only the publicKeyB64 value.
wsl-host-removal.test.ts:
unreachable host: pending, then removed
live stays listed
forget never calls stop
a renamed distro is stopped as the record's account despite a records re-read
wsl-orcad-host-user.test.ts and runtime-environment-wsl-host-user-pin.test.ts: transport -u, and the pin is set once and never moves.
rows added for the two new files that create a wsl.exe transport, with notes;
the holder spawn's row moved with it;
the rest pruned by the ratchet tool.
Real-WSL validation is still pending for this revision, on win-lowspec.
Performance
Every connect: no new process. The account, key and other-server checks run inside the facts probe that every connect already makes; they add one id, one sed, one ps and one awk there.
Pinned hosts whose default differs: one extra short wsl.exe (id -un) per connect, run in parallel.
Unpinned hosts after a mismatch: one wsl -u root probe, on the user's Connect only.
Holder adoption: compares the command line it already reads.
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
The changes add Linux-account detection and pinning for WSL hosts, including connection retry handling when the paired account differs from the default account. WSL host removal can now proceed without stopping the server, and eligible pending removals can be completed when Orca cannot confirm a stop. The CLI, pairing guards, status messages, and removal warnings now distinguish WSL hosts and these outcomes.
Severity of issue fixed: Medium
Merge Risk: Moderate · previous review 773bc
This change lets WSL hosts survive a changed default Linux user and makes unreachable hosts removable. Several edge cases remain open: a timed-out account migration may keep running under the wrong account, a stale pairing token may be saved, and a spoofed or transient handshake close may permanently fail a host. Resolve or accept these before merging, and run real-WSL validation.
Pre-merge checks: 3 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Description check
The description is detailed and follows most of the template. It has a Problem, Fix, Tests, and Performance section, and it links issues #49180 and STA-18401. It is missing several required template p…
Add an ELI5 section in plain language. Add a Visual Proof section with before and after screenshots or videos of the WSL host status and Remove messages, or write N/A with a reason. State which platforms were manually tested, and tick the T…
Passed checks: 3 passed
Check name
Status
Explanation
Title check
The title names three real changes in the changeset: pinning the WSL host's Linux user, refusing a second account's server, and letting Remove drop an unreachable host. It is long and dense, but it is…
Linked Issues check
Only #49180 is an active direct target. Its coding requirements, and the changes that address them, are:
(1) Changed default Linux user must not break connect. The facts probe reports the running acc…
Out of Scope Changes check
Each changed area connects to #49180 or to the stated PR objectives:
(a) Account pinning and migration: wsl-orcad-host-user.ts, wsl-orcad-host-transport.ts, wsl-distro-holder*.ts, wsl-host-deployment…
Full details: Title check
Explanation
The title names three real changes in the changeset: pinning the WSL host's Linux user, refusing a second account's server, and letting Remove drop an unreachable host. It is long and dense, but it is related to the main change and is not misleading. Its scope is broader than one headline change, which is acceptable.
Full details: Linked Issues check
Explanation
Only #49180 is an active direct target. Its coding requirements, and the changes that address them, are:
(1) Changed default Linux user must not break connect. The facts probe reports the running account and its public key (wsl-orcad-account-facts.ts). Host records store linuxUser (wsl-host-registration.ts, wsl-host-deployment-store.ts). The host transport applies the pin with wsl -u (wsl-orcad-host-user.ts, wsl-orcad-host-transport.ts). For unpinned hosts, a default account without the paired key is refused before deploy with WslHostAccountChangedError (wsl-orcad-held-context.ts, wsl-orcad-account-facts.ts). Liveness treats that error as final, so the card shows failed instead of Reconnecting (wsl-orcad-liveness-recovery.ts). This addresses the reported loop and the new-server deployment.
(2) Supported repair or reset of a stale pairing, without manual file edits. Automatic re-pairing is refused by design. Remove followed by Add is the supported reset. The Connect migration (wsl-host-account-migration.ts, wsl-host-user-connect.ts) repairs older unpinned records through Orca.
(3) Removal of an inaccessible host without a successful connection. forgetWslHostEnvironment (wsl-host-forget.ts) drops a WSL host without contacting the distro. wsl-host-removal.ts keeps a first Remove pending when the stop cannot be proven, and a repeated Remove drops the host only when the verdict is unverifiable. This two-step Remove is a design choice; forget is the one-step path. wsl-host-removal.test.ts covers these cases.
(4) CLI distinguishes WSL from SSH. managed-orcad-actions.ts tries the WSL forget path first. managed-server.ts selects WSL wording when no sshTargetId is present. orcad-managed-runtime-context.ts rejects WSL deployments for stop and other lifecycle actions with WSL guidance.
The named tests cover these behaviors. Evidence comes from the whole-PR summary, the PR description and the named files. I did not inspect the diff or run the tests. Real-WSL validation is pending. It is a manual check, not a coding requirement.
Full details: Out of Scope Changes check
Explanation
Each changed area connects to #49180 or to the stated PR objectives:
(a) Account pinning and migration: wsl-orcad-host-user.ts, wsl-orcad-host-transport.ts, wsl-distro-holder*.ts, wsl-host-deployment-store.ts, wsl-host-registration.ts, wsl-host-connection-record.ts, wsl-host-account-migration.ts and wsl-host-user-connect.ts. These implement the pin and the one-time migration for older records.
(b) Account refusal and liveness: wsl-orcad-account-facts.ts, wsl-orcad-held-context.ts, wsl-orcad-deploy.ts, wsl-orcad-connection.ts, wsl-orcad-liveness-recovery.ts, wsl-orcad-pairing-identity.ts, orcad-managed-tunnel-identity.ts, orcad-managed-pairing-repair.ts and the status copy. These support the refusal, its final-error handling and its messages.
(c) Removal, forget and CLI: wsl-host-removal.ts, wsl-host-service.ts, wsl-host-types.ts, wsl-host-forget.ts, managed-orcad-actions.ts, managed-server.ts, the CLI spec, orcad-managed-runtime-context.ts and orcad-managed-runtime.ts. These implement the Remove, forget and CLI requirements.
(d) Renderer copy, i18n, protected-copy keys and the remote-pairing failure copy: these support the user-visible behavior in (a) to (c).
(e) Tests: the new test files cover pinning, refusal, migration, liveness, removal, holder behavior and public-key-only reads.
(f) config/main-blocking-helper-baseline.txt: updates the ratchet for the new WSL transport files and the moved holder spawn, as the PR description states.
(g) spawnDetachedHolder moved to wsl-distro-holder-command.ts, and the fake connector and fixture updates. These support the holder and pin changes.
The Claude/Codex account-home and hook-relay paths are documented as intentionally left unpinned. The summary shows no unrelated feature or refactor. Evidence comes from the whole-PR summary. I did not inspect the diff.
Full details: Description check
Explanation
The description is detailed and follows most of the template. It has a Problem, Fix, Tests, and Performance section, and it links issues #49180 and STA-18401. It is missing several required template parts. The ELI5 section is absent. The Visual Proof section is absent, even though the change alters user-visible WSL host status, Remove, and CLI messages. The Testing checklist boxes are unchecked, and the description does not state which platforms were tested. The Risk section has no Level value, and it does not describe how to back out the change. The AI Disclosure, Review, and Agent skill upstream boundary sections are missing or unfilled. The Notes and Checklist sections are also absent. The author says real-WSL validation is still pending, which is a material gap for a Windows-specific change.
Resolution
Add an ELI5 section in plain language. Add a Visual Proof section with before and after screenshots or videos of the WSL host status and Remove messages, or write N/A with a reason. State which platforms were manually tested, and tick the Testing checkboxes that apply. Fill in the Risk level (Low, Medium, or High) and describe the rollback path. Complete the Agent skill upstream boundary checkbox. Complete the Review and Checklist sections, or remove the template text that does not apply. Mention the real-WSL validation status in the Testing section.
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.
The reason will be displayed to describe this comment to others. Learn more.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (1)
Minor · Propagate a newly available Linux user when reusing a… · wsl-orcad-connection.ts:329-330
src/main/wsl/orcad/wsl-orcad-connection.ts:329-330 Minor · Data Integrity & Integration · Quick win
Propagate a newly available Linux user when reusing a connection.
If the first probe returns linuxUser: null and a later probe returns alice, the same-port reuse path keeps the old null. refreshOffer neither compares nor copies launch.linuxUser. The persistence caller therefore cannot pin the older record on that verified connect.
Include a newly available non-null linuxUser in the change check and copied fields. Preserve a known account when a later probe cannot read it.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: f6e6333f-fe31-4ee0-9560-05e858f5652d
Commits
Reviewing files that changed from the base of the PR and between e97406c and 2f09c1e.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (1)
Minor · Refresh the account fields when reusing a bridge. · wsl-orcad-connection.ts:331
src/main/wsl/orcad/wsl-orcad-connection.ts:331 Minor · Functional Correctness · Quick win
Refresh the account fields when reusing a bridge.
If a host stays pinned to alice and the distro default changes to bob, the next launch returns defaultLinuxUser: 'bob'. The same-port path calls refreshOffer, but this assignment retains the old account fields. The changed predicate also ignores them.
As a result, the connection can retain defaultLinuxUser: null, and runsAsOtherUserDetail does not show the account change. Compare and copy linuxUser and defaultLinuxUser with the other launch metadata. Keep the refresh quiet when all fields match.
Minor comments: 1
src/main/wsl/orcad/wsl-orcad-account-facts.ts: 1
37-37: Minor · Functional Correctness · Poor tradeoff
Refuse another account only when its managed orcad owns the port listener.
The probe matches a listener by UID alone. The awk program records the UID of each listener on the managed port. It then reports any process of that UID whose arguments contain ORCAD_ARGV, regardless of the port that process uses. If one account has a listener on the managed port and also runs an orcad on a different port, the probe reports that account as the other-account server. The held-context check then refuses Add and connect with WslOrcadOtherAccountServerError, and the message names the wrong owner.
The trigger requires a specific setup: one account must own a listener on the managed port while running its own orcad elsewhere. The refusal does not block a working deployment. Linux does not let this account's orcad bind a port that another UID's listener holds, so the deployment would fail with a port conflict without the refusal. The impact is a misleading error and a misdirected recovery step.
Correlate the listener with the process that owns its socket. The probe must return a peer only when that process is another account's managed orcad. The current ps -eo uid=,args= output has no PID, so the correlation also requires the PID. The socket inode is in column 10 of /proc/net/tcp and /proc/net/tcp6. When the probe cannot establish that ownership, it must not report an other-account refusal.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: ef59fa1e-46d4-406d-a314-e82fc34b5829
Commits
Reviewing files that changed from the base of the PR and between 2f09c1e and 7ca288d.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Make the account-key scan exit 0 when the last account has no key.
The scan's exit status comes from its last account that has an .orca directory. If that account has no readable key, the && list fails and the scan exits 1. execCommand then rejects, and pinUnpinnedWslHostAccount returns null with a warning. A unique account that already printed a matching key is therefore discarded. The record stays unpinned, and the user must remove and re-add the host.
Use an if statement for the print. An if whose condition is false and has no else exits 0, so a missing key no longer fails the scan.
Suggested fix
--- "a/src/main/wsl/host-lifecycle/wsl-host-account-migration.ts"+++ "b/src/main/wsl/host-lifecycle/wsl-host-account-migration.ts"@@ -12,7 +12,7 @@
import { orcadPublicKeyCommand } from './wsl-host-ssh-orcad-conflict'
/** One line per account with an orcad key: `<name> <public key>`; run as root to read every home. */
-export const WSL_ACCOUNT_KEYS_COMMAND = `getent passwd | while IFS=: read -r _orca_n _ _ _ _ _orca_h _; do [ -n "$_orca_h" ] && [ -d "$_orca_h/.orca" ] || continue; _orca_k=$(${orcadPublicKeyCommand('$_orca_h')}); [ -n "$_orca_k" ] && printf '%s %s\\n' "$_orca_n" "$_orca_k"; done`+export const WSL_ACCOUNT_KEYS_COMMAND = `getent passwd | while IFS=: read -r _orca_n _ _ _ _ _orca_h _; do [ -n "$_orca_h" ] && [ -d "$_orca_h/.orca" ] || continue; _orca_k=$(${orcadPublicKeyCommand('$_orca_h')}); if [ -n "$_orca_k" ]; then printf '%s %s\\n' "$_orca_n" "$_orca_k"; fi; done`
/** The single account whose key is `publicKeyB64`; null when none or several hold it. */
export function accountHoldingKey(output: string, publicKeyB64: string): string | null {
Committable suggestion
IMPORTANT
Review the replacement and indentation, then test before committing.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Data Integrity & Integration · Quick win
Keep a host listed when its unrecorded peer-kept state is still unresolved.
A Remove that finds a server kept for another Orca, but cannot save the kept-for-peers marker, stores reasonCode: 'removalUnrecorded' in pendingStop. A later Remove then checks only the new stop result. If that retry fails or stays unverifiable, mayForgetOnRetry allows removal. The host is dropped without the marker ever being saved. Undo of a move onto this host then reads wasWslHostKeptForPeers as false. It reports stopped while the server may still run for another Orca. This breaks the invariant stated at line 108.
The retry path must not drop the host while the stored removalUnrecorded state remains unresolved. The exact behavior is a policy choice. The host can stay listed until the marker is saved or the server is proven stopped. Another option is to save the marker from the stored pending state before the host is dropped. Either option must leave wasWslHostKeptForPeers true for this environment, or leave the host listed, for every removal path that can reach undo.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Use a peer UID that differs from the test process UID.
If this suite runs as root, the fixture and the current account both have UID 0. The probe correctly excludes the current account, so the assertion on Line 59 fails.
Select a fixture UID different from process.getuid() and use that UID in the process row, listener row, and assertion. This keeps the test valid for both root and non-root execution.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Do not adopt a mismatched holder when its termination fails.
If killProcess throws or the holder remains alive, stopRecordedHolder returns live. This line discards other-account, so ensureHeld returns adopted without creating a holder for the pinned account. The retained holder watches the other account's release file, so the pinned server's idle-release request cannot release it.
If termination does not reach exited, retain an unverifiable result or reject the ensure. Preserve replacement after confirmed termination.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Stability & Availability · Quick win
Overlapping migrations for one distro can clear the account override early.
withWslHostLinuxUser keeps one override per distro. The first scope to finish deletes it, even while another migration for the same distro is still running. Nothing in the Connect path serializes that scope. If two Connect requests for the same unpinned distro overlap, a connect that starts after the first scope ends can run as the default user and fail with the account mismatch this change fixes. The second scope then restores the account as a stale override. That override can remain until the process restarts.
Require the override for a distro to stay set until the last active migration for that distro ends. Choose the mechanism yourself: serialize the migration per distro, or keep a reference count in withWslHostLinuxUser. The fix must cover the whole scope, including the connect and the cleanup.
Minor · Functional Correctness · Quick win
Set the in-memory pin for the migrated account when the migration saves it.
connectAsPairedWslAccount saves linuxUser only to disk through persist. The in-memory pin changes only when readWslHostRecordsQuietly runs. When the withWslHostLinuxUser scope ends, pinnedWslHostLinuxUser(distro) returns undefined until the next record read. A transport process started in that window selects the distro default account, which the saved pairing does not match.
The window closes at the next record read, so the impact is transient. The migration should make the pin take effect as soon as the account is saved, so the next command does not depend on a record read.
The reason will be displayed to describe this comment to others. Learn more.
Major · Data Integrity & Integration · Quick win
Stale pairing write after a connect that repairs the token.
The write at lines 71-76 always passes found.offer, which was read before connect() ran. The comment at line 70 assumes connect() leaves the saved pairing unchanged. That assumption fails when the server refuses the enrolled token. The repair then saves a replacement token, and this write can restore the refused token. The persisted host then holds credentials the server no longer accepts. The next reconnect must repair again.
Use the pairing that is stored after connect() completes, not found.offer. The write should then add only the pin, as the comment at line 70 states. Keep the port fields as they are; the evidence does not show a port change here.
The reason will be displayed to describe this comment to others. Learn more.
Major · Functional Correctness · Heavy lift
Refuse Connect when another account's orcad holds the saved port.
The peer check looks only for another Linux account running a managed orcad. It does not check which port that orcad uses or whether it owns a listener. It only logs a warning, so Connect continues to context resolution and deployment. The warning says the host "keeps its own account's server and port," but the managed port is the single constant 6_768 for every account. A peer on the default port is therefore not excluded. The PR's stated behavior requires refusing Connect when another account owns a listener on the host's port and runs a managed orcad. Add that refusal before deployment. Keep the warning for a peer on a different port. Identity verification on connect still rejects a foreign server, but that check does not replace the required refusal before deployment.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Major · Stability & Availability · Heavy lift
Do not mark hello-stage close codes as sealed.
The close-code branch sets sealed: true for codes 4001 and 4003 without checking the handshake stage. A 4001 close during the e2ee_hello exchange occurs before the client authenticates the pinned server key. The framing code already notes that an on-path party can fake such a refusal. The sealed flag asserts that the pinned key's handshake refused, so this classification is incorrect for hello-stage closes.
The effect is material. wsl-orcad-liveness-recovery.ts treats sealed as final. It publishes a failed state and stops retrying. The wslHostServer message then tells the user to remove and re-add the WSL host. A transient or spoofed hello-stage close therefore produces a destructive user action instead of a retry.
Correct the classification so that sealed is set only for a 4001 or 4003 close that follows pinned-key authentication. Hello-stage closes must stay unsealed, so recovery can back off as it does for other foreign answers. The framing module already tracks this distinction with readyAccepted, but that state is not exposed to classifyOrcadTunnelIdentityFailure. The mechanism for exposing it is a design choice.
Also confirm the premise for code 4003. The inspected source does not show when 4003 is sent, so its handshake stage is not established.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Stability & Availability · Heavy lift
Stop the trial's connect before the account override ends.
raceAbort rejects when the 10-minute timeout fires. It does not stop the connect work. withWslHostLinuxUser then removes the override. The connect transport is built without the trial's abort signal (wsl-orcad-connection.ts:195), so its wsl.exe spawns do not stop on the timeout. spawnWsl resolves the Linux user at spawn time (wsl-orcad-host-transport.ts:63-65). For an unpinned record, a command that starts after the override ends runs as the distro default account, not found.linuxUser.
Require the trial to stop all connect commands before the override ends. Pass the trial signal into the connect transport. Make the transport reject every command after the signal aborts, including the loop path in execWithClosedStdin (wsl-orcad-host-transport.ts:116-118). Also wait for the connect to settle before withWslHostLinuxUser returns.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
WSL hosts ran every
wsl.execall as the distro's default Linux user. A managed orcad keeps its install, data and E2EE host key (~/.orca/orca-e2ee-keypair.json) under that user's home.So when the default user changed (root to
qauserin the real-WSL repro), the next connect:qauser, on 127.0.0.1:6800 (managed orcads listen on 6800 or the next free port);foreign-port, because its key isn't the pinned one. The refusal comes fromverifyWslOrcadPairing→resolveWslOrcadPairing;The host also couldn't be removed:
orca environment rm: printed SSH-only advice.orca environment stopandorca environment forget: said "not managed through an orcad SSH deployment".Fix
1. Pin the Linux account (
wsl -u). The deploy's single facts probe reports the account it runs as, and the host record stores it aslinuxUserat Add. The pin is applied to:Pins come from each read of the host records. Two operations override them for their own duration, through
withWslHostLinuxUser, and a records re-read can't clear that override:A pin never moves.
Why pinning instead of re-pairing or redeploying for the new user:
2. Never deploy for the wrong account (the repro). For an unpinned host, the facts probe also reads the default account's public key from
~/.orca/orca-e2ee-keypair.json. If that key isn't the saved pairing's key, the connect is refused before anything is deployed, with the final errorWslHostAccountChangedError. Its message is neutral, since a reset identity looks the same. Because the error is final, liveness publishes it asfailed, so the card shows the error instead of "Reconnecting".Liveness treats only sealed proofs as final:
WslHostAccountChangedErrorand unsupported distros;unpaired(pairing rejected);sealed; an unparseable published offer is not);A catch-all
foreignanswer (astatus.geterror, or a port briefly answered by something else during a restart) keeps the old backoff and is not given "remove and add again" wording.3. Migration for hosts saved before pinning.
wsl -u rootprobe reads every account's~/.orca/orca-e2ee-keypair.json.~/.orca), and only the first 4 KiB.timeout 10when available, plus a 15 s desktop abort, so an abandoned probe can't leave a root scan running.When a pinned account differs from the distro's current default user, Settings shows "Runs as . To use , remove the host and add it again." Reading the current default user costs one unpinned
id -un, only for pinned hosts, in parallel with the context probes.4. No port refusal (simplified). A managed orcad listens on 6800, or moves up the fallback ladder when that port is taken. Every connect dials the port its own account's server published. So two accounts' servers coexist on different ports, and a connect never meets the other account's server. The earlier port-based refusal never fired, and it guarded no real conflict, so it is gone.
The real conflict in the repro was Orca starting the new account's server, which 2 now prevents. If another account's managed orcad does run in the distro, the probe logs it once per distro so it isn't silent.
5. Holder account.
-u <pinned user>, so it watches that account's~/.orcarelease file.spawnDetachedHoldermoved towsl-distro-holder-command.ts, with its row in the blocking-helper baseline.6. Remove and the CLI.
liveverdict and aremovalUnrecordedrecord stay listed.orca environment forget: drops a WSL host without contacting its distro.orca environment rm: on a WSL host, explains how to remove a WSL host.orca environment stop, update, rollback, recover and cancel-stop: refused with a WSL message that points to Remove or forget.Other desktop-side
wsl.exeand\\wsl.localhostpaths$HOMEprobe and\\wsl.localhost: both run as the default user. On the host path, the Claude/Codex account services use them to prepare a WSL target's account home, which is then handed to orcad. Left unpinned because\\wsl.localhostwrites always run as the default user.wsl.execallers: serve local WSL projects, not the host transport.Tests
Each test fails if its fix is reverted:
wsl-orcad-account-facts.test.ts, which runs the real probe in sh/dash:wsl-host-other-account-refusal.test.ts:failedafter one attemptwsl-distro-holder-user.test.ts:-uwsl-orcad-public-key-read.test.ts: the Add-time SSH conflict read, the facts probe's key line and the root probe all run inshagainst a pretty-printed and a single-line key file holding a fake secret. Each prints only thepublicKeyB64value.wsl-host-removal.test.ts:livestays listedwsl-orcad-host-user.test.tsandruntime-environment-wsl-host-user-pin.test.ts: transport-u, and the pin is set once and never moves.pnpm check:changedpasses. Blocking-helper baseline:wsl.exetransport, with notes;Real-WSL validation is still pending for this revision, on win-lowspec.
Performance
id, onesed, onepsand oneawkthere.wsl.exe(id -un) per connect, run in parallel.wsl -u rootprobe, on the user's Connect only.Fixes #49180
Fixes STA-18401