GeezerVison is showing github.com — fix(gui-extensions): WSL discovery still returns a banner line ending in the managed suffix when discoverScript prints nothing — frame the discovery output · Issue #345 · developing-today-forks/opencode
fix(gui-extensions): WSL discovery still returns a banner line ending in the managed suffix when discoverScript prints nothing — frame the discovery output #345Labels app/gui-extensionsPackage: gui-extensions (pkgs/ or apps/ in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label) DescriptionFinding
PR #342 (#342, commit 12cd6af1b899c15ba6c0b5ee3468cce4ff72f67b, merge a97969cdc039af22387417f20cd99e5844363465) narrowed parseDiscoveredCli to lines ending in /.opencode/bin/opencode. That closes #340 for banner paths outside the managed location, but the residual case is the same shape as #340: when discoverScript() prints nothing — the managed CLI is not installed — a login-shell banner/MOTD/profile line that itself ends in the managed suffix is still returned as the discovered CLI. The parser's own comment (packages/gui-extensions/src/wsl/runtime.ts:88-100) states the underlying problem: "No ordering rule can tell such a banner line from the script's own line when the script prints nothing". A suffix rule has the same limitation — it can only distinguish banner lines that do not look exactly like the one path the script can print.
Evidence (verified on current main b82506e82bd2b02ef0a3b5610a5b2986320e4993)
packages/gui-extensions/src/wsl/runtime.ts:100 (on main): .findLast((line) => line.startsWith("/") && line.endsWith("/.opencode/bin/opencode")) ?? null
packages/gui-extensions/src/wsl/remote-cli.ts:14-19 (on main): discoverScript() prints the path with printf '\n%s\n' "$cli" — a leading newline puts it on its own line, but there is no framing marker (unlike versionScript in the same file, which frames its output with OPENCODE_CLI_VERSION_BEGIN/END for exactly this reason, and unlike the SSH registration frame OPENCODE_SSH_REGISTRATION_BEGIN/END).
- Reproduction with the real functions and the real
discoverScript through sh, mirroring PR fix(gui-extensions): WSL discovery requires the managed CLI path suffix #342's own runDiscoverScriptWithoutCli harness (empty HOME = no CLI installed):
parseDiscoveredCli("/home/other/.opencode/bin/opencode\n") returns "/home/other/.opencode/bin/opencode" instead of null
- Real-script run, no CLI installed, preceding output
/home/other/.opencode/bin/opencode\n: parsed result is "/home/other/.opencode/bin/opencode"; with no preceding output the same harness correctly returns null.
- PR fix(gui-extensions): WSL discovery requires the managed CLI path suffix #342's new tests cover only banner paths that do not end in the managed suffix (
/opt/old-opencode/bin/opencode, /usr/local/bin/opencode, /opt/opencode — packages/gui-extensions/src/wsl/runtime.test.ts); no test covers a banner line ending in /.opencode/bin/opencode.
- Baseline this run: focused
bun test src/wsl/runtime.test.ts src/wsl/remote-cli.test.ts passes 20 / 1 skip / 0 fail on main, so this is an uncovered case, not a test regression.
Why it matters
resolveCli (runtime.ts:377) feeds inspectCli in packages/gui-extensions/src/wsl/servers.ts:92 (reports a CLI present and reads a version from the banner-named path) and startWslSidecar in packages/gui-extensions/src/wsl/sidecar.ts:31 — which throws error.opencodeNotInstalled only when discovery returns null, and otherwise execs the returned path as the server binary. A banner-advertised managed-suffix path (e.g. a profile/MOTD line naming another install location) therefore turns the not-installed case into a present-CLI report and an attempt to execute whatever binary sits at that banner-named path, instead of the clean not-installed flow. This is the remaining instance of the banner-invention class that #265/#272/#276 (parseVersion, fixed by framing), #334/#340 (this parser) have been closing one narrowing at a time; framing closes it for good rather than narrowing it further.
Scope: WSL only. The SSH discoverScript's output path is consumed inside the remote script itself ($cli), not parsed from stdout, and SSH registration output is already framed — no SSH change is implied. parseDiscoveredCli/discoverScript (WSL) exist only in this repo (grep of code/openchamber/nix clones: no hits) — no cross-repo port owed.
Acceptance criteria
-
discoverScript() frames its output (e.g. BEGIN/END markers on their own lines, following the versionScript pattern in the same file, including the marker-gluing cases fixed for the version frame), and parseDiscoveredCli accepts only a framed path.
- With no CLI installed, preceding login-shell output that is a line ending in
/.opencode/bin/opencode (including the exact $HOME/.opencode/bin/opencode spelling for a different/empty HOME) returns null — verified through the real discoverScript harness, terminated and unterminated preceding output.
- The real discovered path is still returned when it follows banner output, including banner output with no trailing newline.
- Ablation: with the parser/script change reverted, the new banner-suffix tests fail; restored, the focused wsl tests and the full gui-extensions suite pass, and package typecheck is clean.
Activitydeveloping-today-fleet commented on Nov 24, 2026
AUDIT-7 Lane 2 slice 3 — closing evidence. Verified against the issue body and merged implementation PR(s):
The issue had zero comments in the fresh pre-action read; this comment records the missing close evidence.
MetadataMetadataapp/gui-extensionsPackage: gui-extensions (pkgs/ or apps/ in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label) DevelopmentNo branches or pull requestsIssue actions
|