fix(server): bound editor discovery latency#4221
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 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 editor discovery from sequential to concurrent with a 3-second timeout, potentially altering which editors users see when some probes are slow. This runtime behavior change warrants human review. You can customize Macroscope's approvability policy. Learn more. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit fe6834f. Configure here.

Summary
Root cause
server.getConfigwaits for external editor discovery before returning its configuration snapshot. Editor discovery checked every configured editor sequentially, and every missing Windows command could traverse the full inheritedPATHacross allPATHEXTvariants. Slow filesystem lookups therefore accumulated across the entire editor catalog and blocked provider statuses from reaching the client.Impact
Optional editor detection can no longer block configuration indefinitely. Fast probes remain visible even when another editor lookup times out, allowing the Providers page and other configuration consumers to resolve within a bounded interval.
Validation
pnpm exec vp test run apps/server/src/process/externalLauncher.test.ts(5 tests passed)pnpm exec vp lint --report-unused-disable-directives apps/server/src/process/externalLauncher.ts apps/server/src/process/externalLauncher.test.tspnpm exec vp run --filter t3 typecheckpnpm exec vp fmt --check apps/server/src/process/externalLauncher.ts apps/server/src/process/externalLauncher.test.tsCloses #4210
Note
Medium Risk
Changes timing and completeness of editor lists (timeouts may hide slow-but-valid editors) and affects config paths that wait on discovery; behavior is bounded and covered by new tests.
Overview
Editor discovery in
ExternalLauncherno longer runs serial PATH probes that could blockgetConfigindefinitely on slow Windows lookups.Probes for each configured editor now run in parallel, with a 3-second cap per editor (
EDITOR_DISCOVERY_TIMEOUT). Editors that finish in time are included; timed-out or hanging probes are dropped while faster ones still appear in the list. Command alias resolution for launch usesEffect.raceAllso the first responsive alias wins instead of checking aliases one-by-one.makeWithOptionsexposes injectableeditorCommandAvailabilityandeditorDiscoveryTimeoutfor tests; production still defaults toisCommandAvailable. New tests cover Zed fallback alias racing and virtual-clock behavior that partial results survive when some probes never complete.Reviewed by Cursor Bugbot for commit 0ce82e3. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Bound editor discovery latency by probing aliases concurrently with a 3-second timeout
externalLauncher.tsnow probes all editors concurrently instead of sequentially, applying a per-editor timeout (default 3 seconds) and returning partial results for editors that resolved in time.zed/zeditor), the selected command is now the first alias whose availability check resolves, rather than using a fixed order.makeWithOptionsfactory allows injecting a customeditorCommandAvailabilityfunction andeditorDiscoveryTimeout, used by tests to control probe timing.Macroscope summarized 0ce82e3.