千里不再 on Discord: Pi installed in WSL wasn't detected. The WSL probe
runs `sh -lc`, which reads ~/.profile but not ~/.bashrc, where fnm's
installer puts its PATH, so `command -v pi` missed it and wslbin had no
fnm folder. A Pi not run yet has no ~/.pi either, so nothing found it
(and for fnm users who had run it, its version was lost). Also, WSL
appends Windows' PATH, so a Pi npm installed on Windows answered
`command -v pi` with a /mnt/c path; that stopped the `|| wslbin`
fallback and parseProbe then dropped it as a Windows command (#406), so
the distro's own Pi was hidden.
Now wslcmd takes `command -v` only when it isn't on a Windows drive
(/mnt/X or any drive /proc/mounts lists), else walks PATH past Windows
drives, else wslbin. wslbin gains the folders proc.UserBinDirs has here:
fnm (aliases/default, then the highest version; FNM_DIR,
~/.local/share/fnm, ~/.fnm), mise's installs (highest), ~/.npmrc's
prefix, ~/.npm/bin, cargo, deno, Homebrew. Every WSL kind goes through
it, not only Pi.
Run:
- mote: GOOS=windows/linux/darwin go vet ./internal/agent; go test
-run "TestWSL|TestOmo|TestPi" ./internal/agent ok. gofmt -l clean.
- wsl-run (magpie-desktop, Ubuntu 24.04): same tests ok.
- Real WSL: in magpie-desktop, a scratch HOME with the real fnm
installer, `fnm install 22`, `npm i -g @mariozechner/pi-coding-agent`
(pi 0.73.1), never run. Old probe: no bin:pi. New probe:
`bin:pi .../fnm/aliases/default/bin/pi`, `ver:pi 0.73.1`, pi@wsl
listed; a fnm codex was found past a /mnt/c one. Real home still finds
codex, pi and claude (3.9s). Through proc.CommandContext on Windows
(win-run) with Detect agents in WSL on, the probe runs (#4872 gates
only when it is off).
Broken by hand: origin/main's wsl.go with the new tests: all four
subtests of TestWSLProbeFindsNodeManagersBins and
TestWSLProbeLooksPastWindowsCommand red.
Not tried: the reporter's own install (method unknown; fnm with a
never-run Pi is the case reproduced). Asking bash -i for ~/.bashrc's
PATH was tried and dropped: under timeout(1) an interactive bash stops
itself (state T) on WSL and outlived its timeout.
Reported-by: 千里不再 (Discord)
OmO updates itself: magpie runs `omo update`, and omo-ai 5.1.32's
updateTarget (bin/lib/package-paths.js) then runs a bare
`npm i -g omo-ai@<v>` (or `bun add -g` for a bun install). The
updater for a self-updating CLI had no path, so that npm was whichever
came first on magpie's PATH. With OmO installed under an fnm/nvm node
and a system npm in /usr/local/bin, the update went to the system
prefix (or failed on its permissions), and the omo the agent runs
stayed old.
howInstalled's self branch now gives the updater the bin dir of the
package manager that holds the CLI (selfPath): for an npm install, the
prefix's bin that fromNodeModules already finds for npm-installed CLIs;
for bun or pnpm, the dir of that manager's binary. That dir goes first
on the update's PATH, as it does for npm updates.
Run: TestOmoUpdateTakesItsOwnNpm (new: a fake system npm that fails and
an fnm prefix's npm that records; on the old code the update ran the
system npm and failed with exit status 1), TestOmo*, TestHowInstalled*,
go test ./internal/agent (ok in 1783s at load average ~100;
a 15m timeout ran out under that load, on no failure),
gofmt -l, GOOS=linux and GOOS=windows go vet -tags nogui ./internal/agent.
Both tests check that the agent is not detected before its folder exists.
Detected also looks for the agent's command on PATH, so an omo or jcode
installed on the host made the tests fail. Both tests now run with an
empty temp dir as PATH. The TestOmo line is the reporter's.
To find every test with this problem, the whole agent package was run
with a fake executable on PATH for each agent id and Bin (145 names):
- TestOmo and TestJcodeHome failed.
- TestInstallWithoutNodeStopsWhenTheDownloadFails also failed, but only
because the fake curl stood in for the real one. That is not an agent
detection.
With this change, both tests pass with the fakes on PATH. go test -tags
nogui ./internal/agent/ is green, and gofmt -l and go vet are clean on
darwin, linux and windows.