Fix connection setup blocked by editor discovery - #4435
Conversation
|
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 Plus 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 This PR changes the connection initialization flow from blocking on editor discovery to returning immediately with cached state and streaming updates. While well-tested and following existing patterns, the behavioral change to how/when editor availability data reaches clients warrants human review. You can customize Macroscope's approvability policy. Learn more. |
On loaded Windows systems, editor availability can spend longer than the 15-second connection deadline walking PATH and PATHEXT entries, so
server.getConfigis interrupted and a healthy local backend is reported as disconnected. This moves editor discovery out of the connection-critical config snapshot:ExternalLaunchernow starts the scan as a scoped background task, exposes an immediate cached snapshot, and publishesavailableEditorsUpdatedwhen discovery completes; the client applies that update without replacing the rest of its config. The regression coverage deliberately makes the old discovery method never complete and verifies that the WebSocket config snapshot still arrives within one second, with focused server/editor/client tests plus contracts, client-runtime, and server typechecks, targeted lint, formatting, andgit diff --checkpassing. Fixes #3610.Note
Fix connection setup blocked by editor discovery using a non-blocking cached snapshot
subscribeServerConfigWebSocket endpoint previously calledresolveAvailableEditorssynchronously during the initial snapshot, blocking connection setup until editor discovery completed.ExternalLaunchernow seeds aSubscriptionRefwith an empty editor list and populates it via a background fiber, exposingavailableEditors(non-blocking snapshot) andstreamAvailableEditors(change stream).availableEditorsUpdatedevents as the background fiber updates the ref.applyServerConfigProjectionin the client runtime now handlesavailableEditorsUpdatedevents to updateavailableEditorswithout replacing the rest of the config.availableEditorslist; updates arrive shortly after via the stream rather than being present at connection time.Macroscope summarized 4dd176c.
Note
Low Risk
Localized to editor listing and config streaming; launch paths still use on-demand resolution. Main product change is briefly empty
availableEditorsbefore the update event.Overview
Editor discovery no longer blocks the WebSocket config snapshot.
ExternalLauncherkeeps editor IDs in aSubscriptionRef, kicks off PATH/PATHEXT scanning in a scoped background fiber at startup, and exposes an immediateavailableEditorsread plusstreamAvailableEditorsfor later changes.subscribeServerConfigbuilds the initial snapshot from the cached list (often[]until discovery finishes) instead of awaitingresolveAvailableEditors(), and mergesavailableEditorsUpdatedinto the live update stream alongside settings and provider events. Contracts and clientapplyServerConfigProjectionapply that event by patching onlyconfig.availableEditors.Behavioral note: clients may see an empty editor list on first snapshot, then a follow-up event when discovery completes—addressing Windows setups that previously exceeded the ~15s connection deadline during sync discovery.
Reviewed by Cursor Bugbot for commit 4dd176c. Bugbot is set up for automated code reviews on this repo. Configure here.