Repository navigation
Fix p1 remote terminal resync - #10089
Conversation
After an untagged resync snapshot, the client resets to the snapshot's output high-water. Buffered output generated while serializing is already included in the snapshot, so replaying the entire buffer afterward renders those bytes twice. Trim to output after the snapshot seq. Tagged snapshots feed side consumers and need all buffered output unchanged. Add exponential backoff for truncated recovery retries to avoid stampeding flooded servers.
📝 WalkthroughWalkthroughTerminal snapshot replay now trims buffered output already covered by untagged snapshots while preserving full replay for tagged requests. The remote multiplexer tracks recovery sequences, suppresses duplicate output, validates recovery snapshots, and retries incomplete or failed resynchronization with timers and backoff. New tests cover replay trimming, truncated snapshots, missing end frames, held responses, JSON errors, deferred recovery, and timeout-triggered retries. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/runtime/rpc/methods/terminal.ts (1)
471-475: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winConfirm
chunk.data.length === chunk.meta.rawLengthbefore usingrawLengthfor slicing.
getOutputAfterSnapshotSeq()subtractsmeta.rawLengthfromchunk.meta.seq, butchunk.data.slice()indexes the actual UTF-16 length. Keep the emit/batching contract guaranteeing raw-only chunks, or split non-matching streams intoOutputSpan/transformedchunks before buffering this slice.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 158e1065-9bda-42c5-8361-c9c5dbde4548
📒 Files selected for processing (4)
src/main/runtime/rpc/methods/terminal.tssrc/main/runtime/rpc/terminal-multiplex-resync-replay-trim.test.tssrc/renderer/src/runtime/remote-runtime-terminal-frame-drop-resync.test.tssrc/renderer/src/runtime/remote-runtime-terminal-multiplexer.ts
* fix(terminal): resume output after recovery resync * fix(terminal): harden recovery resync boundaries * fix(terminal): prevent double rendering on frame-drop resync After an untagged resync snapshot, the client resets to the snapshot's output high-water. Buffered output generated while serializing is already included in the snapshot, so replaying the entire buffer afterward renders those bytes twice. Trim to output after the snapshot seq. Tagged snapshots feed side consumers and need all buffered output unchanged. Add exponential backoff for truncated recovery retries to avoid stampeding flooded servers.
* fix(terminal): resume output after recovery resync * fix(terminal): harden recovery resync boundaries * fix(terminal): prevent double rendering on frame-drop resync After an untagged resync snapshot, the client resets to the snapshot's output high-water. Buffered output generated while serializing is already included in the snapshot, so replaying the entire buffer afterward renders those bytes twice. Trim to output after the snapshot seq. Tagged snapshots feed side consumers and need all buffered output unchanged. Add exponential backoff for truncated recovery retries to avoid stampeding flooded servers.
Summary
Describe the user-visible change.
Screenshots
No visual change.Testing
pnpm lintpnpm typecheckpnpm testpnpm buildAI Review Report
Summarize the code review you ran with your AI coding agent. Include the main risks it checked, what it flagged, and what you changed or verified as a result.
Confirm that the review explicitly checked cross-platform compatibility for macOS, Linux, and Windows, including shortcuts, labels, paths, shell behavior, and any Electron-specific platform differences touched by this PR.
Security Audit
Provide a basic security audit summary from your AI coding agent. Call out any input handling, command execution, path handling, auth, secrets, dependency, or IPC risks that were reviewed, plus any follow-up needed.
Notes
Call out any platform-specific behavior, risks, or follow-up work.