Repository navigation
Keep SSH terminals parked after their own workspace updates - #23193
Conversation
There was a problem hiding this comment.
Important
The stale-resync reordering fixes the own-echo case but introduces a new way to deliver (and cache) an older snapshot over a newer one. Details inline.
Reviewed changes
- Compare at receipt —
resyncStaleRemoteWorkspaceno longer captures the cached session before awaiting; the newreadRemoteSnapshotreceive callback capturespreviousand caches the fetched snapshot in one synchronous step, so a local patch reply that lands during the pending read is recognized as the same session. - Thin wrapper preserved —
getRemoteSnapshotnow delegates toreadRemoteSnapshotwith the samerememberRemoteWorkspaceSnapshotbehavior, so ordinary readers are unchanged. - Regression coverage — new unit cases (own vs peer during pending read, pre-marker ack, queued peer after suppressed echo, cross-target isolation, read-before-later-own-reply) plus a new happy-dom cross-layer parking test that keeps panes parked through four own echoes while still applying a peer edit.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Warning Review limit reachedNext included review available in 16 minutes. View limit detailsLimit details: You’ve used all 10 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthroughThe change exports snapshot identity comparison and updates stale resync to read snapshots, check for cache changes during reads, and requeue conflicting observations. Tests cover own and peer notifications, queued reads, target isolation, cache updates, and relay resets. A direct SSH test checks snapshot delivery while terminal panes are cold-parked, including pane mounting and parking after PTY attachment. Priority: ⬇️ Low Merge Risk: 🔵 Low · up to A peer edit may briefly revert when an older read response arrives in the same batch. Confirm the revision-ordering safeguard before merging. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The new checks help prevent an older read from displacing an acknowledged update. A sustained sequence of conflicting updates could delay recovery of a workspace notification, but the effect is scoped to one SSH target and no new externally reachable entrypoint was found. Retained concerns
Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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 |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the delta since the prior pullfrog review (commit 2197dcd), which resolves the earlier [!IMPORTANT] finding.
- Token-guarded resync —
resyncStaleRemoteWorkspacenow captures the cache'shostObservationTokenbefore the read and, inside the receive callback, discards and requeues the read when the token changed mid-flight, so a newer peer observation can no longer be overwritten by the older read. A second guard re-checks the token between receipt and delivery to cover the microtask window. The token is minted only for genuinely new, differing host observations and preserved across local patches, which is why it distinguishes an own echo from a peer change without rejecting valid relay resets. - Undefined-safe identity —
snapshotsAreIdenticalis exported asremoteWorkspaceSnapshotsAreIdenticaland now handles an undefinedprevious. - Regression coverage — new cases for the peer race in one decode turn (real
SshChannelMultiplexer), a captured read replaced by a peer revision, and a relay reset raced by a host change, plus a cross-layer parking test.
Verification: the focused suites pass at head (16 + 24 tests), the new cases fail against 2f745a8, and the parking test fails against the base (d9d5993).
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the delta since the prior pullfrog review (commit a780dc4), which closes the remaining stale-delivery path.
- Content-identity guards —
resyncStaleRemoteWorkspacenow compares the cache at receipt against the pre-read snapshot by full content (remoteWorkspaceSnapshotsAreIdentical) rather than byhostObservationToken. A same-token own acknowledgement that lands during the pending read is therefore discarded and reread instead of delivered, and the post-receipt guard requeues when the cache is no longer content-identical to the observation. Because the comparison is content-based, legitimate relay resets (lower revision, different content) are still accepted on the reread. - Regression coverage — new cases for a same-token own acknowledgement after receipt and for own/peer notifications in both decoder orders using the real
SshChannelMultiplexer, plus a parking-test adjustment that resolves follow-up reads.
Verification: focused suites pass at head (18 + 24 tests); the three new cases fail against 2197dcd (two cache rewinds, one stale delivery), and the parking test still fails against base d9d5993.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…ale reads A stale-revision patch reply caches the peer snapshot under a new host observation token, but the renderer only records a conflict and blocks uploads. Suppressing an identical stale read then left the peer change unapplied. Only suppress when the intervening write kept the pre-read token, which is what a contiguous own acknowledgement does.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the delta since the prior pullfrog review (commit a780dc4), which closes the last way a peer observation could be dropped during a stale read.
- Peer state cached by a rejected patch is delivered — in the stale-resync receive callback, when the cache changed during the read but is content-identical to the fetched snapshot, the callback now distinguishes an own acknowledgement (token preserved by the local-patch path) from a peer/rejected-patch observation (token minted by
rememberRemoteWorkspaceSnapshot) and delivers the latter instead of dropping it. A rejectedworkspace.patchreply caches the peer's newer session without hydrating the renderer, so suppressing the read left the renderer without the peer change. unchangednarrowed — the flag is forcedfalsewhenever the cache changed during the read, so the fall-through path always delivers rather than being mistaken for an own echo.- Regression coverage — a new unit case places a peer snapshot in the cache during the pending read (the rejected-patch shape) and asserts it is delivered exactly once, alongside the existing own-echo suppression cases.
Verification: src/main/ipc/remote-workspace-stale-resync.test.ts passes (18 tests).
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

ELI5
When an SSH workspace notification has to be fetched again, Orca can mistake its own accepted update for a change from another device. That reloads background terminals unnecessarily. This change recognizes the accepted update and keeps those panes parked.
What Changed
Compare the fetched workspace with the current cached session before replacing that cache. Previously the comparison captured the cache before waiting, so a local patch acknowledged during the wait was missed.
If another observation arrives while the read or delivery is pending, preserve it and reread any conflicting response. Comparing complete snapshots catches both peer changes and own acknowledgements that retain the same authorization token. A quiet read may still accept a lower revision after a relay reset. The ordinary snapshot reader keeps its existing behavior; stale-notification recovery uses the same reader with a synchronous comparison/cache callback.
The regression crosses the real main-process cache/read path, renderer hydration and parking hook. Four own acknowledgements during pending reads leave both panes parked. A distinct peer edit still applies. With the old production files, the first own echo unparks both panes and fails the test.
Why
This removes a demonstrated producer of unnecessary remounts. Extending parking timers would only reduce how often the reload happens. Comparing after the fetched snapshot had already replaced the cache would hide genuine peer changes, so comparison and cache update happen together in the read continuation. Concurrent changes trigger a fresh read instead of relying on revision numbers that can reset.
Linked Issue
Root-cause follow-up to #20851 and the later direct-SSH crash-scan reports. This proves the race and its parking consequence; the historical bundle lacks the stale-notification records needed to attribute every reported churn episode to it.
Visual Proof
N/A — background pane lifecycle change, with no layout or appearance change. The integration test supplies before/after lifecycle assertions: old code unparks both panes on the first own echo; fixed code preserves parking across four echoes and still applies a peer edit. PTY transport attachment is simulated through the real store action; no fresh live-SSH recording is claimed.
Testing
Final focused run on
a780dc4dab: 46 tests passed across 6 suites, including real-multiplexer frame ordering and the cross-layer parking regression. Node typecheck and changed-code quality pass; prior web and targeted integration typechecks pass.Controls cover peer/own notifications in both decoder orders, later acknowledgements before delivery, same-revision peer changes, legitimate relay resets, queued markers, independent targets and own echoes before/during reads. The three same-token regressions fail on the preceding revision (two cache rewinds and one stale delivery), then pass with the fix. Final independent review found no remaining blocker. Head CI unit shards, static analysis, typechecks and packaging pass. Live Docker SSH watcher isolation and terminal parking/startup stages also pass; the broader remaining Docker SSH suite is still running.
Review
Merge risk: low, pending head CI. Three production files change; no new protocol fields, timers, listeners or retained state. The main risks are stale delivery or suppressing a genuine remote change, covered by ordering, peer and target-isolation cases. Conflicting concurrent changes can add a serialized reread. Full PR CI remains a required check before a merge is proposed as ready.
Agent skill upstream boundary
Notes
The execution host remains authoritative. Mixed-version messages and provider error behavior are unchanged. The fix operates on target-scoped session content and does not assume a Git worktree. Local and paired-runtime terminal paths are unchanged.
This does not claim to resolve all historical crashes, eliminate every reason for remote hydration, or remove #20851's existing mitigation.
Checklist