Skip to content

tests: guest CLI lookups read a fake system folder, never the host's (orca #48, slice 4) - #52

Merged
nachumi-a2zoperations merged 1 commit into
blowzer/fork-onlyfrom
nachumi-a2zoperations/issue-48-host-cli-leak
Nov 15, 2026
Merged

nachumi-a2zoperations merged 1 commit into
blowzer/fork-onlyfrom
nachumi-a2zoperations/issue-48-host-cli-leak

Conversation

@nachumi-a2zoperations

Copy link
Copy Markdown

Refs #48 (slice 4: the host-CLI leak pair, 2 red files). #48 stays open for the rest.

Root cause

command-guest-path.test.ts and wsl-guest-native-program.test.ts inject PATH (pathEnv) and home (homePath). But after a PATH miss, cliCommandLookup also tries getSystemCliInstallDirectories(), which returns absolute host folders that ignore the injected home:

Platform Host folders searched
macOS /opt/homebrew/bin, /usr/local/bin, /nix/…, /opt/local/bin
Linux /usr/local/bin, /snap/bin, /home/linuxbrew/.linuxbrew/bin, /nix/…

This MacBook has a real /usr/local/bin/claude and /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 getSystemCliInstallDirectories with 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

  • 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.
  • Preflight check-changed: 23/23.

…(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
@nachumi-a2zoperations
nachumi-a2zoperations merged commit fd3d8c7 into blowzer/fork-only Nov 15, 2026
2 checks passed
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.

1 participant