Skip to content

fix(desktop): Validate WSL node version against engine range after probe success#3621

Open
UtkarshUsername wants to merge 5 commits into
pingdotgg:mainfrom
UtkarshUsername:fix/wsl-preflight-node-version-check
Open

fix(desktop): Validate WSL node version against engine range after probe success#3621
UtkarshUsername wants to merge 5 commits into
pingdotgg:mainfrom
UtkarshUsername:fix/wsl-preflight-node-version-check

Conversation

@UtkarshUsername

@UtkarshUsername UtkarshUsername commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

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:
image

The app got stuck in "Connecting to WSL…".

After:
image

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

Medium Risk
Changes WSL backend selection preflight so previously successful probes can fail fatally; incorrect semver handling could block compatible setups, but scope is limited to desktop WSL startup validation.

Overview
WSL preflight no longer treats a successful node-pty probe as sufficient when the distro’s Node is too old for the bundled server. The probe script now emits a nodeVersion: line, parseNodeVersion reads it from stdout, and ensureNodePtyImpl compares that version to options.nodeEngineRange with satisfiesSemverRange before returning success.

If the version is outside the required range, the check returns a fatal failure with an explicit upgrade message instead of proceeding and leaving the app stuck on “Connecting to WSL…”. Unit tests cover parseNodeVersion parsing and trimming behavior.

Reviewed by Cursor Bugbot for commit 1e9bca3. 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

  • Extends the WSL node-pty probe script to output the detected Node.js version (nodeVersion: line) alongside the existing nodePath and resolvedPath lines.
  • Adds parseNodeVersion to extract that version from probe stdout.
  • After a successful probe, ensureNodePtyImpl checks the detected version against options.nodeEngineRange using satisfiesSemverRange, 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 1e9bca3.

UtkarshUsername and others added 2 commits June 30, 2026 23:53
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
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 138c73bf-4e57-4ead-91aa-0cc7baeb7d22

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Jun 30, 2026
@macroscopeapp

macroscopeapp Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

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.

jibin7jose pushed a commit to jibin7jose/t3code that referenced this pull request Jul 2, 2026
…gg#3611)

Consolidates fixes from PRs pingdotgg#3613, pingdotgg#3621, and pingdotgg#3623 to address both root causes and add a fail-safe:

1. DesktopWslEnvironment: Parse the Node version in the WSL node-pty probe and validate it against options.nodeEngineRange. Preflight now fails cleanly with an actionable error if the distro's default Node is incompatible.

2. DesktopBackendManager: Track neverReadyAttempt to cap consecutive post-spawn exits on stdin delivery. Prevents the desktop from permanently getting stuck restarting if the WSL backend consistently fails before readiness.

3. bootstrap: Clean up the readline interface on all event paths to prevent leaks when stdin stays open, and register the error listener on the readline interface to safely catch early stream errors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Windows desktop 0.0.28 gets stuck on connecting to WSL after enabling WSL support

1 participant