Repository navigation
fix(remote): recover and safely park paired terminals - #11416
Conversation
|
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:
📝 WalkthroughWalkthroughThe change adds explicit runtime-environment connect and manual-disconnect fencing across IPC, preload, web, and renderer flows. Terminal subscription paths now distinguish retained-tail first paint from authoritative snapshot truncation. Remote terminal streams gain watchdog-based stall detection and recoverable stream restart behavior. Hidden remote worktree retention adds pending-spawn classification, parking diagnostics, E2E configuration, memory metrics, and paired-runtime coverage. Replay operations now record hashed identity and redacted PTY breadcrumb context, with updated reliability-gate definitions. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 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.
Actionable comments posted: 6
🧹 Nitpick comments (4)
src/main/ipc/runtime-environment-connectivity-handlers.ts (1)
22-36: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider hoisting the fenced-response shape and the
runtime_manually_disconnectedcode into shared code.The identical envelope and literal code string are duplicated in
src/renderer/src/web/web-preload-api.ts(manuallyDisconnectedResponse) and thrown as a bare string insrc/main/ipc/runtime-environments.ts. A shared constant insrc/shared/would keep the desktop and web fences from drifting.src/renderer/src/env.d.ts (1)
74-85: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReuse
TerminalWorktreeParkingDebugVerdict.Reference the exported
.tstype instead of duplicating its anonymous shape in this declaration. As per coding guidelines, “Prefer regular.tstype declarations over.d.tsfiles when defining types.”Source: Coding guidelines
src/main/runtime/rpc/methods/terminal.ts (1)
3025-3026: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
!sendBinaryis unreachable here.This block only runs after the
if (!useBinaryStream) { … return }early return at Line 2564, anduseBinaryStreamrequiresBoolean(sendBinary)(Line 2470). So the second operand can never contribute andtruncatedis justinitialOutputOverflowed. Consider dropping it (or hoisting the JSON-path fallback comment) to avoid implying a live fallback.♻️ Simplify
- truncated: - initialOutputOverflowed || (!sendBinary && isTerminalReadPayloadIncomplete(read)), + truncated: initialOutputOverflowed,tests/e2e/paired-remote-terminal-stall-recovery.spec.ts (1)
44-66: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
shellQuote/fixtureCommand/callRuntimeare copied verbatim into three new paired-runtime e2e specs. The shared root cause is that notests/e2e/helpers/module owns fixture-command construction or the paired-client runtime RPC call, so each spec re-implements the Windows-vs-POSIX quoting and thewindow.api.runtime.callunwrapper — three places to fix any quoting bug.
tests/e2e/paired-remote-terminal-stall-recovery.spec.ts#L44-L66: replace the localshellQuote/fixtureCommand/callRuntimewith imports from the new helper module, passing the fixture path/args in.tests/e2e/headless-paired-remote-terminal-stall-recovery.spec.ts#L43-L65: same replacement; this copy is identical apart from the marker-lessfixtureCommand()signature.tests/e2e/paired-remote-terminal-truncated-tail-first-paint.spec.ts#L48-L70: same replacement; this copy'sfixtureCommand(marker)takes an extra arg, so give the shared helper a variadic args parameter.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 80f12b5b-5b28-471c-bfcd-418132d1ddda
📒 Files selected for processing (34)
config/reliability-gates.jsoncsrc/main/ipc/runtime-environment-connectivity-handlers.tssrc/main/ipc/runtime-environments.test.tssrc/main/ipc/runtime-environments.tssrc/main/runtime/rpc/methods/terminal.tssrc/main/runtime/rpc/terminal-multiplex.test.tssrc/main/runtime/rpc/terminal-subscribe-buffer.test.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/src/components/Terminal.tsxsrc/renderer/src/components/settings/RuntimeEnvironmentsPane.tsxsrc/renderer/src/components/status-bar/SshStatusSegment.tsxsrc/renderer/src/components/status-bar/runtime-environment-explicit-connect.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/replay-guard.test.tssrc/renderer/src/components/terminal-pane/replay-guard.tssrc/renderer/src/components/terminal-pane/terminal-hidden-worktree-retention.test.tssrc/renderer/src/components/terminal-pane/terminal-hidden-worktree-retention.tssrc/renderer/src/components/terminal-pane/terminal-parking-e2e-overrides.tssrc/renderer/src/env.d.tssrc/renderer/src/lib/e2e-config.tssrc/renderer/src/runtime/remote-runtime-terminal-multiplexer.tssrc/renderer/src/runtime/remote-runtime-terminal-stall-recovery.test.tssrc/renderer/src/runtime/remote-terminal-stream-watchdog.tssrc/renderer/src/web/web-preload-api.test.tssrc/renderer/src/web/web-preload-api.tstests/e2e/headless-paired-remote-terminal-stall-recovery.spec.tstests/e2e/helpers/headless-paired-runtime-host.tstests/e2e/helpers/paired-electron-client.tstests/e2e/helpers/paired-web-client-url.tstests/e2e/paired-remote-terminal-retention-memory.spec.tstests/e2e/paired-remote-terminal-stall-recovery.spec.tstests/e2e/paired-remote-terminal-truncated-tail-first-paint.spec.tstests/e2e/paired-runtime-retention-metrics.ts
Greptile SummaryThis PR introduces a capability-gated parking lifecycle for paired (remote-runtime) terminals: when the host advertises
Confidence Score: 5/5Safe to merge; the change is well-scoped behind a capability flag and the existing legacy path is untouched. The parking lifecycle is gated on Files Needing Attention: The two-tier stall watchdog in
|
| Filename | Overview |
|---|---|
| src/renderer/src/components/terminal-pane/pty-connection.ts | Routes capability-approved paired park reveals through the reattach coordinator; adds prefetched host snapshot path for remote PTYs on reveal, with correct ordering guards and fallback to null (not SSH model probe) for remote PTYs. |
| src/renderer/src/runtime/remote-terminal-stream-watchdog.ts | New two-tier stall watchdog; delivery timer is not reset when additional bytes arrive while one is already armed, and a command-response probe does not suppress a concurrent delivery-credit trip. |
| src/renderer/src/runtime/remote-runtime-terminal-multiplexer.ts | Integrates per-stream watchdog, capacity-rejection flag, and backoff retry; stream-limit error is handled via a sentinel flag before the end event, correctly routing retry through backoff. |
| src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts | Adds attachment-ready waiter set to gate serializeBuffer until the stream is fully attached; setAttachmentUnavailable correctly resolves all pending waiters with false on disconnect/destroy. |
| src/renderer/src/components/terminal-pane/terminal-parked-tab-watchers.ts | Gains incremental reconciliation of parked watchers when PTY IDs change; correctly preserves titles for retained PTYs and clears titles for retired PTYs during restart-all paths. |
| src/renderer/src/components/terminal-pane/terminal-parked-pty-watcher.ts | New file extracting per-PTY watcher startup; correctly skips subscribeToPtyExit for remote PTYs (exit events arrive via side-effect facts channel). |
| src/renderer/src/components/terminal-pane/terminal-parked-watcher-reconciliation.ts | New file with reconcileParkedWatcherPtyIds and stricter capturedIsCurrent validation requiring leaf+ptyId agreement. |
| src/renderer/src/web/web-preload-api.ts | Adds manuallyDisconnectedEnvironmentIds fencing with structured responses from queue factory; disconnect now preserves activeEnvironment for reconnect while remove clears it. |
| src/main/ipc/runtime-environment-connectivity-handlers.ts | New file extracting connectivity IPC handlers with pre- and post-call disconnect checks and a connect handler that clears the fence. |
| src/main/runtime/orca-runtime.ts | Adds serializeAuthoritativeTerminalBuffer and splits sideEffect consumer availability to dispatch facts over both local IPC and the paired client event stream. |
Reviews (5): Last reviewed commit: "fix(remote): harden terminal recovery li..." | Re-trigger Greptile
…oad-issue # Conflicts: # config/reliability-gates.jsonc # src/main/runtime/rpc/methods/terminal.ts # src/main/runtime/rpc/terminal-multiplex.test.ts # src/renderer/src/runtime/remote-runtime-terminal-multiplexer.ts
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/renderer/src/components/terminal-pane/terminal-parked-tab-watchers.ts (1)
294-348: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy liftReconciliation restart can silently wipe a continuing pane's tracked title.
When
reconcileParkedWatcherPtyIdsflagsrestart: truebecause only some of a multi-leaf tab's PTYs leftexpectedPtyIds(e.g. one leaf is local/always-restorable and a sibling paired leaf's environment capability drops while parked),disposeParkedTabWatchers(tab.id)tears down every watcher for the tab — not just the retired one. The realstartParkedTerminalByteWatcherdispose() unconditionally clears the runtime pane title slot wheneverwroteRuntimeTitleSlotis true (regardless of whether the pane is actually leaving parked state). SinceresolveParkedTerminalPaneCandidatesreassigns the samepaneIdto a continuing pane (via thecapturedPanesByTabIdlookup), the immediately-followingstartParkedTabWatchers()readsinitialTitlefrom the very slot that was just cleared, losing the continuing pane's last-known title.This interaction isn't exercised by
terminal-parked-tab-watchers.test.tssincestartParkedTerminalByteWatcher(and its dispose behavior) is fully mocked there.Consider disposing/restarting only the PTYs identified as changed (retired + newly-expected), leaving continuing entries in
disposersByPtyIduntouched, rather than a blanket dispose-all/restart-all — similar to howdisposeParkedTerminalWatchersForPtyIdsalready does surgical disposal elsewhere in this file.
🧹 Nitpick comments (10)
src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.ts (1)
3159-3162: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDerive the backoff window instead of hardcoding 249/1 ms.
The split advance encodes an implicit 250 ms first-backoff constant; if the transport's backoff base changes this test fails for a non-obvious reason. Importing/exporting the constant (or asserting
>= base) keeps intent readable.src/renderer/src/web/web-preload-api.ts (1)
3163-3183: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDuplicate manual-disconnect fencing logic across both call wrappers.
callRuntimeEnvelopeandcallEnvironmentEnveloperepeat the identical pre-check / in-closure-check / post-check fencing sequence aroundmanuallyDisconnectedEnvironmentIds. Extracting this into a shared helper would prevent the two call sites from drifting if the fencing algorithm is ever adjusted.♻️ Proposed extraction
+async function callFencedEnvelope<TResult = unknown>( + environment: RuntimeEnvironmentRecord, + method: string, + params: unknown, + timeoutMs: number | undefined +): Promise<RuntimeRpcResponse<TResult>> { + if (manuallyDisconnectedEnvironmentIds.has(environment.id)) { + return manuallyDisconnectedResponse(environment) + } + const response = await runtimeCallQueuePool.enqueue(environment.id, method, () => { + if (manuallyDisconnectedEnvironmentIds.has(environment.id)) { + return Promise.resolve(manuallyDisconnectedResponse(environment)) + } + return getClientForEnvironment(environment).call(method, params, { timeoutMs }) + }) + if (manuallyDisconnectedEnvironmentIds.has(environment.id)) { + return manuallyDisconnectedResponse(environment) + } + updateEnvironmentFromResponse(environment, response) + return response as RuntimeRpcResponse<TResult> +} + async function callRuntimeEnvelope<TResult = unknown>( method: string, params?: unknown, timeoutMs?: number ): Promise<RuntimeRpcResponse<TResult>> { const environment = requireActiveEnvironment() - if (manuallyDisconnectedEnvironmentIds.has(environment.id)) { - return manuallyDisconnectedResponse(environment) - } - const response = await runtimeCallQueuePool.enqueue(environment.id, method, () => { - if (manuallyDisconnectedEnvironmentIds.has(environment.id)) { - return Promise.resolve(manuallyDisconnectedResponse(environment)) - } - return getClientForEnvironment(environment).call(method, params, { timeoutMs }) - }) - if (manuallyDisconnectedEnvironmentIds.has(environment.id)) { - return manuallyDisconnectedResponse(environment) - } - updateEnvironmentFromResponse(environment, response) - return response as RuntimeRpcResponse<TResult> + return callFencedEnvelope<TResult>(environment, method, params, timeoutMs) }Also applies to: 3185-3206
src/renderer/src/web/web-preload-api.test.ts (1)
516-531: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssertion only checks one of eight resolved calls is fenced.
All 8
activeCallsresolve their underlyingcall()promise afterdisconnect()fires, so per the fencing logic inweb-preload-api.ts, every one should hit the post-enqueue check and resolve toruntime_manually_disconnected— not just one.expect.arrayContaining([...])only requires a single match, so a regression that lets some in-flight responses leak through unfenced would still pass this test.✅ Tighter assertion
- await expect(Promise.all(activeCalls)).resolves.toEqual( - expect.arrayContaining([ - expect.objectContaining({ - ok: false, - error: expect.objectContaining({ code: 'runtime_manually_disconnected' }) - }) - ]) - ) + await expect(Promise.all(activeCalls)).resolves.toEqual( + Array.from({ length: 8 }, () => + expect.objectContaining({ + ok: false, + error: expect.objectContaining({ code: 'runtime_manually_disconnected' }) + }) + ) + )src/main/runtime/orca-runtime.test.ts (1)
8491-8521: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMislabeled
sourcein the provider-history mock.The mocked
serializeProviderBufferresult setssource: 'headless', but this test is specifically verifying that authoritative provider history is preferred over the headless mirror — the fallback test below correctly usessource: 'headless'for the mirror case. Sincesourceisn't asserted here it doesn't break the test, but it's a confusing fixture that could mislead readers about whatsourcevalue the provider path actually returns.✏️ Suggested fixture fix
const serializeProviderBuffer = vi.fn().mockResolvedValue({ data: 'authoritative screen\r\n', scrollbackAnsi: 'deep provider history\r\n', cols: 120, rows: 40, seq: 900, - source: 'headless' + source: 'provider' })src/main/runtime/rpc/methods/terminal.ts (1)
2090-2098: 🩺 Stability & Availability | 🔵 TrivialCapacity split looks correctly enforced.
Traced the pending-wait and active-stream checks against the
pendingPtyWaitControllers/streamsmap mutations — no TOCTOU gap (checks and mutations run in the same synchronous block relative to the surrounding awaits) and pending-wait slots are always released in thefinallyblock regardless of outcome, so no leak on active-limit rejection after a pending wait resolves.One thing worth confirming: splitting the single combined cap into independent active (64) and pending (32) budgets raises the theoretical per-connection ceiling from 64 to up to 96 concurrent server-side resources (open stream slots + pending abort-controller/mount-request state). If this is intentional headroom for the paired-runtime stall-recovery flow, no action needed; otherwise it may be worth re-checking against server-side connection capacity planning.
Also applies to: 2149-2153
src/renderer/src/runtime/runtime-terminal-stream.ts (1)
99-106: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueSimplify nested
onSnapshotfallback condition.The nested
if (!options?.startAtLiveTail) { if (!options?.onSnapshot) { watcher(data) } }is equivalent to a single flattened condition and is slightly harder to scan.♻️ Suggested simplification
onSnapshot: (data, meta) => { options?.onSnapshot?.(data, meta) - if (!options?.startAtLiveTail) { - if (!options?.onSnapshot) { - watcher(data) - } - } + if (!options?.startAtLiveTail && !options?.onSnapshot) { + watcher(data) + } },src/renderer/src/components/terminal-pane/terminal-parked-tab-watchers.test.ts (1)
230-246: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winTautological assertion doesn't test the remote-runtime exit-subscription skip.
ParkedTerminalByteWatcherOptionsnever has anonPtyExitfield for any PTY kind, sonot.toHaveProperty('onPtyExit')always passes and doesn't exercise the actual remote-runtime behavior difference — thatsubscribeToPtyExitis skipped (isRemoteRuntimePtyId(ptyId) ? () => {} : subscribeToPtyExit(...)interminal-parked-tab-watchers.ts). Assert onexitSubscriptionsinstead to cover that branch.✅ Proposed fix
expect(startParkedTerminalByteWatcher).toHaveBeenCalledTimes(1) expect(startedWatchers[0].options).toMatchObject({ ptyId: 'remote:env-1@@terminal-1' }) - expect(startedWatchers[0].options).not.toHaveProperty('onPtyExit') + // Remote-runtime PTYs are retired authoritatively by the paired host, + // so no local exit sidecar should be registered for them. + expect(exitSubscriptions.find((entry) => entry.ptyId === 'remote:env-1@@terminal-1')).toBeUndefined() })src/renderer/src/components/terminal-pane/pty-connection.ts (2)
7712-7727: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winSkip the remote prefetch when an authoritative snapshot already arrived.
connectResultis known here, and thesnapshotbranch inapplyReattachPayloadtakes strict precedence overprefetchedParkModelSnapshot. For a remote-runtime park-reveal that came back withconnectResult.snapshot, thisawait serializeHiddenOutputSnapshot(...)round-trip is discarded work that delays first paint by a full host RPC.♻️ Gate the remote prefetch on the absence of a snapshot
- if (revealFollowsTerminalPark && (!hasStructuralReplay || isRemoteRuntimePtyId(ptyId))) { + if ( + revealFollowsTerminalPark && + !connectResult?.snapshot && + (!hasStructuralReplay || isRemoteRuntimePtyId(ptyId)) + ) {
772-781: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider reusing the shared capability selector.
selectPairedRuntimeParkingEnvironmentIdsinterminal-hidden-view-parking.tsencodes the sameruntimeStatusByEnvironmentId→ capability check. Deriving this predicate from that helper keeps the paired-parking evidence rule in one place if the capability gate later gains conditions.tests/e2e/helpers/paired-terminal-parking-oracle.ts (1)
153-192: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winLag probe leaks if the parking-verdict poll fails.
lagProbe.stop()/dispose()only run on the success path. When theexpect.poll(...).toEqual(...)above throws, the probe handle stays alive and keeps sampling for the remainder of the run, which can distort later measurements and leaks a JSHandle. Wrap the probe lifetime in its owntry/finally(or dispose it in the outerfinally).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: c88221cc-8996-4744-89af-c8c0743b759e
📒 Files selected for processing (44)
config/reliability-gates.jsoncsrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/terminal.tssrc/main/runtime/rpc/terminal-multiplex.test.tssrc/renderer/src/components/Terminal.tsxsrc/renderer/src/components/terminal-pane/parked-terminal-byte-watcher.test.tssrc/renderer/src/components/terminal-pane/parked-terminal-byte-watcher.tssrc/renderer/src/components/terminal-pane/pty-connection.test.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.tssrc/renderer/src/components/terminal-pane/terminal-hidden-view-parking.test.tssrc/renderer/src/components/terminal-pane/terminal-hidden-view-parking.tssrc/renderer/src/components/terminal-pane/terminal-parked-tab-watchers.test.tssrc/renderer/src/components/terminal-pane/terminal-parked-tab-watchers.tssrc/renderer/src/components/terminal-pane/terminal-parked-watcher-reconciliation.test.tssrc/renderer/src/components/terminal-pane/terminal-parked-watcher-reconciliation.tssrc/renderer/src/components/terminal-pane/terminal-side-effect-facts-handler.test.tssrc/renderer/src/components/terminal-pane/terminal-side-effect-facts-handler.tssrc/renderer/src/env.d.tssrc/renderer/src/hooks/useIpcEvents.tssrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/runtime/remote-runtime-terminal-multiplexer.tssrc/renderer/src/runtime/remote-runtime-terminal-stall-recovery.test.tssrc/renderer/src/runtime/runtime-client-events.test.tssrc/renderer/src/runtime/runtime-client-events.tssrc/renderer/src/runtime/runtime-terminal-stream.tssrc/renderer/src/web/web-preload-api.test.tssrc/renderer/src/web/web-preload-api.tssrc/shared/protocol-version.tssrc/shared/runtime-client-events.tssrc/shared/terminal-multiplex-flow-control.tstests/e2e/headless-paired-remote-terminal-retention-memory.spec.tstests/e2e/headless-paired-remote-terminal-stall-recovery.spec.tstests/e2e/helpers/headless-paired-runtime-host.tstests/e2e/helpers/paired-electron-client.tstests/e2e/helpers/paired-terminal-parking-fixture.tstests/e2e/helpers/paired-terminal-parking-oracle.tstests/e2e/paired-remote-terminal-retention-memory.spec.tstests/e2e/paired-remote-terminal-truncated-tail-first-paint.spec.ts
🚧 Files skipped from review as they are similar to previous changes (4)
- src/renderer/src/i18n/locales/zh.json
- src/renderer/src/i18n/locales/es.json
- src/renderer/src/i18n/locales/ja.json
- src/renderer/src/i18n/locales/ko.json
There was a problem hiding this comment.
Actionable comments posted: 2
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)
1935-1957: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winClose source range ledgers when detaching consumers.
detachSourceRangeConsumertransfers and cancels ranges, then leaves the ledger’sretainedBytesintact and the registry entry registered for the connection lifetime, so accumulated subscriptions can hitTERMINAL_MULTIPLEX_MAX_ACTIVE_STREAMS_PER_CONNECTIONand makesourceRangeRegistry.open()returns stop accepting source-range consumers.🔧 Proposed fix
const transfer = ledger.beginTransfer() const ranges = transfer.frames.flatMap((frame) => frame.sourceRanges) try { runtime.cancelRemoteTerminalSourceRanges(identity, ranges, reason) } finally { transfer.commit() + ledger.close() }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 24483b0c-c8e2-4c68-85b0-f93c45b8236f
📒 Files selected for processing (8)
config/reliability-gates.jsoncsrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/terminal.tssrc/main/runtime/rpc/terminal-multiplex.test.tssrc/main/runtime/rpc/terminal-source-range-registry.tssrc/renderer/src/components/terminal-pane/pty-connection.test.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.ts
|
Follow-up review pass is complete. An outside-diff parked-watcher title-loss issue was confirmed and fixed with surgical per-PTY reconciliation, so continuing remote PTYs keep their watchers and runtime titles while only changed PTYs are replaced. Validation is green: 1,167 focused tests (1 existing skip), the 1,938-test paired-terminal reliability slice (1 existing skip), typecheck, lint, formatting for every changed file, |
rc.1 incident follow-up and deterministic refresh reproduction
The new screenshot failure (
The fix preserves ready waiters and pending calls only across this reachability-triggered refresh. The original deadline remains active; ordinary close/error/manual-disconnect paths still reject. The transport oracle requires exactly two connections, one host RPC, a successful response, zero pending calls, and zero retained request bytes. Red-before produced the exact error; the updated branch passes all 27 focused tests. The RDP observation adds an independent lifecycle signal: opening the parked terminal on the Windows host caused the existing client terminal to recover. That means the host and PTY were reachable, but client recovery depended on mounting/waking the host renderer. The headed paired-runtime oracle now keeps the host on its original workspace and asserts zero target pane managers are mounted there throughout recovery. The client still restores row 4,000, output produced while parked, the same PTY identity, and continued live input/output. Post-merge validation at
For affected rc.1 installations, the least-bad workaround is to fully start the server first and then restart the client. Opening the host terminal via RDP can wake this failure class, but it is not durable and should not be required after this fix. |
Summary
Deterministic reproduction and causal chain
The headed paired-runtime harness reproduced the blank/deep-scrollback failure:
The first candidate still failed because the initial current-screen replay won over the requested deep snapshot. The final fix routes only capability-approved parked paired remounts through reattach, waits for stream attachment, then asks the host for authoritative bounded history before releasing queued live bytes.
The same byte-identical six-terminal oracle is green against:
orca servehost plus the same client flow.Disabling
terminal.paired-parking.v1makes that oracle fail at its capability precondition, while the separate legacy fallback oracle remains green.Behavior and tradeoff
Freeze/performance impact
The headed and headless oracles each create six real paired host PTYs with bounded high-output scrollback, ordinary-park five client xterms with the lossy retention budget disabled, and require:
This directly removes the known remote hidden-xterm retention pressure that can exacerbate multi-GB renderer/CPU freezes. It does not claim to fix every renderer freeze. The macOS display-only reveal/WebGL-atlas latency class remains separate.
Screenshots
No visual change.
Testing
pnpm run typecheckpnpm run lintgit diff --checkThe focused reliability suite covers capability routing, provider-authoritative snapshots, reattach ordering, raw-stream release, side-effect delivery and timed cleanup, split-leaf remints, stream capacity/backoff, queued manual-disconnect fencing, and headless launch cleanup.
Security audit
Remaining gaps