Skip to content

Fix connection setup blocked by editor discovery - #4435

Open
Andrew-Forster wants to merge 2 commits into
pingdotgg:mainfrom
Andrew-Forster:agent/nonblocking-editor-discovery
Open

Fix connection setup blocked by editor discovery#4435
Andrew-Forster wants to merge 2 commits into
pingdotgg:mainfrom
Andrew-Forster:agent/nonblocking-editor-discovery

Conversation

@Andrew-Forster

@Andrew-Forster Andrew-Forster commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

On loaded Windows systems, editor availability can spend longer than the 15-second connection deadline walking PATH and PATHEXT entries, so server.getConfig is interrupted and a healthy local backend is reported as disconnected. This moves editor discovery out of the connection-critical config snapshot: ExternalLauncher now starts the scan as a scoped background task, exposes an immediate cached snapshot, and publishes availableEditorsUpdated when 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, and git diff --check passing. Fixes #3610.

Note

Fix connection setup blocked by editor discovery using a non-blocking cached snapshot

  • The subscribeServerConfig WebSocket endpoint previously called resolveAvailableEditors synchronously during the initial snapshot, blocking connection setup until editor discovery completed.
  • ExternalLauncher now seeds a SubscriptionRef with an empty editor list and populates it via a background fiber, exposing availableEditors (non-blocking snapshot) and streamAvailableEditors (change stream).
  • The WebSocket layer reads the cached snapshot for the initial config and pushes availableEditorsUpdated events as the background fiber updates the ref.
  • applyServerConfigProjection in the client runtime now handles availableEditorsUpdated events to update availableEditors without replacing the rest of the config.
  • Behavioral Change: the initial snapshot always returns an empty availableEditors list; 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 availableEditors before the update event.

Overview
Editor discovery no longer blocks the WebSocket config snapshot. ExternalLauncher keeps editor IDs in a SubscriptionRef, kicks off PATH/PATHEXT scanning in a scoped background fiber at startup, and exposes an immediate availableEditors read plus streamAvailableEditors for later changes.

subscribeServerConfig builds the initial snapshot from the cached list (often [] until discovery finishes) instead of awaiting resolveAvailableEditors(), and merges availableEditorsUpdated into the live update stream alongside settings and provider events. Contracts and client applyServerConfigProjection apply that event by patching only config.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.

@coderabbitai

coderabbitai Bot commented Jul 24, 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 Plus

Run ID: 17cb5ad2-934a-446c-9547-9ff083952836

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:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Jul 24, 2026
@Andrew-Forster
Andrew-Forster marked this pull request as ready for review July 24, 2026 08:26
@macroscopeapp

macroscopeapp Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: 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.

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:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Windows 0.0.28/nightly local backend appears disconnected; server.getConfig interrupted, 0.0.27 works

1 participant