fix(browser): honor POSIX PLANNOTATOR_BROWSER under WSL and warn on launch failure - #1494
Conversation
|
Reviewed in depth before merge: mapped the full browser-launch matrix on both runtimes and confirmed exactly one cell changes execution (WSL + POSIX PLANNOTATOR_BROWSER - the #1472 silent no-op, now actually invoked with the resolved absolute path), the new failure warning can never break a session (warn then IPC fallback then the URL lifeline; no exit paths), WSL detection is untouched so plain-Linux false-positive risk is unchanged, and revert-verification at three granularities confirms the tests genuinely guard both halves. The Pi-side truthful |
Problem
With
PLANNOTATOR_BROWSERexplicitly set under WSL, the value was routed throughcmd.exe /c startregardless of what it named, so a Linux path or script could never launch; the failure was swallowed by a barecatchand the ready output only printed the URL. A headless (agent-launched, no TTY) session then had every observable signal reporting success while the reviewer was never shown anything. The Pi runtime had the same branch and additionally reportedopened: trueon spawn errors. #1472Change
*.exe,C:\…,/mnt/<drive>/…) keep thecmd.exeroute; POSIX paths (/…,./…,../…) and bare names that resolve to an executable on the Linux PATH are executed directly — also under WSL.$resolves bare command names against the PATH captured at process startup, so a bare name would otherwise be invisible to the shell. The end-to-end test pins this.opened: falseon spawn errors instead of claiming success.Verification
Bun 1.3.14, disposable HOME:
packages/server/browser.test.ts+apps/pi-extension/server/network.test.ts→ 49 pass / 0 fail:chrome.exestill routed through acmd.exeshim (end-to-end in the Pi runtime, whosenode:child_processspawn honors a mutated PATH on every Bun version; the Bun-side resolver tests pin the same routing decision, since acmd.exeshim cannot be spawned through Bun 1.3's$on a non-Windows host);opened: falsewith the fallback intact.On Bun 1.4.2 the only failures in these two files are the three pre-existing port-selection listener-count tests (baseline-verified before this change).
Fixes #1472