Repository navigation
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
🧰 Additional context used📚 Code guidelines (1)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 (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe changes propagate PTY incarnation identity through remote transport recovery and rebind events. They retire superseded PTY state, cancel stale reads and replay work, and apply incarnation-aware replay guards. They add redraw requests for qualifying reattach viewport updates and validate fit overrides with finite positive dimensions. Unit, integration, and end-to-end tests cover replacement state, replay ordering, geometry, agent tracking, redraw behavior, and terminal modes. Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to Obsolete attachment responses are now rejected before changing the active terminal identity. No actionable merge-blocking issue remains in the supplied evidence; merge after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The changes strengthen separation between successive terminal processes and constrain redraw requests to eligible terminals with unchanged geometry. No concrete security regression was established in the reviewed paths, but host-side signaling and mixed-version behavior were not validated end to end. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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.
Actionable comments posted: 2
🧹 Nitpick comments (1)
tests/playwright.remote-replacement.config.ts (1)
7-7: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider a larger
timeoutfor this spec.The spec chains long polls inside one test: 60s for worktree visibility, 45s for warm text, 45s for the warm incarnation, 45s for the warm probe, 45s for the replacement pty id, and 60s for the replacement incarnation. It also launches two Electron apps and restarts the serve process twice. The sum of the poll budgets alone exceeds the 180s test timeout. A slow CI machine then reports a Playwright timeout that reads like a product failure instead of a slow environment.
Raise the timeout to cover the declared poll budgets, or reduce the individual poll timeouts in the spec.
♻️ Proposed change
- timeout: 180_000, + timeout: 420_000,
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 33cc0670-ea10-4eca-8e38-736aacd3dc9a
📒 Files selected for processing (19)
src/renderer/src/components/terminal-pane/pane-foreground-agent-tracker.test.tssrc/renderer/src/components/terminal-pane/pane-foreground-agent-tracker.tssrc/renderer/src/components/terminal-pane/pty-connection-daemon-snapshot-replay.test.tssrc/renderer/src/components/terminal-pane/pty-connection-remote-snapshot-source-grid.test.tssrc/renderer/src/components/terminal-pane/pty-connection-replay-payload-handling.test.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-pty-visibility-bind.tssrc/renderer/src/components/terminal-pane/pty-connection/pty-input-forward.tssrc/renderer/src/components/terminal-pane/pty-connection/remote-pty-incarnation-replacement.test.tssrc/renderer/src/components/terminal-pane/pty-connection/remote-pty-incarnation-replacement.tssrc/renderer/src/components/terminal-pane/pty-connection/replay-data-drain.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-incarnation-recovery.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.tssrc/renderer/src/lib/pane-manager/pane-fit-unknown-owner-size.test.tssrc/renderer/src/lib/pane-manager/pane-fit.tssrc/renderer/src/runtime/web-session-terminal-handle-events.test.tssrc/renderer/src/runtime/web-session-terminal-handle-events.tstests/e2e/helpers/remote-terminal-geometry-probe.tstests/e2e/paired-remote-terminal-replacement-state.spec.tstests/playwright.remote-replacement.config.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Geometry recovery —
pane-fit.tsstops resizing a held remote/mobile owner to a clamped0×0/2×1grid; a newhasKnownFitOverrideDimensions()guard treats only finite positive override dims as authoritative and otherwise fits locally while retaining the hold. - Incarnation delivery —
remote-runtime-pty-transport.tspublishes the host's incarnation id viaonPtyRebindbefore the first snapshot on reattach, and resolves it fromupdate.incarnationIdor aterminal.resolvePanefallback in the recovery paths;remote-pty-incarnation-replacement.ts(new) retires predecessor evidence only on a proved, handle-differentiated incarnation change. - Replacement mouse/state fencing —
replay-data-drain.tsfences the drain onremotePtyIncarnationIdand switches a replacement replay toPOST_REPLAY_LIVE_AGENT_SNAPSHOT_RESETunless the owner is a known shell;pane-foreground-agent-tracker.tsgainsresetForPtyReplacement()andpty-input-forward.tsfencesisCurrent()on the incarnation. - Regression coverage — unit grids for mouse-mode reconciliation, same-handle/both-known/unknown-identity retirement, unknown-owner fit behavior, plus an isolated paired-host/client Electron diagnostic (
paired-remote-terminal-replacement-state.spec.ts) verifying warm reconnect geometry, surviving-agent mouse retention, and a replacement shell with no mouse reports.
The incarnation plumbing stays within existing RPCs — incarnationId is already host-published on RuntimeTerminalResolvePane and RuntimeMobileSessionTerminalTab, consumed optionally with ?? null degradation, and no new opcode or stream frame is introduced, so mixed-version peers are safe. Retirement is deliberately conservative (old && new && old !== new only), matching the repo's live/unverifiable verdict philosophy. The one scoping note — the retained "π" title after a replacement, and completed-agent metadata — is explicitly deferred to the dependent stack, so #18464 rightly remains open.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Predecessor identity retained on reconnect —
attachHostSessionMirrornow accepts the persistedsessionIdand forwards it as thereplacedPtyIdinonPtyRebind, so aconnect({ sessionId })web-mirror reattach retires the old (persisted) pane identity instead of a degenerateptyId === replacePtyIdno-op. - Regression coverage —
remote-runtime-pty-incarnation-recovery.test.tsaddsit.each(['terminal-1', 'terminal-2'])asserting the exact rebind triple(nextHandle, persistedSessionId, incarnationId)for both same-handle and rotated-handle reattachment. - Diagnostic config hardening — the isolated Playwright config pins
ORCA_BACKGROUND_LAUNCH=1and raises the per-test timeout from 180s to 420s to cover the spec's declared poll budgets.
The change correctly narrows the second argument of onPtyRebind: in the connect web-mirror path existingPtyId is absent, so the predecessor resolves to the persisted sessionId; the attach path (existingPtyId ?? remotePtyId) is unchanged. The consumer in pane-pty-visibility-bind.ts feeds that value into both retireRemotePtyIncarnation and bindActivePanePty({ replacePtyId }), and parseRemoteRuntimePtyId degrades gracefully to no retirement when the id isn't a remote handle. Verified locally: the 22-case recovery test file passes.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
@mmarabel Heads up: this has merge conflicts against Also, a note from a fresh repro reported in #18464 (restarting
If remote PTYs can trigger a synthetic WINCH/redraw kick on reattach when dimensions are unchanged, that would fully solve the idle remote case. |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: cb18eee8-6706-4454-b36a-ae1085dba191
📒 Files selected for processing (24)
src/main/ipc/pty/runtime/controller.tssrc/main/ipc/pty/runtime/pty-redraw.test.tssrc/main/ipc/pty/runtime/pty-redraw.tssrc/main/runtime/orca-runtime-serialize-main-terminal-buffer.tssrc/main/runtime/rpc/methods/terminal/terminal-viewport-methods.tssrc/main/runtime/rpc/terminal-reattach-redraw.test.tssrc/main/runtime/runtime-pty-controller-contract.tssrc/renderer/src/components/terminal-pane/pane-foreground-agent-tracker-contract.tssrc/renderer/src/components/terminal-pane/pane-foreground-agent-tracker.test.tssrc/renderer/src/components/terminal-pane/pane-foreground-agent-tracker.tssrc/renderer/src/components/terminal-pane/pty-connection-daemon-snapshot-replay.test.tssrc/renderer/src/components/terminal-pane/pty-connection-remote-snapshot-source-grid.test.tssrc/renderer/src/components/terminal-pane/pty-connection-replay-payload-handling.test.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-pty-visibility-bind.tssrc/renderer/src/components/terminal-pane/pty-connection/pty-input-forward.tssrc/renderer/src/components/terminal-pane/pty-connection/reattach-grid-push.tssrc/renderer/src/components/terminal-pane/pty-connection/remote-pty-incarnation-replacement.test.tssrc/renderer/src/components/terminal-pane/pty-connection/replay-data-drain.tssrc/renderer/src/components/terminal-pane/pty-transport-types.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport-reattach-redraw.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.tssrc/renderer/src/lib/pane-manager/pane-fit-unknown-owner-size.test.tssrc/shared/rpc-contract/terminal-viewport-schemas-params.tstests/e2e/paired-remote-terminal-replacement-state.spec.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
|
Resolved the conflicts against current Your redraw suggestion was right: a same-size resize does not generate The hidden paired-host/client Electron regression now checks that the surviving idle process repaints after restarting |
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the commits since the prior pullfrog review (542573a): a merge of upstream main plus a repaint-on-reattach kick for remote panes.
- Redraw idle remote panes on reattach — a remote pane whose applied grid is unchanged at reattach now sends
terminal.updateViewportwith a new optionalredrawfield; the host re-resolves the leaf, re-confirms the grid still matches, and best-effort signalsSIGWINCHto the execution host's foreground group (requestTerminalRedraw→requestPtyRedrawFromRuntimeController). - Client redraw bypasses the stream opcode —
remote-runtime-pty-transport.resize(..., { redraw })clears the queued viewport batcher and issues a single RPC instead of aResizeframe, used only for remote runtime pty ids and bounded to the legacy viewport schema. - Agent-tracker contract extracted —
PaneForegroundAgentTracker/…Depsmoved intopane-foreground-agent-tracker-contract.ts;resetForPtyReplacement()is wired into the returned object. Mechanical. - Regression coverage — host
terminal-reattach-redraw.test.ts(mobile ownership, geometry re-check, stream-gone, replaced handle, degraded controller), providerpty-redraw.test.ts, clientremote-runtime-pty-transport-reattach-redraw.test.ts, and e2e assertions that an idle fixture repaints viaSIGWINCHafter a process-only serve restart and that a held unknown owner still fits locally without claiming the PTY.
The optional redraw field is wire-safe (older hosts strip it and keep prior behavior; the client swallows a refusal), the host re-checks the applied grid after the await, and the new unit tests fail if the feature is removed. Verified locally: pty-redraw.test.ts, terminal-reattach-redraw.test.ts, remote-runtime-pty-transport-reattach-redraw.test.ts, pane-foreground-agent-tracker.test.ts, and remote-pty-incarnation-replacement.test.ts all pass.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟠 Major · Reject obsolete results before adopting execution metadata. · remote-runtime-pty-transport.ts:631
src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts:631
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winReject obsolete results before adopting execution metadata.
If attachment A is waiting for activation or polling while attachment B completes, a late result for A can overwrite B’s authoritative incarnation at either adoption site. The
isCurrent()check inwaitForHostSessionHandleWithRecoverythen rejects A’s handle, but it cannot undo the metadata change. A later publication can treat B’s unchanged PTY as a replacement. CheckisCurrent()before both calls toadoptExecutionMetadata.Also applies to: 685-685
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: bfe88230-1e7d-4e4d-97f4-511a6c51f11e
📒 Files selected for processing (6)
src/main/runtime/rpc/terminal-reattach-redraw.test.tssrc/main/runtime/terminal-viewport.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-published-metadata-order.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport-reattach-redraw.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.tssrc/shared/terminal-viewport.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run re-reviewed the single commit pushed since the prior pullfrog review (23a9b8f3a6 → 2409f0aeb3), which resolves two external-bot findings.
- Clamped redraw requests to the host grid — the client no longer skips the redraw RPC for panes outside the legacy
20–240 × 8–120bounds; it clamps to the host's range and always issues theterminal.updateViewportcall, so sub-minimum and oversized remote panes also repaint after a warm reattach. - Moved the clamp to a shared module —
clampTerminalViewportnow lives insrc/shared/terminal-viewport.ts, re-exported fromsrc/main/runtime/terminal-viewport.ts, so the client redraw path and the host resize paths cannot drift. - Fenced accepted-snapshot ordering — a new
publishedHandleUpdateSequenceinvalidates an in-flightresolvePanelookup when a newer accepted publication lands, so an older handle can no longer rebind over a newer one. - Regression coverage — host kick at both clamped boundaries, client
10×4 → 20×8/500×300 → 240×120clamping, and a publication-order race that fails without the sequence fence.
Traced both fixes end to end: the clamped viewport stays within the legacy schema bounds and matches the host's own clamp, so the previousSize === requested redraw condition holds for genuinely unchanged grids, and requestTerminalRedraw still re-resolves and re-checks the applied grid after the await. The sequence fence was independently examined across the detach/resubscribe/retire/auto-recovery interleavings — it only drops continuations the newer publication already supersedes. No open pullfrog threads remained to retire.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
|
Fixed the outside-diff finding about obsolete attachment metadata in dec7d7b926. Both the activation response and the polled inventory response now check the attachment's existing
Validation: 5,706 terminal/wire tests passed (2 skipped); node, web and CLI typechecks, lint and the PR-scoped quality gate passed. I also audited the full review bodies, including outside-diff and nitpick sections; the earlier timeout suggestion is already covered by the 420-second test configuration. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run re-reviewed the single commit pushed since the prior pullfrog review (2409f0aeb3 → dec7d7b926), which closes the last external-bot finding on attachment metadata ordering.
- Reject obsolete mirror attachment metadata —
waitForHostSessionHandle(remote-runtime-pty-transport.ts) now returns early whenisCurrent()is false before adopting a ready terminal, at both the immediate-activation site and the polled inventory site. BecauseisCurrentcloses overattachGeneration/lifecycleEpoch, which everyattach()/detach()/disconnect()bumps, a stale attachment's late activation or inventory result can no longer overwrite a newer attachment's incarnation, execution host, or platform. - Regression coverage —
remote-runtime-pty-attachment-metadata-order.test.tsruns two overlapping attaches from each entry point (activationandinventory) and asserts the newer attachment's metadata survives the older one's late response. It drives the exact race the prior external review described and fails without the new guards.
The guards sit before the only two adoptExecutionMetadata sites reachable from a stale mirror attach; the remaining adoption sites are fenced by their own generation/sequence checks, so the fix is correctly scoped rather than applied blanket-wide. The pre-existing redraw and publication-ordering work from the prior commit still reads clean.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
|
Both failures this PR fixed are handled on main now. A restarted host publishing a 0x0 grid hold no longer shrinks the pane: the fit-override handler in remote-runtime-terminal-response-controller.ts drops non-desktop-fit holds with zero columns or rows (#26483). And a replacement shell no longer keeps the old process's mouse modes, title or agent identity (replaced-process-input-modes.ts, #35889). Rebasing this onto the transport refactors would mostly redo that work, so I'm closing it. If the blank pane or stray mouse codes come back on a current build, I'll open a new issue with a capture. |


ELI5
Remote terminals should reconnect without shrinking to a nearly blank grid or sending mouse escape codes into a replacement shell. This fixes those two failures while preserving the terminal modes of an agent that is still running.
What Changed
0×0. Measurable panes fit locally without claiming or resizing the host; genuine positive small grids remain authoritative.Why
The release reproduction captured an owner-fit override calling
terminal.resize(0, 0), which xterm clamped to2×1. A separate replacement path retained the predecessor's mouse modes because the pane did not consistently receive incarnation changes.Linked Issue
Refs #18464
Stack 1/2. This PR addresses terminal recovery, not the entire identity issue. A dependent PR will address host-published automatic titles and completed agent metadata. The issue should remain open until that work is complete.
Visual Proof
Synthetic, disposable Linux fixtures; screenshots captured through CDP without showing or focusing native windows. Before: exact
v1.4.199. After: this commit rebased onto current upstreammain, whose package still reports1.4.197; both use Electron43.6.0. No release-version changes are included.2×1→75×60, surviving agent retainedThe old Pi title visible in the replacement screenshot is a known host-publication defect reserved for stack 2, not a claim of complete identity cleanup.
Testing
Fresh checks on the rebased commit:
Rendered validation used Linux/Xvfb,
ORCA_BACKGROUND_LAUNCH=1, sanitized environment and disposable HOME/profiles. Test entry point:tests/playwright.remote-replacement.config.ts. No default global E2E setup, live service or real agent session was used. No native macOS/Windows or real SSH rendered validation; mixed-version coverage is protocol-level. Full repository lint/test/build suites are not claimed.AI Disclosure
AI-assisted implementation and separate review using OpenAI coding assistants.
Review
Independent review covered process-identity races, same-handle ownership preservation, unknown/older-peer metadata, successor state, remote/mobile resize authority, cross-platform behavior and performance/security risks. A same-handle ownership-map regression found during review was reproduced, fixed and re-reviewed. No new host execution, provider-specific behavior, shortcuts, filesystem operations or protocol opcode is introduced. RPC enrichment occurs at attachment/recovery boundaries, not per output chunk. Visual recovery evidence was inspected.
Agent skill upstream boundary
Notes
The full original identity diagnostic remains available for the dependent patch. PR 1's test deliberately checks terminal recovery and absence of stale working state; it does not claim that host-published Pi titles/completed metadata are cleared. No skipped or expected-failure tests conceal that distinction.
Checklist
pnpm lint,pnpm typecheck,pnpm test, andpnpm buildrun; targeted checks listed above