t3code icon indicating copy to clipboard operation
t3code copied to clipboard

fix(server): keep installed editors visible when discovery times out

Open eeinarsson opened this issue 4 months ago • 2 comments

What Changed

  • made Windows editor discovery bounded and concurrent while preserving partial successes
  • retained last-known editors when a discovery attempt is incomplete
  • added an optional completion signal and one retry through the existing config snapshot stream
  • added focused shell, launcher, server, and picker coverage

Why

Editor discovery could exceed the server config timeout and discard editors already found, causing clients to incorrectly show “No installed editors found.”

The optional completion field and existing snapshot event keep this compatible across mixed client/server versions.

Fixes #4697.

Related approaches: #4739 and #4435. Complementary command-probe performance work: #4778.

UI Changes

Before: image

After: image

Checklist

  • [x] This PR is small and focused
  • [x] I explained what changed and why
  • [x] I included before/after screenshots for any UI changes
  • [x] No animation or interaction changes require a video

[!NOTE] Medium Risk Touches server config streaming and cross-platform command discovery with new timeout/partial-result semantics; behavior is well tested but affects what clients show for editor availability.

Overview Editor discovery no longer collapses to an empty list when probes time out or stall. discoverAvailableCommands in shared shell code runs bounded, concurrent PATH checks and returns { available, complete }. ExternalLauncher.resolveAvailableEditors now returns { editors, complete }, merges partial results with the last known complete list, and only caches successful complete discoveries.

ServerConfig adds optional availableEditorsComplete. The websocket config stream keeps that flag on snapshots, schedules a 1s retry when the initial load is incomplete, and folds retries into live updates without clobbering settings/keybinding events. OpenInPicker shows “Couldn’t check for installed editors” when discovery is incomplete or unknown, instead of “No installed editors found”.

Coverage spans shell discovery, launcher caching/retry behavior, server config subscription, and the picker empty state.

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

[!NOTE]

Keep installed editors visible in server config when editor discovery times out

  • Adds EditorDiscoveryResult (with editors and complete fields) to replace the plain editor array returned by resolveAvailableEditors in externalLauncher.ts.
  • Introduces discoverAvailableCommands in shell.ts: a platform-aware, timeout-bounded bulk command scanner that returns partial results with a complete flag instead of failing on timeout.
  • Caches complete discoveries for 1 minute; incomplete or failed discoveries are not cached, and the last known complete editor list is preserved on incomplete refreshes.
  • On incomplete discovery, subscribeServerConfig in ws.ts schedules a retry after 1s and emits a refreshed ServerConfig snapshot, propagating availableEditorsComplete to clients.
  • The OpenInPicker UI in OpenInPicker.tsx now shows "Couldn't check for installed editors" when discovery is incomplete, versus "No installed editors found" when it is complete.

Macroscope summarized 64d5e41.

eeinarsson avatar Jul 30 '26 10:07 eeinarsson

[!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: d7839a3b-c087-4823-9ae2-62d405e19537

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

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.

coderabbitai[bot] avatar Jul 30 '26 10:07 coderabbitai[bot]

Approvability

Verdict: Needs human review

This PR introduces new timeout handling, caching, and retry logic for editor discovery - significant runtime behavior changes. An unresolved review comment identifies that retry failures in the discovery stream could terminate the entire config subscription, which warrants human review.

You can customize Macroscope's approvability policy. Learn more.

macroscopeapp[bot] avatar Jul 30 '26 10:07 macroscopeapp[bot]

Closing as superseded by #5561. I verified on Windows 11 with the latest nightly that the editor dropdown now works correctly without this PR.

eeinarsson avatar Aug 07 '26 06:08 eeinarsson