Skip to content

fix(preflight): do not count a Windows binary reached through interop as a WSL install - #16028

Merged
nwparker merged 3 commits into
mainfrom
nwparker/wsl-interop-false-positive
Aug 23, 2026
Merged

nwparker merged 3 commits into
mainfrom
nwparker/wsl-interop-false-positive

Conversation

@nwparker

@nwparker nwparker commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​75 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​71
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​50 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​45

ELI5

WSL adds the Windows PATH to the Linux PATH by default. So on a distro with no
Linux claude installed, asking the distro "where is claude?" happily answers
with the Windows one:

/mnt/c/Users/me/AppData/Local/.../claude.exe

That is a POSIX-absolute path, so our check — "is this an absolute path?" —
accepted it, and preflight reported Claude as installed in the distro.

It isn't. It's the Windows install, seen through a compatibility shim.

Why this is worse than reporting it missing

A false negative tells the user to install something. Annoying, recoverable, and
we spent the last cycle removing those (#9725).

A false positive tells the user it works. Orca then launches a Windows
executable inside a Linux session, where it sees Windows paths, no guest
$HOME, and none of the distro's config. The failure surfaces later and
somewhere less obvious than "not installed".

What changed

parseWslDetectedCommands now rejects a resolved path that is /mnt/<drive>/…
or ends in .exe, case-insensitively. One predicate, one call site.

Proof of no regression

  • A genuine guest install (/home/alice/.nvm/versions/node/v20.1.0/bin/claude)
    is still detected — pinned by a new test.
  • The three rejection shapes are pinned: a /mnt path, an uppercase
    /MNT/D/…/claude.EXE, and a bare .exe outside /mnt.
  • Both new tests were verified to bind: with the predicate removed they fail,
    with it restored they pass.
  • The existing real-shell suite (nvm discovery, ~/.local/bin, $HOME with a
    space, directory-is-not-a-CLI, volta/asdf/fnm/mise) is unchanged and green.
  • src/main/ipc suite: 3124 passed. Lint and typecheck exit 0.

User-facing trade-offs

One, and it is intended. A user who has Claude installed only on Windows
and reaches it from inside WSL purely through interop will now see it reported
as not installed in that distro. That is the correct answer: Orca's WSL runtime
expects a Linux CLI, and the interop binary does not behave like one. The
Windows-side detection is unaffected and still finds it.

No wire, persisted state, settings, or IPC change.

… as a WSL install

WSL appends the Windows PATH to the guest PATH by default, so on a distro with
no guest `claude`, `command -v claude` resolves to
`/mnt/c/Users/me/.../claude.exe`. That path is POSIX-absolute, so the existing
absolute-path check accepted it and preflight reported the agent as installed
in the distro.

That is worse than reporting it absent. Absent tells the user to install it; a
false positive launches a Windows executable inside a Linux session, where it
sees Windows paths, no guest $HOME and none of the distro's config -- and the
failure surfaces later, somewhere less obvious.

Rejects `/mnt/<drive>/` and any `.exe`, case-insensitively. A genuine guest
install is unaffected.
@coderabbitai

coderabbitai Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9f3df747-11d0-4f12-966f-7c4b6f9eda0b

📥 Commits

Reviewing files that changed from the base of the PR and between dd6b14e and 0315f60.

📒 Files selected for processing (2)
  • src/main/ipc/preflight-wsl-agent-detection.test.ts
  • src/main/ipc/preflight-wsl-agent-detection.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

WSL command lookup can skip Windows-mounted PATH directories identified from /proc/mounts. WSL agent detection enables this lookup mode and accepts resolved POSIX-absolute paths without the removed Windows interop filter. Tests cover valid guest binaries under /mnt, standard guest installations, and guest binary resolution after a Windows binary appears earlier in PATH.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the problem, solution, trade-off, and testing, but it omits the required Linked Issue, Visual Proof, Review, Notes, and Checklist sections. Add the missing template sections, include the required linked issue, mark Visual Proof as N/A with a reason, and complete the testing and checklist items.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the primary change: preventing Windows binaries reached through WSL interop from counting as WSL installations.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
src/main/ipc/preflight-wsl-agent-detection.ts (1)

68-81: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Shorten the interop-path explanation.

The comment includes a long failure narrative and implementation details. Keep a brief statement that WSL-mounted Windows paths and .exe resolutions do not count as guest installations.

As per coding guidelines, comments must be concise, non-obvious, and brief. They must not explain obvious behavior or walk through code.

Proposed comment reduction
-/**
- * A Windows binary reached through WSL interop, not a guest install.
- * ...
- */
+// Exclude WSL interop paths from guest-install detection.

Source: Coding guidelines

src/main/ipc/preflight-wsl-agent-detection.test.ts (1)

135-139: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a standalone uppercase .EXE fixture.

The /MNT/D/tools/claude.EXE case can pass because the mounted-path branch rejects it. Add a path such as /opt/weird/claude.EXE to verify the case-insensitive suffix check independently.

Proposed additional fixture
   ['a .exe anywhere', '/opt/weird/claude.exe'],
+  ['an uppercase .EXE anywhere', '/opt/weird/claude.EXE']

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bb03f1b9-a48e-4d8b-a4ff-58645d89fb77

📥 Commits

Reviewing files that changed from the base of the PR and between 636f428 and 02eec3e.

📒 Files selected for processing (2)
  • src/main/ipc/preflight-wsl-agent-detection.test.ts
  • src/main/ipc/preflight-wsl-agent-detection.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.

The review caught this and it is the more important half of the fix.

Rejecting the interop path in TypeScript happens after the guest walk has
already stopped on it: the lookup breaks at the first executable, and the
version-manager fallback dirs are APPENDED, so they sit behind the Windows
entries WSL appends. A user with claude in nvm AND on the Windows PATH
therefore went from a false positive to "not installed" -- the exact #9725
population the fallback dirs exist to serve. Worse than the bug being fixed.

The lookup now takes `skipWindowsMountDirs` and skips those PATH components
mid-walk, so the guest binary behind the shadow is still found. Matched by
mount metadata from /proc/mounts (drvfs/9p/virtiofs), not by a `/mnt` name:
the automount root is configurable, and `/mnt` is an ordinary directory on a
Linux box. That also closes the custom-root hole the reviewers found in the
name-based predicate.

The TypeScript check stays as a secondary net for a mount the guest does not
report, with a comment saying why it must never be the thing that decides.

Proven with a real /bin/sh: a Windows `claude` ahead of an nvm `claude` on
PATH now resolves to the nvm one.

Credit: review counsel, and community PR #12794 (spfcraze), which proposed
this shape first.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/shared/posix-command-path-lookup.ts (1)

8-19: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Reduce repeated implementation walkthrough comments.

Keep one concise comment for the non-obvious mount-filtering contract. Remove or shorten the repeated rationale at each call site and test.

  • src/shared/posix-command-path-lookup.ts#L8-L19: Reduce the option documentation to the contract and reason for mount metadata.
  • src/main/ipc/preflight-wsl-agent-detection.ts#L25-L28: Replace the repeated rationale with one concise call-site comment or remove it.
  • src/main/ipc/preflight-wsl-agent-detection.ts#L85-L90: Reduce the secondary-filter explanation to its fallback purpose.
  • src/main/ipc/preflight-wsl-agent-detection.test.ts#L262-L266: Remove the implementation walkthrough; the test name states the behavior.

As per coding guidelines, “Comments must be concise, non-obvious, and brief—prefer one line; do not explain obvious behavior or walk through code.”

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 15e92981-0f7f-4de2-9343-1dd6a610d60b

📥 Commits

Reviewing files that changed from the base of the PR and between 02eec3e and dd6b14e.

📒 Files selected for processing (3)
  • src/main/ipc/preflight-wsl-agent-detection.test.ts
  • src/main/ipc/preflight-wsl-agent-detection.ts
  • src/shared/posix-command-path-lookup.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.

' _orca_lookup_has_more=',
' ;;',
' esac',
...skipMountComponent,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- tracked files ---'
git ls-files 'src/shared/posix-command-path-lookup.ts' '*posix*command*' '*command*path*'
printf '%s\n' '--- file outline ---'
ast-grep outline src/shared/posix-command-path-lookup.ts
printf '%s\n' '--- relevant source ---'
cat -n src/shared/posix-command-path-lookup.ts
printf '%s\n' '--- related symbols and tests ---'
rg -n -C 4 'skipWindowsMountDirs|skipMountComponent|posix-command-path-lookup|PATH|PWD|mount' src test tests 2>/dev/null || true

Repository: stablyai/orca

Length of output: 50370


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- target file ---'
wc -l src/shared/posix-command-path-lookup.ts
cat -n src/shared/posix-command-path-lookup.ts
printf '%s\n' '--- exact symbol references ---'
rg -n -C 3 'skipWindowsMountDirs|skipMountComponent|lookup.*Path|posix-command-path-lookup' \
  src/shared src/main src/renderer --glob '*.{ts,tsx,js,jsx}' 2>/dev/null || true
printf '%s\n' '--- candidate tests ---'
git ls-files | rg '(^|/)(.*(posix|command|path).*(test|spec)|.*(test|spec).*(posix|command|path))\.(ts|tsx|js|jsx)$' || true
printf '%s\n' '--- target-file references in tests ---'
rg -l 'posix-command-path-lookup|skipWindowsMountDirs|skipMountComponent' . \
  --glob '*.{ts,tsx,js,jsx}' --glob '!node_modules/**' --glob '!dist/**' --glob '!build/**' 2>/dev/null || true

Repository: stablyai/orca

Length of output: 39973


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- focused lookup tests ---'
cat -n src/shared/posix-command-path-lookup.test.ts
printf '%s\n' '--- WSL detection implementation ---'
cat -n src/main/ipc/preflight-wsl-agent-detection.ts
printf '%s\n' '--- WSL detection tests around mount behavior ---'
sed -n '240,340p' src/main/ipc/preflight-wsl-agent-detection.test.ts | cat -n
printf '%s\n' '--- all fallback references ---'
rg -n -C 6 'buildPosixFallbackPathPrelude|fallback|resolved|skipWindowsMountDirs|detectWslCommandsOnPath' \
  src/main/ipc/preflight-wsl-agent-detection.ts src/main/ipc/preflight-wsl-agent-detection.test.ts \
  src/shared/posix-version-manager-bin-dirs.ts

Repository: stablyai/orca

Length of output: 49764


🏁 Script executed:

#!/bin/bash
set -eu

root="$(mktemp -d)"
trap 'rm -rf "$root"' EXIT

mount_root="$root/win-drive"
project="$mount_root/project"
guest="$root/guest/bin"
mkdir -p "$project" "$guest"

printf '#!/bin/sh\n' > "$project/claude"
printf '#!/bin/sh\n' > "$guest/claude"
chmod 755 "$project/claude" "$guest/claude"

run_lookup() {
  local path_value="$1"
  env PATH="$path_value" /bin/sh -c '
    _orca_win_mounts="$1"
    _orca_lookup_command=claude
    resolved=
    _orca_lookup_remaining=${PATH-}
    while :; do
      case "$_orca_lookup_remaining" in
        *:*)
          _orca_lookup_component=${_orca_lookup_remaining%%:*}
          _orca_lookup_remaining=${_orca_lookup_remaining#*:}
          _orca_lookup_has_more=1
          ;;
        *)
          _orca_lookup_component=$_orca_lookup_remaining
          _orca_lookup_has_more=
          ;;
      esac
      for _orca_win_mount in $_orca_win_mounts; do
        case "$_orca_lookup_component/" in
          "$_orca_win_mount"/*) _orca_lookup_component= ;;
        esac
      done
      if [ -z "$_orca_lookup_component" ]; then
        [ -n "$_orca_lookup_has_more" ] || break
        continue
      fi
      [ -n "$_orca_lookup_component" ] || _orca_lookup_component=.
      case "$_orca_lookup_component" in
        /*) _orca_lookup_candidate=$_orca_lookup_component/$_orca_lookup_command ;;
        *) _orca_lookup_candidate=${PWD%/}/$_orca_lookup_component/$_orca_lookup_command ;;
      esac
      if [ -x "$_orca_lookup_candidate" ] && [ ! -d "$_orca_lookup_candidate" ]; then
        resolved=$_orca_lookup_candidate
        break
      fi
      [ -n "$_orca_lookup_has_more" ] || break
    done
    printf "%s\n" "$resolved"
  ' sh "$mount_root"
}

printf '%s\n' '--- empty component from PWD inside custom mount ---'
(cd "$project" && run_lookup ":$guest")
printf '%s\n' '--- relative component from PWD at custom mount root ---'
(cd "$mount_root" && run_lookup "project:$guest")
printf '%s\n' '--- absolute mount component control ---'
(cd "$mount_root" && run_lookup "$project:$guest")

Repository: stablyai/orca

Length of output: 421


🏁 Script executed:

#!/bin/bash
set -eu

root="$(mktemp -d)"
trap 'rm -rf "$root"' EXIT
mount_root="$root/win-drive"
project="$mount_root/project"
guest="$root/guest/bin"
mkdir -p "$project" "$guest"
printf '#!/bin/sh\n' > "$project/claude"
printf '#!/bin/sh\n' > "$guest/claude"
chmod 755 "$project/claude" "$guest/claude"

(cd "$project" && env PATH=":$guest" /bin/sh -c '
  printf "PWD=%s\nPATH=%s\n" "$PWD" "$PATH"
  _orca_win_mounts="$1"
  _orca_lookup_remaining=${PATH-}
  _orca_lookup_component=${_orca_lookup_remaining%%:*}
  printf "raw-component=<%s>\n" "$_orca_lookup_component"
  [ -n "$_orca_lookup_component" ] || _orca_lookup_component=.
  _orca_lookup_candidate=${PWD%/}/$_orca_lookup_component/claude
  printf "candidate=%s exists=%s executable=%s\n" \
    "$_orca_lookup_candidate" \
    "$(test -e "$_orca_lookup_candidate"; echo "$?")" \
    "$(test -x "$_orca_lookup_candidate"; echo "$?")"
  printf "mount=%s\n" "$_orca_win_mounts"
  case "$_orca_lookup_component/" in
    "$_orca_win_mounts"/*) echo "raw mount match" ;;
    *) echo "raw mount miss" ;;
  esac
  if [ -x "$_orca_lookup_candidate" ] && [ ! -d "$_orca_lookup_candidate" ]; then
    printf "selected=%s\n" "$_orca_lookup_candidate"
  fi
' sh "$mount_root")

Repository: stablyai/orca

Length of output: 432


Normalize relative PATH components before mount filtering.

A relative component can resolve inside a Windows mount after the raw component check. For example, with PWD under a configurable mount root and PATH=project:/guest/bin, project/claude is selected from the Windows mount. Its custom-root, extensionless path passes the fallback filter and is reported as a guest installation. Resolve relative components against PWD before comparing them with mount paths, and add a regression test.

…dows path

The name-based check could veto a path the walk had deliberately kept. /mnt/d
is a perfectly ordinary Linux mount, so a guest binary there was resolved
correctly by the walk and then discarded by its name -- the #9725 false
negative, reintroduced by the belt-and-braces net I added "just in case". And
if awk were missing, the name rule became the only rule, which is precisely
the failure it was supposed to backstop.

The walk skips components the guest itself reports as drvfs/9p/virtiofs. That
is authoritative. Without a mount table we now degrade to main's behaviour (the
old false positive) rather than inventing a new false negative.

Net: one predicate, three fixtures and an import deleted.
nwparker added a commit that referenced this pull request Aug 23, 2026
…ult (#16043)

Three bugs in one screen, reported in #15256 with a diff of the user's
orca-data.json showing defaultTuiAgent going from "claude" to null.

1. The Auto pill's handler writes null, and it was rendered as the ACTIVE
   choice whenever the stored agent was merely not detected right now. So the
   pill that already looked selected was destructive: one click erased the
   setting, and a later successful detection did not bring it back. Auto is now
   active only when null is actually stored. Detection is a transient fact; the
   stored value is not, and this control reports the stored value.

2. With zero agents detected there were no agent pills at all, so the stored
   choice was both invisible and unrecoverable -- nothing to click to put it
   back. The stored agent is now always offered, labelled as saved but not
   currently detected.

3. Refresh lived inside the Installed section, which only renders when at least
   one agent was found, so the only retry control vanished in exactly the state
   that needs it. An empty result now renders its own Refresh.

This matters more now than when it was filed: #16028 makes WSL detection
legitimately return an empty set on machines where the only agent was a Windows
binary reached through interop, so the empty path is about to get more traffic.

Each of the three tests was verified to fail with its own fix reverted.
@nwparker
nwparker merged commit 92315c4 into main Aug 23, 2026
47 checks passed
@nwparker
nwparker deleted the nwparker/wsl-interop-false-positive branch August 23, 2026 07:57
paidaxingyo666 pushed a commit to paidaxingyo666/Manta that referenced this pull request Aug 23, 2026
…ult (stablyai#16043)

Three bugs in one screen, reported in stablyai#15256 with a diff of the user's
orca-data.json showing defaultTuiAgent going from "claude" to null.

1. The Auto pill's handler writes null, and it was rendered as the ACTIVE
   choice whenever the stored agent was merely not detected right now. So the
   pill that already looked selected was destructive: one click erased the
   setting, and a later successful detection did not bring it back. Auto is now
   active only when null is actually stored. Detection is a transient fact; the
   stored value is not, and this control reports the stored value.

2. With zero agents detected there were no agent pills at all, so the stored
   choice was both invisible and unrecoverable -- nothing to click to put it
   back. The stored agent is now always offered, labelled as saved but not
   currently detected.

3. Refresh lived inside the Installed section, which only renders when at least
   one agent was found, so the only retry control vanished in exactly the state
   that needs it. An empty result now renders its own Refresh.

This matters more now than when it was filed: stablyai#16028 makes WSL detection
legitimately return an empty set on machines where the only agent was a Windows
binary reached through interop, so the empty path is about to get more traffic.

Each of the three tests was verified to fail with its own fix reverted.

(cherry picked from commit 0e9f02b)
paidaxingyo666 pushed a commit to paidaxingyo666/Manta that referenced this pull request Aug 23, 2026
… as a WSL install (stablyai#16028)

* fix(preflight): do not count a Windows binary reached through interop as a WSL install

WSL appends the Windows PATH to the guest PATH by default, so on a distro with
no guest `claude`, `command -v claude` resolves to
`/mnt/c/Users/me/.../claude.exe`. That path is POSIX-absolute, so the existing
absolute-path check accepted it and preflight reported the agent as installed
in the distro.

That is worse than reporting it absent. Absent tells the user to install it; a
false positive launches a Windows executable inside a Linux session, where it
sees Windows paths, no guest $HOME and none of the distro's config -- and the
failure surfaces later, somewhere less obvious.

Rejects `/mnt/<drive>/` and any `.exe`, case-insensitively. A genuine guest
install is unaffected.

* fix(preflight): skip Windows mounts during the PATH walk, not after it

The review caught this and it is the more important half of the fix.

Rejecting the interop path in TypeScript happens after the guest walk has
already stopped on it: the lookup breaks at the first executable, and the
version-manager fallback dirs are APPENDED, so they sit behind the Windows
entries WSL appends. A user with claude in nvm AND on the Windows PATH
therefore went from a false positive to "not installed" -- the exact stablyai#9725
population the fallback dirs exist to serve. Worse than the bug being fixed.

The lookup now takes `skipWindowsMountDirs` and skips those PATH components
mid-walk, so the guest binary behind the shadow is still found. Matched by
mount metadata from /proc/mounts (drvfs/9p/virtiofs), not by a `/mnt` name:
the automount root is configurable, and `/mnt` is an ordinary directory on a
Linux box. That also closes the custom-root hole the reviewers found in the
name-based predicate.

The TypeScript check stays as a secondary net for a mount the guest does not
report, with a comment saying why it must never be the thing that decides.

Proven with a real /bin/sh: a Windows `claude` ahead of an nvm `claude` on
PATH now resolves to the nvm one.

Credit: review counsel, and community PR stablyai#12794 (spfcraze), which proposed
this shape first.

* fix(preflight): let the mount table be the only word on what is a Windows path

The name-based check could veto a path the walk had deliberately kept. /mnt/d
is a perfectly ordinary Linux mount, so a guest binary there was resolved
correctly by the walk and then discarded by its name -- the stablyai#9725 false
negative, reintroduced by the belt-and-braces net I added "just in case". And
if awk were missing, the name rule became the only rule, which is precisely
the failure it was supposed to backstop.

The walk skips components the guest itself reports as drvfs/9p/virtiofs. That
is authoritative. Without a mount table we now degrade to main's behaviour (the
old false positive) rather than inventing a new false negative.

Net: one predicate, three fixtures and an import deleted.
(cherry picked from commit 92315c4)
CodeHourra pushed a commit to CodeHourra/orca that referenced this pull request Aug 23, 2026
…ult (stablyai#16043)

Three bugs in one screen, reported in stablyai#15256 with a diff of the user's
orca-data.json showing defaultTuiAgent going from "claude" to null.

1. The Auto pill's handler writes null, and it was rendered as the ACTIVE
   choice whenever the stored agent was merely not detected right now. So the
   pill that already looked selected was destructive: one click erased the
   setting, and a later successful detection did not bring it back. Auto is now
   active only when null is actually stored. Detection is a transient fact; the
   stored value is not, and this control reports the stored value.

2. With zero agents detected there were no agent pills at all, so the stored
   choice was both invisible and unrecoverable -- nothing to click to put it
   back. The stored agent is now always offered, labelled as saved but not
   currently detected.

3. Refresh lived inside the Installed section, which only renders when at least
   one agent was found, so the only retry control vanished in exactly the state
   that needs it. An empty result now renders its own Refresh.

This matters more now than when it was filed: stablyai#16028 makes WSL detection
legitimately return an empty set on machines where the only agent was a Windows
binary reached through interop, so the empty path is about to get more traffic.

Each of the three tests was verified to fail with its own fix reverted.
CodeHourra pushed a commit to CodeHourra/orca that referenced this pull request Aug 23, 2026
… as a WSL install (stablyai#16028)

* fix(preflight): do not count a Windows binary reached through interop as a WSL install

WSL appends the Windows PATH to the guest PATH by default, so on a distro with
no guest `claude`, `command -v claude` resolves to
`/mnt/c/Users/me/.../claude.exe`. That path is POSIX-absolute, so the existing
absolute-path check accepted it and preflight reported the agent as installed
in the distro.

That is worse than reporting it absent. Absent tells the user to install it; a
false positive launches a Windows executable inside a Linux session, where it
sees Windows paths, no guest $HOME and none of the distro's config -- and the
failure surfaces later, somewhere less obvious.

Rejects `/mnt/<drive>/` and any `.exe`, case-insensitively. A genuine guest
install is unaffected.

* fix(preflight): skip Windows mounts during the PATH walk, not after it

The review caught this and it is the more important half of the fix.

Rejecting the interop path in TypeScript happens after the guest walk has
already stopped on it: the lookup breaks at the first executable, and the
version-manager fallback dirs are APPENDED, so they sit behind the Windows
entries WSL appends. A user with claude in nvm AND on the Windows PATH
therefore went from a false positive to "not installed" -- the exact stablyai#9725
population the fallback dirs exist to serve. Worse than the bug being fixed.

The lookup now takes `skipWindowsMountDirs` and skips those PATH components
mid-walk, so the guest binary behind the shadow is still found. Matched by
mount metadata from /proc/mounts (drvfs/9p/virtiofs), not by a `/mnt` name:
the automount root is configurable, and `/mnt` is an ordinary directory on a
Linux box. That also closes the custom-root hole the reviewers found in the
name-based predicate.

The TypeScript check stays as a secondary net for a mount the guest does not
report, with a comment saying why it must never be the thing that decides.

Proven with a real /bin/sh: a Windows `claude` ahead of an nvm `claude` on
PATH now resolves to the nvm one.

Credit: review counsel, and community PR stablyai#12794 (spfcraze), which proposed
this shape first.

* fix(preflight): let the mount table be the only word on what is a Windows path

The name-based check could veto a path the walk had deliberately kept. /mnt/d
is a perfectly ordinary Linux mount, so a guest binary there was resolved
correctly by the walk and then discarded by its name -- the stablyai#9725 false
negative, reintroduced by the belt-and-braces net I added "just in case". And
if awk were missing, the name rule became the only rule, which is precisely
the failure it was supposed to backstop.

The walk skips components the guest itself reports as drvfs/9p/virtiofs. That
is authoritative. Without a mount table we now degrade to main's behaviour (the
old false positive) rather than inventing a new false negative.

Net: one predicate, three fixtures and an import deleted.
dallascrilley pushed a commit to dallascrilley/orca that referenced this pull request Aug 27, 2026
…ult (stablyai#16043)

Three bugs in one screen, reported in stablyai#15256 with a diff of the user's
orca-data.json showing defaultTuiAgent going from "claude" to null.

1. The Auto pill's handler writes null, and it was rendered as the ACTIVE
   choice whenever the stored agent was merely not detected right now. So the
   pill that already looked selected was destructive: one click erased the
   setting, and a later successful detection did not bring it back. Auto is now
   active only when null is actually stored. Detection is a transient fact; the
   stored value is not, and this control reports the stored value.

2. With zero agents detected there were no agent pills at all, so the stored
   choice was both invisible and unrecoverable -- nothing to click to put it
   back. The stored agent is now always offered, labelled as saved but not
   currently detected.

3. Refresh lived inside the Installed section, which only renders when at least
   one agent was found, so the only retry control vanished in exactly the state
   that needs it. An empty result now renders its own Refresh.

This matters more now than when it was filed: stablyai#16028 makes WSL detection
legitimately return an empty set on machines where the only agent was a Windows
binary reached through interop, so the empty path is about to get more traffic.

Each of the three tests was verified to fail with its own fix reverted.
dallascrilley pushed a commit to dallascrilley/orca that referenced this pull request Aug 27, 2026
… as a WSL install (stablyai#16028)

* fix(preflight): do not count a Windows binary reached through interop as a WSL install

WSL appends the Windows PATH to the guest PATH by default, so on a distro with
no guest `claude`, `command -v claude` resolves to
`/mnt/c/Users/me/.../claude.exe`. That path is POSIX-absolute, so the existing
absolute-path check accepted it and preflight reported the agent as installed
in the distro.

That is worse than reporting it absent. Absent tells the user to install it; a
false positive launches a Windows executable inside a Linux session, where it
sees Windows paths, no guest $HOME and none of the distro's config -- and the
failure surfaces later, somewhere less obvious.

Rejects `/mnt/<drive>/` and any `.exe`, case-insensitively. A genuine guest
install is unaffected.

* fix(preflight): skip Windows mounts during the PATH walk, not after it

The review caught this and it is the more important half of the fix.

Rejecting the interop path in TypeScript happens after the guest walk has
already stopped on it: the lookup breaks at the first executable, and the
version-manager fallback dirs are APPENDED, so they sit behind the Windows
entries WSL appends. A user with claude in nvm AND on the Windows PATH
therefore went from a false positive to "not installed" -- the exact stablyai#9725
population the fallback dirs exist to serve. Worse than the bug being fixed.

The lookup now takes `skipWindowsMountDirs` and skips those PATH components
mid-walk, so the guest binary behind the shadow is still found. Matched by
mount metadata from /proc/mounts (drvfs/9p/virtiofs), not by a `/mnt` name:
the automount root is configurable, and `/mnt` is an ordinary directory on a
Linux box. That also closes the custom-root hole the reviewers found in the
name-based predicate.

The TypeScript check stays as a secondary net for a mount the guest does not
report, with a comment saying why it must never be the thing that decides.

Proven with a real /bin/sh: a Windows `claude` ahead of an nvm `claude` on
PATH now resolves to the nvm one.

Credit: review counsel, and community PR stablyai#12794 (spfcraze), which proposed
this shape first.

* fix(preflight): let the mount table be the only word on what is a Windows path

The name-based check could veto a path the walk had deliberately kept. /mnt/d
is a perfectly ordinary Linux mount, so a guest binary there was resolved
correctly by the walk and then discarded by its name -- the stablyai#9725 false
negative, reintroduced by the belt-and-braces net I added "just in case". And
if awk were missing, the name rule became the only rule, which is precisely
the failure it was supposed to backstop.

The walk skips components the guest itself reports as drvfs/9p/virtiofs. That
is authoritative. Without a mount table we now degrade to main's behaviour (the
old false positive) rather than inventing a new false negative.

Net: one predicate, three fixtures and an import deleted.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…ult (stablyai#16043)

Three bugs in one screen, reported in stablyai#15256 with a diff of the user's
orca-data.json showing defaultTuiAgent going from "claude" to null.

1. The Auto pill's handler writes null, and it was rendered as the ACTIVE
   choice whenever the stored agent was merely not detected right now. So the
   pill that already looked selected was destructive: one click erased the
   setting, and a later successful detection did not bring it back. Auto is now
   active only when null is actually stored. Detection is a transient fact; the
   stored value is not, and this control reports the stored value.

2. With zero agents detected there were no agent pills at all, so the stored
   choice was both invisible and unrecoverable -- nothing to click to put it
   back. The stored agent is now always offered, labelled as saved but not
   currently detected.

3. Refresh lived inside the Installed section, which only renders when at least
   one agent was found, so the only retry control vanished in exactly the state
   that needs it. An empty result now renders its own Refresh.

This matters more now than when it was filed: stablyai#16028 makes WSL detection
legitimately return an empty set on machines where the only agent was a Windows
binary reached through interop, so the empty path is about to get more traffic.

Each of the three tests was verified to fail with its own fix reverted.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
… as a WSL install (stablyai#16028)

* fix(preflight): do not count a Windows binary reached through interop as a WSL install

WSL appends the Windows PATH to the guest PATH by default, so on a distro with
no guest `claude`, `command -v claude` resolves to
`/mnt/c/Users/me/.../claude.exe`. That path is POSIX-absolute, so the existing
absolute-path check accepted it and preflight reported the agent as installed
in the distro.

That is worse than reporting it absent. Absent tells the user to install it; a
false positive launches a Windows executable inside a Linux session, where it
sees Windows paths, no guest $HOME and none of the distro's config -- and the
failure surfaces later, somewhere less obvious.

Rejects `/mnt/<drive>/` and any `.exe`, case-insensitively. A genuine guest
install is unaffected.

* fix(preflight): skip Windows mounts during the PATH walk, not after it

The review caught this and it is the more important half of the fix.

Rejecting the interop path in TypeScript happens after the guest walk has
already stopped on it: the lookup breaks at the first executable, and the
version-manager fallback dirs are APPENDED, so they sit behind the Windows
entries WSL appends. A user with claude in nvm AND on the Windows PATH
therefore went from a false positive to "not installed" -- the exact stablyai#9725
population the fallback dirs exist to serve. Worse than the bug being fixed.

The lookup now takes `skipWindowsMountDirs` and skips those PATH components
mid-walk, so the guest binary behind the shadow is still found. Matched by
mount metadata from /proc/mounts (drvfs/9p/virtiofs), not by a `/mnt` name:
the automount root is configurable, and `/mnt` is an ordinary directory on a
Linux box. That also closes the custom-root hole the reviewers found in the
name-based predicate.

The TypeScript check stays as a secondary net for a mount the guest does not
report, with a comment saying why it must never be the thing that decides.

Proven with a real /bin/sh: a Windows `claude` ahead of an nvm `claude` on
PATH now resolves to the nvm one.

Credit: review counsel, and community PR stablyai#12794 (spfcraze), which proposed
this shape first.

* fix(preflight): let the mount table be the only word on what is a Windows path

The name-based check could veto a path the walk had deliberately kept. /mnt/d
is a perfectly ordinary Linux mount, so a guest binary there was resolved
correctly by the walk and then discarded by its name -- the stablyai#9725 false
negative, reintroduced by the belt-and-braces net I added "just in case". And
if awk were missing, the name rule became the only rule, which is precisely
the failure it was supposed to backstop.

The walk skips components the guest itself reports as drvfs/9p/virtiofs. That
is authoritative. Without a mount table we now degrade to main's behaviour (the
old false positive) rather than inventing a new false negative.

Net: one predicate, three fixtures and an import deleted.
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