Repository navigation
fix(preflight): resolve WSL/SSH agent paths past shell aliases - #7867
Conversation
LeanCTX and similar tools wrap claude/codex as interactive shell aliases. command -v then returns alias text, which fails absolute-path detection and hides installed agents (stablyai#7816). Prefer bash type -P, then zsh type -p, then command -v for dash/sh fallback in WSL agent discovery, WSL isCommandOnPath, and remote relay probes.
Require non-empty results between type -P, type -p, and command -v so bash type -p empty success cannot skip later lookups.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughA shared POSIX executable-path lookup script was added with shell-variable validation, literal quoting, explicit-path handling, and direct PATH scanning. WSL agent detection, relay preflight probes, and WSL command availability checks now use this script and emit or parse resolved absolute paths through prefixed output. Tests cover shell behavior, PATH edge cases, quoting and validation, WSL integration, probe generation, and sentinel-based parsing. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
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 |
Jinwoo-H
left a comment
There was a problem hiding this comment.
Thanks for the focused fix. I tightened and validated the resolver during review:
- WSL and SSH now scan PATH directly, so aliases, functions, and shell-specific type behavior cannot hide installed agents.
- Added bash, zsh, dash, sh, and Windows-to-WSL coverage, including readonly functions and shell startup output.
- Verified Claude and Codex detection in Orca's WSL flow and through a fresh Linux SSH relay.
- Typecheck, lint, relay build, and focused tests pass.
Clean auto-merge, no conflicts (109 files, +7490 from main). Brought in: - Codex WSL runtime status hooks (#7969); WSL/SSH agent path resolution past shell aliases (#7867); WSL source-control path separators (#7966); WSL GitLab-auth wake fix (#7967); WSL Codex usage RPC refresh (#7567/#7658) - Improve workspace cleanup list (#7053) + background removal - mobile: per-host connection log + Tailscale wedge recovery (#7984/#7980), wake slept agents on mobile worktree open (#7906) - Harden layout validation, watcher lifecycle, connection robustness (#7924) - Disable experimental worktree card style by default (#7977) Perf-branch structure preserved (clean auto-merge). typecheck 0 errors; lint 0 errors. CI is the release gate (local runs skipped per env lag). Co-authored-by: Orca <[email protected]>
…yai#7867) * fix(preflight): resolve WSL/SSH agent paths past shell aliases LeanCTX and similar tools wrap claude/codex as interactive shell aliases. command -v then returns alias text, which fails absolute-path detection and hides installed agents (stablyai#7816). Prefer bash type -P, then zsh type -p, then command -v for dash/sh fallback in WSL agent discovery, WSL isCommandOnPath, and remote relay probes. * fix(preflight): harden alias-safe PATH lookup chain Require non-empty results between type -P, type -p, and command -v so bash type -p empty success cannot skip later lookups. * fix(preflight): resolve agent executables directly from PATH --------- Co-authored-by: Jinwoo Hong <[email protected]>
Summary
claude/codexwere shell aliases (e.g. LeanCTX), becausecommand -vreturned alias text and absolute-path detection dropped them.type -P, then zshtype -p, thencommand -vfor dash/sh.isCommandOnPathand remote relay POSIX lookup; usepath.posix.isAbsolutefor WSL paths on Windows hosts.Review notes
type -Palone is bash-only; zsh needs lowercasetype -p. Final chain istype -P || type -p || command -v.command -v.command -v(separate syntax path; WSL probes do not run under fish).Test plan
pnpm exec vitest run --config config/vitest.config.ts src/main/ipc/preflight-wsl-agent-detection.test.ts src/relay/preflight-handler.test.ts src/main/ipc/preflight.test.ts(65 passed)claude/codex, refresh agent detection and confirm both appearAI code review summary
where; local POSIX useswhich; relay POSIX probes updated; fish unchanged.buildShCommandLookupScriptuses the same portable chain under trusted login shells.