Conversation
WSL-only mode kept the connecting splash up when the primary backend exited before it was ready, or stayed up and never answered. After three consecutive startup failures, show an error and use the in-memory Windows fallback for this launch. Fixes pingdotgg#14393 Co-authored-by: maco <macodev00@users.noreply.github.com>
Owner
Author
|
Opened upstream. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In WSL-only mode the desktop app shows a "Connecting to WSL…" splash until the primary backend reports ready. That splash has no controls. If the WSL backend passes preflight and then never becomes ready — it exits on startup (for example
code=1), or it stays up but never answers — the restart loop is uncapped. The splash stays up and the only way out is Task Manager plus editingdesktop-settings.json.Preflight failures already fall back to Windows. Exits before ready and repeated readiness timeouts did not.
Fixes pingdotgg#14393
Why
The accepted triage on pingdotgg#14393 asks for the same recovery as a bounded preflight failure: after repeated startup failures, show an error and use the in-memory Windows fallback for this launch, so
wslOnlystays on disk and the next launch tries WSL again. Both loops need the cap: exits before the backend was ever ready, and a live process whose readiness probes keep failing.Change
DesktopBackendManagercounts those failures after a clean preflight and resets the count once the backend is ready. After three in a row it calls a newonStartupFailedhook. The hook runs off the start mutex sostop()can interrupt it. If the hook asks for a replacement, the failed run is stopped and started again only when thatstop()was the only one (stopGeneration), so a quit during the swap is not undone. On the crash path the next restart waits until the hook finishes, so the fallback is visible to the next config resolve.DesktopBackendPoolwires that hook for the primary. When the failed run has a WSL distro, it logs the failure, shows the existing native error box ("WSL backend isn't responding"), and callsapplyWslWindowsFallbackInMemory. A Windows primary returns false and keeps the current restart loop. Exits after a successful ready do not count, so a backend that was healthy and later crashes is not switched to Windows.The connecting splash is unchanged. It closes the same way it does after any successful primary ready:
handleBackendReadyopens the main window, which dismisses the splash.Scope and approval
pingdotgg#14393 is labeled
accepted/via-triage. Julius's triage comment confirms the failure on main and names this in-memory Windows fallback, covering both the exit loop and the unreachable-process loop, as the recovery. This change does that and nothing else. It does not change how the staged WSL runtime or the mounted server tree is built.Verification
Focused desktop tests, after
vp fmton the edited files. Node v24.13.1.Observed:
Test Files 2 passed (2),Tests 38 passed (38), duration 2.19s.The new cases:
stop()during a blocked hook does not apply the fallback and does not stay stuck, including after pre-ready exits.stop()while a replacement is closing the old run does not start another process.code=1three times shows the error box titled "WSL backend isn't responding" (body includes the distro,code=1, and the Windows-for-this-launch sentence), clearswslOnlyandwslBackendEnabledin memory, keepswslDistro, spawns the Windows config next, and fireshandleBackendReady.Observed: exit 0. The only diagnostic is a pre-existing suggestion in
src/app/DesktopClerk.test.ts(preferSucceedSomeOrNone), unrelated to this change.cd /workspace ./node_modules/.bin/vp lint apps/desktop/src/backend/DesktopBackendManager.ts apps/desktop/src/backend/DesktopBackendManager.test.ts apps/desktop/src/backend/DesktopBackendPool.ts apps/desktop/src/backend/DesktopBackendPool.test.tsObserved: exit 0, no findings.
Platform checks and limitations
Checked on Linux (cloud agent VM) with the desktop unit tests and
tsc. This machine has no Windows desktop session and no WSL distro, so the native error box and the splash-to-window transition were not captured. The splash markup did not change. The dialog isElectron.dialog.showErrorBox, the same primitive the bounded preflight path already uses, and the pool test asserts the title and body it is called with.Not covered here, and not changed:
t3 --versionwhen the distro is missinglibatomic.so.1. That linker error is still reported as a bad archive, and the install still falls through to the mounted server tree.Cannot find module '@yuuang/ffi-rs-linux-x64-gnu'.wslOnlysetting is not cleared. The next launch tries WSL again.