Skip to content

fix(server): bound editor discovery during config loading#4291

Open
maria-rcks wants to merge 1 commit into
pingdotgg:mainfrom
maria-rcks:agent/bound-editor-discovery
Open

fix(server): bound editor discovery during config loading#4291
maria-rcks wants to merge 1 commit into
pingdotgg:mainfrom
maria-rcks:agent/bound-editor-discovery

Conversation

@maria-rcks

@maria-rcks maria-rcks commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

What Changed

  • Bound optional editor discovery during server config loading to five seconds.
  • Return an empty availableEditors list when discovery times out.
  • Added regression coverage proving config loading completes and interrupts discovery when it never resolves.

Why

server.getConfig waits for optional editor discovery. On affected machines, discovery consumed almost the entire 15-second connection setup window, so the client timed out and entered a reconnect loop even though the server was running.

This keeps the fix at the config-loading seam and avoids the process-diagnostics and platform-specific changes proposed in #3911. Related symptom report: #3746.

Closes #3610

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • Screenshots are not applicable; there are no UI changes
  • Video is not applicable; there are no animation or interaction changes

Note

Bound editor discovery in makeWsRpcLayer to a 5-second timeout

  • Introduces resolveAvailableEditorsForConfig in ws.ts, which wraps editor discovery with a 5-second timeout using Effect.timeoutOption.
  • The availableEditors field in the server config response now returns an empty array on timeout instead of blocking indefinitely.
  • Adds a test verifying that the discovery fiber is interrupted and an empty array is returned when discovery never resolves.
  • Behavioral Change: clients that previously waited for slow editor discovery will now receive an empty availableEditors list after 5 seconds.

Macroscope summarized 4bd5bcf.


Note

Low Risk
Localized change to optional config metadata with graceful degradation; no auth or persistence impact.

Overview
server.getConfig no longer waits indefinitely on optional editor discovery. Discovery is capped at 5 seconds via new resolveAvailableEditorsForConfig (Effect.timeoutOption); on timeout availableEditors is [] instead of holding the response.

This addresses clients timing out during connection setup when slow discovery consumed most of the setup window. A regression test asserts that after 5s the result is empty and the stuck discovery fiber is interrupted.

Reviewed by Cursor Bugbot for commit 4bd5bcf. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

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

Run ID: 580c776a-bc14-419a-80fa-6be972e74a5e

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:trusted PR author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Jul 22, 2026
@maria-rcks
maria-rcks marked this pull request as ready for review July 22, 2026 17:11

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4bd5bcf. Configure here.

yield* Deferred.await(discoveryInterrupted);
assert.deepEqual(availableEditors, []);
}),
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Timeout test missing yieldNow

Medium Severity

The new editor-discovery timeout test forks resolveAvailableEditorsForConfig over Effect.never, then calls TestClock.adjust without first yielding so the child fiber can register its timer. That diverges from the repo’s forkChild + TestClock.adjust pattern and can leave Fiber.join waiting forever, hanging CI.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4bd5bcf. Configure here.

@macroscopeapp

macroscopeapp Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

The production code change is a low-risk defensive timeout addition. However, there's an unresolved comment about a potential test issue (missing yieldNow before TestClock.adjust) that could cause the test to hang, which warrants human attention.

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:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or 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