Repository navigation
fix(preflight): do not count a Windows binary reached through interop as a WSL install - #16028
Conversation
… 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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughWSL command lookup can skip Windows-mounted PATH directories identified from 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/main/ipc/preflight-wsl-agent-detection.ts (1)
68-81: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winShorten the interop-path explanation.
The comment includes a long failure narrative and implementation details. Keep a brief statement that WSL-mounted Windows paths and
.exeresolutions 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 winAdd a standalone uppercase
.EXEfixture.The
/MNT/D/tools/claude.EXEcase can pass because the mounted-path branch rejects it. Add a path such as/opt/weird/claude.EXEto 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
📒 Files selected for processing (2)
src/main/ipc/preflight-wsl-agent-detection.test.tssrc/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.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/shared/posix-command-path-lookup.ts (1)
8-19: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueReduce 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
📒 Files selected for processing (3)
src/main/ipc/preflight-wsl-agent-detection.test.tssrc/main/ipc/preflight-wsl-agent-detection.tssrc/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, |
There was a problem hiding this comment.
🎯 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 || trueRepository: 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 || trueRepository: 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.tsRepository: 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.
…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.
…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)
… 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)
…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.
… 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.
…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.
… 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.
…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.
… 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.
ELI5
WSL adds the Windows PATH to the Linux PATH by default. So on a distro with no
Linux
claudeinstalled, asking the distro "where is claude?" happily answerswith the Windows one:
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 andsomewhere less obvious than "not installed".
What changed
parseWslDetectedCommandsnow rejects a resolved path that is/mnt/<drive>/…or ends in
.exe, case-insensitively. One predicate, one call site.Proof of no regression
/home/alice/.nvm/versions/node/v20.1.0/bin/claude)is still detected — pinned by a new test.
/mntpath, an uppercase/MNT/D/…/claude.EXE, and a bare.exeoutside/mnt.with it restored they pass.
~/.local/bin,$HOMEwith aspace, directory-is-not-a-CLI, volta/asdf/fnm/mise) is unchanged and green.
src/main/ipcsuite: 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.