fix(desktop): preserve WSL runtime installation errors #21658
main fromrefs/pull/21658/head·merged by juliusmarminge View on GitHubA failed WSL runtime installation could lose its useful loader error when the mounted fallback also failed, leaving a misleading node-pty diagnostic. Keep the installation error for fatal fallback failures, and let fresh-install executable checks include loader stderr. Cached readiness checks stay quiet and transient fallback failures remain retryable.
Thanks @kalvenschraut for the original diagnosis and fix in #11901. Rebuilt from current main because GitHub rejected maintainer pushes to the organization-owned fork (403), despite the PR advertising maintainer edits. The replacement keeps the reviewed production and test diff exactly and credits the original author as a co-author. A staging failure carries its reason without a runtime ID; only an installed runtime that failed probing is invalidated after a successful mounted fallback.
Verification on headless Linux:
- Two added regressions → two; 87 → 87 tests across
DesktopBackendConfiguration.test.tsandDesktopWslEnvironment.test.ts. Simplified the fallback test and reused its harness; the existing successful-fallback test rejects invalidation after failed staging. - Before: both regressions fail against main’s production code because the loader diagnostic is missing. After: both focused suites pass all 87 tests.
- The shell regression executes the generated installer against a disposable archive whose executable emits a missing-
libatomic.so.1error. Installation fails, stderr retains that diagnostic, and no runtime root is reported. - Existing coverage retains retryable fallback failures, installed-runtime invalidation, cache repair and installation safety. Desktop typecheck, targeted lint, formatting and whitespace checks pass. The two old Alpine cache-pruning failures do not reproduce on this Linux host.
No actual Windows/WSL desktop launch was available. The shell fixture exercises the Linux installer directly; backend service tests exercise diagnostic selection. Windows/WSL, macOS, iOS, Android and Electron desktop were not verified live. A human WSL run on a distro with a missing runtime dependency remains useful before landing.
Implementation: GPT-6.1-Sol; tests: GPT-6-Astra; independent reviews: Claude Opus 5.5 and GPT-6-Sol. Orchestrated in T3 Code through the Codex harness.
- 1
juliusmarminge changed the title
juliusmarminge assignedjuliusmarminge
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:XS
Approvability#
Verdict: Approved at
ab1b832Macroscope's review found this PR approvable — This is a small, focused WSL error-reporting fix that preserves loader diagnostics without introducing new capabilities, schema changes, defaults, or broad runtime restructuring. Targeted tests cover the changed fallback and installation paths.
Notes:
- Diff unchanged. Approvability was decided on eligibility alone.
juliusmarminge added labelsmacroscope-review
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Team
- Run ID:
89a8b7f4-7ecf-43a2-9032-b03a9474f99e
📥 Commits
-
Reviewing files that changed from the base of the PR and between 1451e7cb23034d29774338608368a15d8845df36 and ab1b832e723c05c5cc4aff12d494e1d1470eda00.
📒 Files selected for processing: 4
-
apps/desktop/src/backend/DesktopBackendConfiguration.test.tsapps/desktop/src/backend/DesktopBackendConfiguration.tsapps/desktop/src/wsl/DesktopWslEnvironment.test.tsapps/desktop/src/wsl/DesktopWslEnvironment.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
-
📝 Walkthrough
-
The WSL install script now suppresses stderr from runtime readiness checks while preserving installation errors. Backend preflight records staging failures without a runtime ID and uses the staging reason when mounted fallback fails fatally.
Changes: WSL runtime failure handling
Layer / File(s) Summary Runtime readiness checks
apps/desktop/src/wsl/DesktopWslEnvironment.ts,apps/desktop/src/wsl/DesktopWslEnvironment.test.tsReadiness checks suppress stderr. A test confirms that a missing-library error still fails installation, appears in stderr, and produces no runtime root. Preflight fallback failure handling
apps/desktop/src/backend/DesktopBackendConfiguration.ts,apps/desktop/src/backend/DesktopBackendConfiguration.test.tsStaging failures can lack a runtime ID and do not trigger runtime invalidation in that case. If mounted fallback fails fatally, the returned failure reason includes the staging error. Priority: ⬇️ Low
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Suggested reviewers:
maria-rcks
Merge Risk: ⚪ Minimal · up to
ab1b8-
The changed WSL failure paths preserve the staging diagnostic as intended. No identified issue remains to block merging after normal checks.
Pre-merge checks:
4-
Check name Status Explanation Title check The title clearly and concisely describes the main change: preserving WSL runtime installation errors. Description check The description explains the problem, implementation, focused verification, test results, and unverified environments. It does not use the required section headings and does not clearly provide triage… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Full details: Description check
-
Explanation
The description explains the problem, implementation, focused verification, test results, and unverified environments. It does not use the required section headings and does not clearly provide triage or maintainer approval for scope, but it is otherwise substantially complete.
-
✨ Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
juliusmarminge merged this1a552d1
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed