Repository navigation
tests: guest CLI lookups read a fake system folder, never the host's (orca #48, slice 4) - #52
Merged
nachumi-a2zoperations merged 1 commit intoNov 15, 2026
Conversation
…(orca #48, slice 4) Root cause of command-guest-path.test.ts and wsl-guest-native-program .test.ts failing on the MacBook (on Node and on Bun): the tests inject PATH and home, but after a PATH miss cliCommandLookup also tries getSystemCliInstallDirectories(), which returns absolute HOST folders (/opt/homebrew/bin and /usr/local/bin on macOS; /usr/local/bin, /snap/bin, ... on Linux) that ignore the injected home. On a machine with a real claude or codex there (this MacBook: /usr/local/bin/claude, /opt/homebrew/bin/codex) the lookup found the host binary ("expected '/usr/local/bin/claude' to be null"); a machine without one passed by luck. Fix (tests only, per the Leader's rule that they must not read the host PATH or real binaries at all): both tests replace getSystemCliInstallDirectories with a fake system folder under their own temp root (vi.hoisted + vi.mock). Every other folder in the lookup already derives from the injected home. No product code changes. New test: a CLI placed only in the fake system folder is found after a PATH miss, so the seam is proven in use, not just present. Red before on the MacBook (3 failing: 2 in command-guest-path, 1 in wsl-guest-native-program); green now, 6/6 on the Bun runner and on plain Node, with the real host binaries still installed. Refs #48
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.
Refs #48 (slice 4: the host-CLI leak pair, 2 red files). #48 stays open for the rest.
Root cause
command-guest-path.test.tsandwsl-guest-native-program.test.tsinject PATH (pathEnv) and home (homePath). But after a PATH miss,cliCommandLookupalso triesgetSystemCliInstallDirectories(), which returns absolute host folders that ignore the injected home:/opt/homebrew/bin,/usr/local/bin,/nix/…,/opt/local/bin/usr/local/bin,/snap/bin,/home/linuxbrew/.linuxbrew/bin,/nix/…This MacBook has a real
/usr/local/bin/claudeand/opt/homebrew/bin/codex, so the lookup found the host binary:expected '/usr/local/bin/claude' to be null,expected '/opt/homebrew/bin/codex' to be '/proc/orca-agent-cli-installed-only-on-windows/codex'. Failing on Node and on Bun alike. A machine without them passed by luck.Fix (tests only)
Following the Leader's rule that these tests must not read the host PATH or real binaries at all: both tests replace
getSystemCliInstallDirectorieswith a fake system folder under their own temp root (vi.hoisted+vi.mock). Every other folder in the lookup (nvm, fnm, volta, mise,~/.local/bin, …) already derives from the injected home. Product code is unchanged.A new test puts a CLI only in the fake system folder and expects it to be found after a PATH miss, so the seam is proven in use, not just present.
Tests
command-guest-path, 1 inwsl-guest-native-program).check-changed: 23/23.