fix(desktop): Validate WSL node version against engine range after probe success #3621
main fromrefs/pull/3621/head·merged by juliusmarminge View on GitHubFixes #3611
What Changed#
After the WSL preflight probe succeeds, the app now checks that the WSL Node version satisfies the server's requirement before accepting it as valid.
I tested this by downgrading my WSL node version to 18.19.1. The app correctly showed the failure, and suggested to upgrade node.
Why#
When nvm's default Node version (e.g. 18.x) falls outside the server's engine range, the preflight probe still exits successfully and returns a valid node path. The server then silently exits because it can't run on that Node version, leaving the app stuck on "Connecting to WSL…". This adds a missing validation step to catch that case early and show the user a clear error.
Before:
The app got stuck in "Connecting to WSL…".
After:
Connecting to WSL fails, error is shown, and then the app falls back to Windows-backend mode.
Checklist#
- This PR is small and focused
- I explained what changed and why
- I included before/after screenshots for any UI changes
- I included a video for animation/interaction changes
Note
Low Risk Narrow change to WSL preflight success handling and error messaging; reuses existing semver range checks already used elsewhere in the same module.
Overview
Fixes WSL startup hanging on "Connecting to WSL…" when the distro’s default Node is present and the node-pty preflight probe succeeds, but the version is outside the server’s engines.node range.
The WSL node-pty probe script now prints a nodeVersion: line; parseNodeVersion reads it from probe stdout. After probe.exitCode === 0, ensureNodePtyImpl compares that version to options.nodeEngineRange with satisfiesSemverRange. A mismatch returns a fatal failure with an upgrade message instead of treating the backend as healthy. Unit tests cover parseNodeVersion parsing edge cases.
Note
[!NOTE]
Validate WSL Node.js version against engine range after probe success#
- Extends the WSL node-pty probe script to output the detected Node.js version (
nodeVersion:line) alongside the existingnodePathandresolvedPathlines. - Adds
parseNodeVersionto extract that version from probe stdout. - After a successful probe,
ensureNodePtyImplchecks the detected version againstoptions.nodeEngineRangeusingsatisfiesSemverRange, returning a fatal failure if the version does not satisfy the range. - Behavioral Change: a previously successful probe can now return a fatal failure when the WSL Node.js version is outside the required engine range.
Macroscope summarized 43693dc. >
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
Approvability#
Verdict: Needs human review
Introduces a new fatal error pathway for WSL Node.js version validation. Previously-passing probes can now fail if the version doesn't satisfy the engine range. This behavioral change, plus the author being new to this file, warrants human review.
You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).Caution
Review failed#
An error occurred during the review process. Please try again later.
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment `@coderabbitai help` to get the list of available commands.juliusmarminge merged thisbf76535
juliusmarminge closed this
Sign in to join this conversation.
Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID:
bcd06414-28ec-406f-8f98-1b40168fc721You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share