Skip to content

fix(browser): honor POSIX PLANNOTATOR_BROWSER under WSL and warn on launch failure - #1494

Merged
backnotprop merged 1 commit into
backnotprop:mainfrom
FNDEVVE:fix/wsl-browser-launch
Sep 10, 2026
Merged

fix(browser): honor POSIX PLANNOTATOR_BROWSER under WSL and warn on launch failure#1494
backnotprop merged 1 commit into
backnotprop:mainfrom
FNDEVVE:fix/wsl-browser-launch

Conversation

@FNDEVVE

@FNDEVVE FNDEVVE commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Problem

With PLANNOTATOR_BROWSER explicitly set under WSL, the value was routed through cmd.exe /c start regardless of what it named, so a Linux path or script could never launch; the failure was swallowed by a bare catch and 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 reported opened: true on spawn errors. #1472

Change

  • Both runtimes classify the configured value first: Windows targets (*.exe, C:\…, /mnt/<drive>/…) keep the cmd.exe route; POSIX paths (/…, ./…, ../…) and bare names that resolve to an executable on the Linux PATH are executed directly — also under WSL.
  • The Bun runtime spawns the resolved absolute path: Bun 1.3's $ 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.
  • When an explicitly configured browser fails, one stderr line names the executable and the error before the existing fallback (VS Code IPC / URL print) runs. The Pi runtime returns opened: false on spawn errors instead of claiming success.
  • Non-WSL Linux and macOS paths are unchanged; the macOS branch recently fixed by fix(pi-extension): run script/executable PLANNOTATOR_BROWSER paths directly on macOS #1429 is untouched.

Verification

Bun 1.3.14, disposable HOME: packages/server/browser.test.ts + apps/pi-extension/server/network.test.ts49 pass / 0 fail:

  • direct spawn of a POSIX path and of a bare PATH name under mocked WSL, asserting the target script received the URL as its argument;
  • chrome.exe still routed through a cmd.exe shim (end-to-end in the Pi runtime, whose node:child_process spawn honors a mutated PATH on every Bun version; the Bun-side resolver tests pin the same routing decision, since a cmd.exe shim cannot be spawned through Bun 1.3's $ on a non-Windows host);
  • a failing executable warns on stderr naming itself, and a missing one yields opened: false with 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

@backnotprop

Copy link
Copy Markdown
Owner

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 opened flag is a nice bonus - headless Pi users now get the open-this-URL notification instead of silent false success. Two cosmetic notes for a rainy day: the /mnt/ prefix classifier is broader than its comment (a /^/mnt/A-Za-z/ tighten would match it), and a non-daemonizing browser script blocks openBrowser until exit (pre-existing pattern). Merging.

@backnotprop
backnotprop merged commit ba1d520 into backnotprop:main Sep 10, 2026
24 checks passed
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.

PLANNOTATOR_BROWSER never invoked, and nothing says so

2 participants