My machine stopped accepting connections and stayed broken. Reloading did nothing. The server was healthy and the relay was fine: the WebSocket authenticated, then the very first RPC died and the socket closed ~100ms later, on every attempt.
Editor discovery is memoized with Effect.cachedWithTTL, which stores whatever Exit the first caller produces — including an interrupt. Callers run it on the connection fiber under a timeout, so a client that disconnects mid-scan caches the interrupt. Every later connect then replays it, server.getConfig fails, and nothing can reconnect. Worse, each failed connect re-runs discovery and re-poisons the cache, so the 60s TTL keeps refreshing and it never self-heals. Only a restart clears it.
Cache the discovered set only on success. An interrupted scan now leaves the cache untouched and the next connect simply rescans. The memoization that #5561 added is preserved.
Trace from the stuck server, showing where the connection died:
EnvironmentAuth.authenticateWebSocketUpgrade Success
SessionStore.markConnected Success
ws.rpc.server.getConfig Interrupted
SessionStore.markDisconnected Success
The regression test reproduces this: it fails on the current code with the same interrupt through the same isExecutableFile → resolveAvailableCommand stack, and passes with the fix. Verified by reverting the source and re-running. Full server suite: 1,901 passing, typecheck clean.
Introduced by #5561, which is in nightly .1021.
Made by Claude Opus 5 in Claude Code.
Note
Medium Risk
Touches connection-time config path (getConfig / editor discovery) with custom caching semantics; scope is narrow and covered by a targeted regression test.
Overview
Editor discovery memoization no longer caches interrupts, fixing reconnects that failed on every server.getConfig until restart.
ExternalLauncher.resolveAvailableEditors drops Effect.cachedWithTTL for a Ref-backed cache that writes only after a successful PATH scan. If discovery is interrupted (e.g. client disconnect mid-connect on the connection fiber), the cache stays empty and the next connect rescans instead of replaying the interrupt for the full 60s TTL. TTL expiry uses Clock.currentTimeNanos (monotonic), aligned with shell command-resolution caching.
A regression test interrupts discovery mid-scan and asserts a later call still returns editors.
Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 76d0847b01ac5dfdb98e91dfbd54f7563121625c. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).
Note
Fix resolveAvailableEditors to skip caching interrupted or failed discoveries#
Effect.cachedWithTTL was replaying cached interrupts, blocking reconnects when a client disconnected mid-discovery. Replaced with a manual Ref-backed cache in externalLauncher.ts.
- The new cache only stores successful results and uses a monotonic nanosecond TTL (
60_000_000_000n) via Clock.currentTimeNanos to avoid system clock skew issues.
- A regression test in
externalLauncher.test.ts verifies that an interrupted discovery is not cached and a subsequent call rescans correctly.
Macroscope summarized 76d0847.
Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
f77e6b4c-a163-490e-a9d4-04a83305a282You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
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