Fix remote sync RPC double-execution after reconnect#354
Closed
cursor[bot] wants to merge 1 commit into
Closed
Conversation
Harden Remote Connections (#353) retries every project-scoped sync call when the SSH/RPC channel drops mid-flight. Mutating methods like sync.connectToBrain can succeed on the server and then run again on reconnect, tearing down an established brain session. Restrict post-reconnect replay to read-only sync and model-picker getters. Co-authored-by: Arul Sharma <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Owner
|
Consolidated into #356. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cron critical-bug audit found a correctness issue introduced in Harden Remote Connections (#353).
Bug and impact
Impact: When using a remote runtime, a dropped SSH/RPC connection during a mutating sync call (e.g.
sync.connectToBrain,sync.disconnectFromBrain,sync.setPin) could succeed on the server and then run again after auto-reconnect. A secondconnectToBraintears down the host (stopHostIfRunning,clearClusterRegistryForViewerJoin) and can disconnect an already-established brain session.Trigger: Remote project open → sync pairing/connect flow → RPC timeout or channel close after the server handled the first request but before the desktop received the response → pool reconnects and retries the same sync method.
Root cause
RemoteConnectionPool.callSyncForTargetalways passedretryOnConnectionError: truetowithEntryForTarget, unlike action calls which useshouldRetryRemoteRuntimeAction.Fix
shouldRetryRemoteSyncMethod(method)intocallSyncForTarget.sync.connectToBrainreconnects but does not invoke the RPC a second time.Validation
npm --prefix apps/desktop run test -- --run src/main/services/remoteRuntime/remoteConnectionPool.test.ts(14 passed)Related open PRs (not duplicated)