fix(desktop): survive a CLI probe candidate that throws on spawn - #793
Merged
Conversation
spawn() can throw synchronously - on Windows it raises UNKNOWN when PATH resolves af to a non-PE file, e.g. the WSL Linux binary seen through the interop PATH of a dev launch. The throw happened inside probeCli's promise executor before any listeners attached, so the promise rejected, Promise.all in probeAll rejected with it, and app.whenReady's await initializeCli died before the tray or window were created: the app ran headless with no UI. Catch the throw and treat that candidate as not responding, matching probeCli's documented never-rejects contract. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
probeClidocuments itself as never rejecting, butspawn()can throw synchronously — on Windows it raisesUNKNOWNwhen PATH resolvesafto a non-PE file (concretely: launching the dev app from WSL puts the WSL Linuxafbinary on the interop PATH). The throw fires inside the promise executor before any listeners attach, so the promise rejects,Promise.allinprobeAllrejects with it, andawait initializeCli(...)kills theapp.whenReady()chain before the tray or window are created. Result: electron processes running, no UI at all.Catch the sync throw and treat that candidate as
responds: false, like every other probe failure.Validation contract
spawnthrows synchronously resolves{responds: false, version: null}instead of rejecting (regression test usesspawn(''), which throws synchronously on every platform)Diagnosed live: a dev launch on Windows bricked with
UnhandledPromiseRejectionWarning: Error: spawn UNKNOWNatprobeCliand never showed a window; with this patch applied the same launch comes up normally.Test plan
npm ci,npm run typecheck,npm test— 224/224 passnpm run dist:dirwith stubbed vendor CLI — packages cleanly🤖 Generated with Claude Code