Repository navigation
[Repo Assist] fix(setup): accept hyphenated and localized WSL version labels in preflight - #666
Conversation
…flight wsl.exe on non-English Windows emits UTF-16LE output. After NUL-stripping, the label becomes 'WSL-Version:' (German) instead of 'WSL version:' (English). Localized systems can also emit e.g. 'Versión de WSL:' (Spanish). The previous regex only matched 'WSL\s+version:' so preflight-wsl would return a terminal failure even though wsl.exe reported a supported version. Fix: extend the regex to an alternation that covers: - 'WSL version:' (English, space-separated) - 'WSL-Version:' (German / NUL-stripped UTF-16 output) - 'Versión de WSL:' (Spanish localized) Add Theory regression tests covering all three forms plus a NUL-byte simulation test that encodes/strips UTF-16 bytes before parsing. Closes #661 Co-authored-by: Copilot <[email protected]>
|
Codex review: needs maintainer review before merge. Reviewed June 3, 2026, 1:41 PM ET / 17:41 UTC. Summary Reproducibility: yes. source inspection gives a high-confidence reproduction path: current main's parser requires Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the focused parser and regression-test fix after maintainer validation, so the linked setup bug is closed by the implementation rather than by stale cleanup. Do we have a high-confidence way to reproduce the issue? Yes, source inspection gives a high-confidence reproduction path: current main's parser requires Is this the best way to solve the issue? Yes. The PR solves the immediate bug at the parser boundary by keying on the stable WSL product token plus a same-line semantic version, while tests guard against adjacent component-version false positives. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against f839cf53aa0c. Label changesLabel justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
Avoid matching localized human-readable labels from wsl.exe --version. Instead, find the stable WSL product token on a line and parse the semantic version from that same line, while ignoring adjacent WSLg, Windows, and kernel version lines. Co-authored-by: Copilot <[email protected]>
Add regression data for the MessagePackageVersions labels from microsoft/WSL localization resources so the WSL version parser is exercised against every published locale. Co-authored-by: Copilot <[email protected]>
🤖 This is an automated pull request from Repo Assist, with follow-up maintainer updates.
Summary
Addresses #661 —
preflight-wslfails on non-English Windows even when WSL is installed and at a supported version.Root Cause
wsl.exe --versionreturns localized, human-readable text and can also emit UTF-16LE/NUL-interleaved output on some Windows builds. The old parser normalized NUL/BOM characters, but still required the English label shape:That failed for valid localized output such as:
So setup could report
WSL version output did not include a parseable WSL versioneven when WSL was installed, up to date, andwsl.exe --versionexited successfully.Fix
The parser no longer tries to match translated label text like
version,Version,Versión, etc.Instead,
WslInstallSupport.TryParseWslVersionnow:wsl.exe --versionoutput by line.WSLproduct token.WSLg,Windows, or kernel versions.This keeps the fix narrow while removing the localization dependency from the version-label words.
Locale Coverage
Added regression coverage using the upstream
microsoft/WSLlocalization resources:localization/strings/*/Resources.reswMessagePackageVersionsThe parser is also covered for:
Kernel,WSLg, andWindowscomponent versions.Verification
A contributor verified the PR fix on a Chinese-localized Windows install: #661 (comment)
They reported that setup successfully got through the wizard and connected to the gateway and chat.
Validation
Local validation completed on Windows:
Structured review also reported no accepted/actionable findings.
Notes / Trade-offs
Parsing
wsl.exe --versionremains less ideal than a locale-independent WSL API or capability probe. However, the current implementation now depends on the stable product tokenWSLplus a semantic version, not on translated human-readable label text.Longer term, the cleanest design may be to make the version check non-blocking and let the actual
wsl --install --distribution ... --name ... --location ...command validate capability directly, with cleanup and clearer error handling if WSL lacks those flags.