Repository navigation
Description
Problem
WSL probeDistro decides whether a distro has bash and curl by comparing the entire login-shell output to exactly "yes". Any banner, MOTD, or .profile echo printed by the login shell makes a distro that has both tools report hasBash: false / hasCurl: false.
packages/gui-extensions/src/wsl/runtime.ts:328-337 (on main ebd31d02d3):
const [bash, curl] = await Promise.all([
runWslSh("command -v bash >/dev/null && printf yes || printf no", name, opts),
runWslSh("command -v curl >/dev/null && printf yes || printf no", name, opts),
])
return {
...
hasBash: bash.code === 0 && summarize(bash.stdout) === "yes",
hasCurl: curl.code === 0 && summarize(curl.stdout) === "yes",
...
}Both probes run through runWslSh (runtime.ts:223-224), which is sh -lc — a login shell, so profile/banner output on stdout is expected, not exotic. And summarize (runtime.ts:57-64) does not drop it: it trims each line, drops empty lines, and joins the rest with \n, preserving every banner line.
Reproduction (the exact summarize logic run under node)
| Probe stdout | summarize(stdout) |
hasBash |
|---|---|---|
"yes" |
"yes" |
true ✅ |
"Welcome to Ubuntu 24.04 LTS\nyes" |
"Welcome to Ubuntu 24.04 LTS\nyes" |
false ❌ |
"Last login: Thu Oct 22 …\n * Documentation: https://help.ubuntu.com\nyes" |
all three lines joined | false ❌ |
"no" |
"no" |
false ✅ |
Impact
packages/gui-extensions/src/wsl/model.ts:60—wslDistroReadyrequiresprobe.hasBash && probe.hasCurl, so the distro can never become ready and no server can be added for it.packages/gui-extensions/src/wsl/model.ts:174— the onboarding status shows the "missing tools" warning for a distro whose tools are installed.packages/gui-extensions/src/wsl/servers.ts:414-415—distroProbeReadygates the opencode CLI check (inspectCli), so the CLI check never runs for such a distro either.
Relationship to #265
#265 covers the sibling login-shell parsers in the same transport — parseVersion in both remote-cli.ts copies and WSL resolveCli. Its acceptance criteria do not mention probeDistro; this is the remaining exact-match probe in wsl/runtime.ts (verified: the only two summarize(...) === "yes" sites in the repo are lines 336-337, and no copy of this probe exists in developing-today/code, developing-today/openchamber, or dezren39/nix). Fixing it alongside #265 is welcome, but it should not be lost if #265 closes without it.
Acceptance criteria
-
probeDistro's bash/curl verdicts are read from the probe script's own answer line (the final non-empty line the script prints,yesorno), not from whole-output equality — banner/MOTD/profile lines before it must not change the verdict. - A banner line that itself contains the word
yesmust not produce a false positive when the script's answer isno(read the answer line, not any line). - New unit tests cover: clean
yes, cleanno, banner-before-yes→true, banner-before-no→false. (The probe verdict logic will likely need to be a pure exported helper to be testable, ascreateWslRuntimespawns realwsl.exe.) - Clean-output behaviour is unchanged: a distro whose login shell prints nothing extra gets the same probe result as today.
Filed by new-issue-creator after verifying on main ebd31d02d3 (file:line reads, node repro of the exact summarize logic, dedup searches for probeDistro / hasBash / hasCurl and a full read of #265's acceptance criteria returned no covering issue).
Activity
docs(roadmap): record the #265 and #269 completions in Done (#273) (#274