fix(desktop): Validate WSL node version against engine range after probe success#3621
Conversation
The preflight probe could succeed (exit 0) with a node version outside the server's engine range because || true in the preamble script swallows ensure_remote_node_path failures. The probe then returns ok:true without re-validating, and the server silently exits on import.meta.main (undefined pre-Node 22), leaving the app stuck on 'connecting to WSL...'. - Probe script now emits a nodeVersion: line - parseNodeVersion() extracts major.minor.patch from that line - ensureNodePtyImpl validates the version against nodeEngineRange after exitCode === 0 before returning ok:true
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the 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. Comment |
ApprovabilityVerdict: 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. |
Fixes #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
Note
Medium Risk
Changes WSL backend preflight success criteria and fatal-failure handling on the Windows desktop connection path, but the logic is a narrow semver check with no auth or data impact.
Overview
WSL preflight can succeed while the distro’s default Node is too old for the server, which left the app hanging on “Connecting to WSL…” instead of surfacing an error.
The node-pty probe script now prints a
nodeVersion:line, andparseNodeVersionreads it from probe stdout (with unit tests). When the probe exits 0,ensureNodePtyImplcompares that version tonodeEngineRangeviasatisfiesSemverRange; a mismatch returns a fatal failure with an upgrade message so the UI can show the error and fall back to the Windows backend.Reviewed by Cursor Bugbot for commit c79a8a9. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
[!NOTE]
Validate WSL Node.js version against engine range after probe success
nodeVersion:line) alongside the existingnodePathandresolvedPathlines.parseNodeVersionto extract that version from probe stdout.ensureNodePtyImplchecks the detected version againstoptions.nodeEngineRangeusingsatisfiesSemverRange, returning a fatal failure if the version does not satisfy the range.Macroscope summarized c79a8a9.