Repository navigation
Conversation
An independent review of the runner found two real defects and proved the goalpost was wrong. All verified before fixing. P1 -- `lane: 'interactive'` plus `script` ran with no login shell AND no cached environment. A script never rides the login shell (it owns stdin), so that combination fell into the shell-free branch while the environment was only fetched for `lane: 'probe'` -- giving a caller who explicitly asked for the user's terminal PATH strictly less than the probe lane would have. The cached environment is now fetched whenever there is a script, on either lane. P1 -- the guard missed the largest wsl.exe spawner in the tree. It only matched a named opener, so `git/runner.ts` (`binary: 'wsl.exe'`, spawned four lines later), locally-aliased callers (`run(`, `execFileUtf8(`) and `command:` fields were all invisible. The count was the goalpost, so the goalpost was wrong. The detector now accepts any identifier call and the assignment-style fields, and the five files that reach a spawn through a variable are recorded as a named blind spot rather than left implied. Also: - A missing fence now throws instead of returning `''`. `readStdout` returns null precisely to distinguish "no fence" from "empty payload", and collapsing them is the silent-wrong-answer shape this module exists to avoid. - A `program` containing `=` is rejected: after `env PATH=… HOME=…` it reads as a third assignment, so `env` prints the whole guest environment and exits 0. - An empty argv with a cwd is rejected: `exec` with no operands is a no-op, so the wrapper would cd and exit 0 having run nothing. - The sentinel assertion could not fail (`offenders + allowlist >= 20` with a 23-entry allowlist); it now names a call site that is definitely there.
`wsl-cli-installer.ts` probed on `bash -lc` purely to get a real PATH for its interop checks, which is the direct cause of the 10s timeout behind a blocking `~/.profile` (#14288). The probe lane gives it the same login PATH from one cached probe instead of paying `~/.profile` on every call. `hooks.ts` ran `bash -c` with hand-rolled single-quote escaping; the script now travels on stdin, so there is no quoting boundary left to get wrong. `set -euo pipefail` became `set -eu` in the two transported scripts. That is a semantic change, so it was checked rather than assumed: neither script contains a pipe, and dash -- which is `sh` on Debian/Ubuntu -- has no `pipefail` option at all, so keeping it would have failed the script outright. Deliberately not migrated, with reasons recorded rather than skipped: - `wsl-availability.ts` and `wsl.ts` invoke host-level flags (`--status`, `--list --quiet`). The runner always prepends `--exec`, so a flag-only invocation cannot be expressed through its API at all. - `wsl.ts`'s `getWslHome`/`wslUncDirectoryExists` are synchronous and called synchronously from six production files. The runner is Promise-only, so migrating them means a sync-to-async cascade well outside this scope -- and they share caches with their async twins, so migrating half would split one contract across two transports. Allowlist: 23 -> 21.
Three independent reviews (Opus, Grok, GPT) converged on the same release blocker and several reliability defects. P0 -- WSL hooks silently ran user scripts under dash. `hooks.ts` passed a script with no `shell`, which defaults to `sh`; the native path pins `/bin/bash` and docs/reference/windows-setup-shell.md guarantees bash on every platform. Any `orca.yaml` hook using `[[ ]]`, arrays, `local` or `source` broke on WSL only. The bashism guard cannot see this -- the payload is user data, not caller source -- so the fix is `shell: 'bash'` plus this note. P1 -- a rejected probe poisoned the cache for the process lifetime. `runProcess` rejects when the child cannot start, and the uncaught rejection stayed in `inFlight`, so every WSL feature threw until restart. Now classified transient. P1 -- three skill sites dropped their exit-code checks. `runProcess` resolves on a non-zero exit, so a scan killed at its 10s timeout returned partial stdout that parsed into a valid "zero skills" result -- which reads as "nothing is installed" and re-offers installs for skills that are present. P1 -- probe failure used to fall back to the login shell, which sources `~/.profile`: the stall this runner exists to remove, reintroduced exactly when the distro is slowest. It now runs shell-free and reports `environmentResolved: false`, and agent detection treats that as unknown rather than absent -- reporting an nvm-installed agent absent is #9725. Elegance: four byte-identical POSIX quote helpers collapsed to one; the dead `addWorktreeSetupWslInteropEnv` and the speculative `signal` option removed; the guard scanners share one walker; comments cut to AGENTS.md density.
Three reviews found the same class of defect three different ways: a call that answers "is this installed?" running on the bare default PATH and reporting an nvm-installed tool absent (#9725). Each time the fix was to check a flag at the call site -- and 3 of 8 sites had already forgotten the analogous exit-code check, so that approach was not going to hold. The runner now throws when the login PATH cannot be established. A caller that genuinely tolerates a degraded PATH says `allowDegradedEnvironment: true`, which puts the decision in the one place a reader looks instead of in every caller's memory. No production caller needs it today. Also: the probe no longer runs on its own 10s timer ahead of the caller's budget. A 5s caller could reach `runProcess` with 1ms left and report a timeout for a command that would have taken milliseconds; the probe now gets two thirds of the remaining budget and the command keeps the rest. And `invalidateWslGuestEnvironment` finally has a production caller: Refresh in the Agents pane. Its whole purpose is "installed a new CLI, Orca doesn't see it yet", which could not work while the guest PATH stayed cached for the process lifetime.
Migrating them onto the runner removed their direct child_process import, so the W1 ratchet reports them stale. Second goalpost moving as a consequence of the first: 163 -> 156.
Contributor
Author
|
Folded into #15915, which carries the same content plus three rounds of review fixes on one branch that is green on its own. The stacked branches predated those fixes, so each was red in isolation — collapsing was safer than four-way branch surgery. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Stacked on #15910. This is the review-response PR: three independent reviews (Opus, Grok, GPT) ran against the stack, and this closes what they found — including a release blocker.
ELI5
Reviewers found that WSL hooks had quietly started running users' scripts with the wrong shell, and that a few failure paths answered "nothing found" when the honest answer was "couldn't check". Both are fixed, and the runner now refuses to guess.
P0 — WSL hooks silently ran user scripts under dash
hooks.tspassed a script with noshell, which defaults tosh. The native path pins/bin/bash(getHookShell()), anddocs/reference/windows-setup-shell.mdstates the runner is "always executed by bash … on every platform."Any
orca.yamlhook using[[ ]], arrays,localorsourceworked on macOS/Linux and broke on WSL only — including one that opens with#!/usr/bin/env bash, since the shebang is inert when the payload arrives on stdin.The bashism guard could not catch this: it scans caller source, and a hook script is user data loaded at runtime. Fixed by pinning
shell: 'bash', with that reasoning at the call site.P1s
runProcessrejects when the child cannot start (ENOENT, EAGAIN under memory pressure). The uncaught rejection stayed in the in-flight map, so every WSL feature re-threw it until app restart. Now classified transient.~/.profile, the exact stall the runner exists to remove, and most likely to bite precisely when the distro is slowest. It now runs shell-free.runProcesswith 1ms left and report a timeout for a command that would have taken milliseconds. The probe now gets 2/3 of the remaining budget.invalidateWslGuestEnvironmenthad no production caller. Its entire purpose is "installed a new CLI, Orca doesn't see it yet", which could not work while the guest PATH stayed cached for the process lifetime. Now wired into Refresh in the Agents pane.The design change worth reviewing
Three reviews found the same class of defect three different ways: a call that answers "is this installed?" running on the bare default PATH and reporting an nvm-installed tool absent. Each time the fix was "check a flag at the call site" — and 3 of 8 sites had already forgotten the analogous exit-code check.
So the runner now throws when the login PATH can't be established. A caller that genuinely tolerates degradation says
allowDegradedEnvironment: true. That puts the decision in the one place a reader looks instead of relying on every caller's memory. No production caller needs the flag today.Elegance
Four byte-identical POSIX quote helpers collapsed to one. Dead
addWorktreeSetupWslInteropEnvand the speculativesignaloption removed. Guard scanners share one walker (they had already drifted — that drift is why the WSL separator guard was scanningtests/e2e/.cross-version-checkouts/). Comments cut to AGENTS.md density.Proof of no regression
Full suite, typecheck and lint clean. New tests cover: hook interpreter pinning, transient classification of a spawn rejection, the budget split, refusal on unresolved environment, and the opt-in escape hatch.
User-facing trade-offs