Repository navigation
fix(remote): accelerate terminal recovery on resume/online - #8255
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:
📝 WalkthroughWalkthroughThis change adds pause-aware socket and WebSocket liveness probing, structured runtime subscription results, shared-control reconnect and timeout handling, query-replay framing, and coordinated remote terminal recovery. Renderer PTY transports now use staged generation-fenced rebinding with input, viewport, replay, and stale-callback protection. New session-tab resolution and recovery coordination modules support retries and snapshot-based handle repair. Tests cover IPC errors, liveness, reconnects, recovery ordering, PTY lifecycle behavior, wake retries, and replay completion. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 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.
🧹 Nitpick comments (2)
src/renderer/src/components/terminal-pane/use-terminal-window-wake-recovery.test.ts (1)
107-118: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winConsider restoring the visibility spy in a
finallyblock.If an assertion on lines 115-116 throws,
visibilityStateSpy.mockRestore()on line 117 won't execute, potentially leaking the stubbedvisibilityStateinto subsequent tests. Wrapping intry/finallyor relying on a globalrestoreMocksconfig would be safer.♻️ Proposed fix
it('retries remote terminal recovery on system resume while the document is hidden', () => { const visibilityStateSpy = vi .spyOn(document, 'visibilityState', 'get') .mockReturnValue('hidden') - renderWakeRecoveryHook() - - systemResumedCallback?.() - - expect(retryRemoteRuntimeTerminalRecoveriesNowMock).toHaveBeenCalledTimes(1) - expect(recoverVisibleTerminalWindowWakeMock).not.toHaveBeenCalled() - visibilityStateSpy.mockRestore() + try { + renderWakeRecoveryHook() + + systemResumedCallback?.() + + expect(retryRemoteRuntimeTerminalRecoveriesNowMock).toHaveBeenCalledTimes(1) + expect(recoverVisibleTerminalWindowWakeMock).not.toHaveBeenCalled() + } finally { + visibilityStateSpy.mockRestore() + } })src/renderer/src/runtime/remote-runtime-terminal-recovery-coordinator.ts (1)
140-146: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider logging swallowed errors in
invokeSafelyfor debuggability.The silent catch is justified by the comment, but provides zero observability if
onIdleever throws. Aconsole.errorwould help diagnose coordinator lifecycle issues without blocking cleanup.♻️ Optional: add debug logging
function invokeSafely(callback: () => void): void { try { callback() } catch (error) { - // External callbacks cannot block cleanup or singleton release. + // External callbacks cannot block cleanup or singleton release. + console.error('[remote-runtime-terminal-recovery] onIdle callback threw', error) } }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 7f0f5ed3-a467-4c69-a55b-a46b4ecacf0f
📥 Commits
Reviewing files that changed from the base of the PR and between 20ebe85 and 9af0a2e2e05110e023a742f4d268cdf5d6b09e60.
📒 Files selected for processing (46)
config/localization-coverage-allowlist.jsondocs/reference/2026-07-11-remote-runtime-terminal-recovery-design.mdsrc/main/ipc/runtime-environments.test.tssrc/main/ipc/runtime-environments.tssrc/main/runtime/rpc/ws-transport.test.tssrc/main/runtime/rpc/ws-transport.tssrc/preload/runtime-environment-subscriptions.test.tssrc/preload/runtime-environment-subscriptions.tssrc/renderer/src/components/terminal-pane/pty-connection.test.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/pty-transport-types.tssrc/renderer/src/components/terminal-pane/pty-transport.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-input.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-lifecycle.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-ordering.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-test-fixture.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-staged-rebind.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/remote-runtime-terminal-gone-error.tssrc/renderer/src/components/terminal-pane/use-terminal-window-wake-recovery.test.tssrc/renderer/src/components/terminal-pane/use-terminal-window-wake-recovery.tssrc/renderer/src/runtime/remote-runtime-host-terminal-resolution.test.tssrc/renderer/src/runtime/remote-runtime-host-terminal-resolution.tssrc/renderer/src/runtime/remote-runtime-session-tabs-recovery-subscription.tssrc/renderer/src/runtime/remote-runtime-terminal-multiplexer.tssrc/renderer/src/runtime/remote-runtime-terminal-recovery-coordinator.test.tssrc/renderer/src/runtime/remote-runtime-terminal-recovery-coordinator.tssrc/renderer/src/runtime/remote-runtime-terminal-recovery-registry.tssrc/renderer/src/runtime/remote-runtime-terminal-recovery-types.tssrc/shared/remote-runtime-client-error-classification.test.tssrc/shared/remote-runtime-client-error-classification.tssrc/shared/remote-runtime-client.test.tssrc/shared/remote-runtime-shared-control-connection.test.tssrc/shared/remote-runtime-shared-control-connection.tssrc/shared/remote-runtime-shared-control-frame-handler.tssrc/shared/remote-runtime-shared-control-keepalive-refresh.test.tssrc/shared/remote-runtime-shared-control-open.tssrc/shared/remote-runtime-shared-control-reconnect-delay.test.tssrc/shared/remote-runtime-shared-control-reconnect.tssrc/shared/remote-runtime-shared-control-requests.tssrc/shared/remote-runtime-shared-control-state.tssrc/shared/remote-runtime-shared-control-subscription-start.tssrc/shared/remote-runtime-shared-control-types.tssrc/shared/remote-runtime-socket-liveness.test.tssrc/shared/remote-runtime-socket-liveness.ts
CodeRabbit nitpick dispositions
|
9af0a2e to
11364b8
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 10e9e7ea-db3d-41f0-b93f-bbc0efcb8811
📥 Commits
Reviewing files that changed from the base of the PR and between 9af0a2e2e05110e023a742f4d268cdf5d6b09e60 and 11364b82ab6d021b1f32f85ddea2ec6aca625062.
📒 Files selected for processing (58)
config/localization-coverage-allowlist.jsondocs/reference/2026-07-11-remote-runtime-terminal-recovery-design.mdsrc/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/ws-transport.test.tssrc/main/runtime/rpc/ws-transport.tssrc/preload/runtime-environment-subscriptions.test.tssrc/preload/runtime-environment-subscriptions.tssrc/renderer/src/components/settings/RuntimeEnvironmentsPane.tsxsrc/renderer/src/components/status-bar/SshStatusSegment.tsxsrc/renderer/src/components/terminal-pane/pty-connection.test.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/pty-transport-types.tssrc/renderer/src/components/terminal-pane/pty-transport.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-input.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-lifecycle.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-ordering.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-test-fixture.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-staged-rebind.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/remote-runtime-terminal-gone-error.tssrc/renderer/src/components/terminal-pane/use-terminal-window-wake-recovery.test.tssrc/renderer/src/components/terminal-pane/use-terminal-window-wake-recovery.tssrc/renderer/src/runtime/remote-runtime-host-terminal-resolution.test.tssrc/renderer/src/runtime/remote-runtime-host-terminal-resolution.tssrc/renderer/src/runtime/remote-runtime-session-tabs-recovery-subscription.tssrc/renderer/src/runtime/remote-runtime-terminal-frame-drop-resync.test.tssrc/renderer/src/runtime/remote-runtime-terminal-multiplexer.tssrc/renderer/src/runtime/remote-runtime-terminal-recovery-coordinator.test.tssrc/renderer/src/runtime/remote-runtime-terminal-recovery-coordinator.tssrc/renderer/src/runtime/remote-runtime-terminal-recovery-lifecycle.test.tssrc/renderer/src/runtime/remote-runtime-terminal-recovery-registry.tssrc/renderer/src/runtime/remote-runtime-terminal-recovery-types.tssrc/renderer/src/runtime/runtime-environment-connection-lifecycle.test.tssrc/renderer/src/runtime/runtime-environment-connection-lifecycle.tssrc/renderer/src/web/web-preload-api.test.tssrc/renderer/src/web/web-preload-api.tssrc/shared/remote-runtime-client-error-classification.test.tssrc/shared/remote-runtime-client-error-classification.tssrc/shared/remote-runtime-client.test.tssrc/shared/remote-runtime-shared-control-connection.test.tssrc/shared/remote-runtime-shared-control-connection.tssrc/shared/remote-runtime-shared-control-frame-handler.tssrc/shared/remote-runtime-shared-control-keepalive-refresh.test.tssrc/shared/remote-runtime-shared-control-open.tssrc/shared/remote-runtime-shared-control-reconnect-delay.test.tssrc/shared/remote-runtime-shared-control-reconnect.tssrc/shared/remote-runtime-shared-control-requests.tssrc/shared/remote-runtime-shared-control-state.tssrc/shared/remote-runtime-shared-control-subscription-start.tssrc/shared/remote-runtime-shared-control-types.tssrc/shared/remote-runtime-socket-liveness.test.tssrc/shared/remote-runtime-socket-liveness.tssrc/shared/terminal-stream-protocol.test.tssrc/shared/terminal-stream-protocol.ts
✅ Files skipped from review due to trivial changes (1)
- src/renderer/src/runtime/remote-runtime-terminal-recovery-types.ts
🚧 Files skipped from review as they are similar to previous changes (40)
- src/shared/remote-runtime-shared-control-types.ts
- config/localization-coverage-allowlist.json
- src/shared/remote-runtime-client-error-classification.ts
- src/renderer/src/components/terminal-pane/pty-transport-types.ts
- src/renderer/src/runtime/remote-runtime-host-terminal-resolution.ts
- src/shared/remote-runtime-client-error-classification.test.ts
- src/renderer/src/components/terminal-pane/use-terminal-window-wake-recovery.test.ts
- src/shared/remote-runtime-shared-control-open.ts
- src/preload/runtime-environment-subscriptions.ts
- src/shared/remote-runtime-shared-control-reconnect-delay.test.ts
- src/shared/remote-runtime-shared-control-frame-handler.ts
- src/shared/remote-runtime-client.test.ts
- src/renderer/src/runtime/remote-runtime-host-terminal-resolution.test.ts
- src/preload/runtime-environment-subscriptions.test.ts
- src/main/runtime/rpc/ws-transport.ts
- src/shared/remote-runtime-shared-control-subscription-start.ts
- src/main/runtime/rpc/ws-transport.test.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-lifecycle.test.ts
- src/renderer/src/components/terminal-pane/remote-runtime-terminal-gone-error.ts
- src/shared/remote-runtime-socket-liveness.test.ts
- src/shared/remote-runtime-socket-liveness.ts
- src/renderer/src/components/terminal-pane/pty-connection.test.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-test-fixture.ts
- src/shared/remote-runtime-shared-control-requests.ts
- src/shared/remote-runtime-shared-control-reconnect.ts
- src/renderer/src/runtime/remote-runtime-session-tabs-recovery-subscription.ts
- src/renderer/src/components/terminal-pane/use-terminal-window-wake-recovery.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-staged-rebind.ts
- src/main/ipc/runtime-environments.ts
- src/renderer/src/components/terminal-pane/pty-connection.ts
- src/renderer/src/components/terminal-pane/pty-transport.ts
- src/shared/remote-runtime-shared-control-connection.ts
- src/shared/remote-runtime-shared-control-state.ts
- src/renderer/src/runtime/remote-runtime-terminal-recovery-coordinator.test.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.ts
- src/main/ipc/runtime-environments.test.ts
- src/shared/remote-runtime-shared-control-keepalive-refresh.test.ts
- src/shared/remote-runtime-shared-control-connection.test.ts
- src/renderer/src/runtime/remote-runtime-terminal-recovery-registry.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
11364b8 to
e19b65e
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: a682d890-0a56-44cd-af89-702000423884
📥 Commits
Reviewing files that changed from the base of the PR and between 11364b82ab6d021b1f32f85ddea2ec6aca625062 and e19b65e15dddc222e06ae6f7a9f851dadc7c2fa5.
📒 Files selected for processing (64)
config/localization-coverage-allowlist.jsondocs/reference/2026-07-11-remote-runtime-terminal-recovery-design.mdsrc/main/ipc/runtime-environment-request-connections.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/ws-transport.test.tssrc/main/runtime/rpc/ws-transport.tssrc/main/system-resume-broadcast.test.tssrc/main/system-resume-broadcast.tssrc/preload/runtime-environment-subscriptions.test.tssrc/preload/runtime-environment-subscriptions.tssrc/renderer/src/components/settings/RuntimeEnvironmentsPane.tsxsrc/renderer/src/components/status-bar/SshStatusSegment.tsxsrc/renderer/src/components/terminal-pane/pty-connection.test.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/pty-transport-types.tssrc/renderer/src/components/terminal-pane/pty-transport.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-input.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-lifecycle.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-ordering.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-test-fixture.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-staged-binding-state.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-staged-rebind.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-staged-rebind.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/remote-runtime-terminal-gone-error.tssrc/renderer/src/components/terminal-pane/use-terminal-window-wake-recovery.test.tssrc/renderer/src/components/terminal-pane/use-terminal-window-wake-recovery.tssrc/renderer/src/runtime/remote-runtime-host-terminal-resolution.test.tssrc/renderer/src/runtime/remote-runtime-host-terminal-resolution.tssrc/renderer/src/runtime/remote-runtime-session-tabs-recovery-subscription.tssrc/renderer/src/runtime/remote-runtime-terminal-frame-drop-resync.test.tssrc/renderer/src/runtime/remote-runtime-terminal-multiplexer.tssrc/renderer/src/runtime/remote-runtime-terminal-recovery-coordinator.test.tssrc/renderer/src/runtime/remote-runtime-terminal-recovery-coordinator.tssrc/renderer/src/runtime/remote-runtime-terminal-recovery-lifecycle.test.tssrc/renderer/src/runtime/remote-runtime-terminal-recovery-registry.tssrc/renderer/src/runtime/remote-runtime-terminal-recovery-types.tssrc/renderer/src/runtime/runtime-environment-connection-lifecycle.test.tssrc/renderer/src/runtime/runtime-environment-connection-lifecycle.tssrc/renderer/src/web/web-preload-api.test.tssrc/renderer/src/web/web-preload-api.tssrc/shared/remote-runtime-client-error-classification.test.tssrc/shared/remote-runtime-client-error-classification.tssrc/shared/remote-runtime-client.test.tssrc/shared/remote-runtime-shared-control-connection.test.tssrc/shared/remote-runtime-shared-control-connection.tssrc/shared/remote-runtime-shared-control-frame-handler.tssrc/shared/remote-runtime-shared-control-keepalive-refresh.test.tssrc/shared/remote-runtime-shared-control-open.tssrc/shared/remote-runtime-shared-control-reconnect-delay.test.tssrc/shared/remote-runtime-shared-control-reconnect.tssrc/shared/remote-runtime-shared-control-requests.tssrc/shared/remote-runtime-shared-control-resume.test.tssrc/shared/remote-runtime-shared-control-state.tssrc/shared/remote-runtime-shared-control-subscription-start.tssrc/shared/remote-runtime-shared-control-types.tssrc/shared/remote-runtime-socket-liveness.test.tssrc/shared/remote-runtime-socket-liveness.tssrc/shared/terminal-stream-protocol.test.tssrc/shared/terminal-stream-protocol.ts
✅ Files skipped from review due to trivial changes (1)
- src/renderer/src/runtime/remote-runtime-terminal-recovery-types.ts
🚧 Files skipped from review as they are similar to previous changes (54)
- config/localization-coverage-allowlist.json
- src/shared/remote-runtime-client-error-classification.test.ts
- src/shared/terminal-stream-protocol.test.ts
- src/renderer/src/runtime/runtime-environment-connection-lifecycle.ts
- src/renderer/src/runtime/runtime-environment-connection-lifecycle.test.ts
- src/renderer/src/runtime/remote-runtime-host-terminal-resolution.test.ts
- src/shared/remote-runtime-shared-control-types.ts
- src/shared/remote-runtime-client-error-classification.ts
- src/shared/remote-runtime-shared-control-open.ts
- src/shared/remote-runtime-shared-control-reconnect-delay.test.ts
- src/shared/remote-runtime-client.test.ts
- src/renderer/src/runtime/remote-runtime-host-terminal-resolution.ts
- src/renderer/src/components/terminal-pane/remote-runtime-terminal-gone-error.ts
- src/shared/remote-runtime-shared-control-requests.ts
- src/renderer/src/web/web-preload-api.ts
- src/renderer/src/components/terminal-pane/use-terminal-window-wake-recovery.test.ts
- src/shared/remote-runtime-shared-control-frame-handler.ts
- src/renderer/src/web/web-preload-api.test.ts
- src/renderer/src/components/status-bar/SshStatusSegment.tsx
- src/shared/remote-runtime-shared-control-subscription-start.ts
- src/shared/terminal-stream-protocol.ts
- src/shared/remote-runtime-socket-liveness.ts
- src/renderer/src/runtime/remote-runtime-terminal-frame-drop-resync.test.ts
- src/renderer/src/components/terminal-pane/pty-connection.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-test-fixture.ts
- src/main/ipc/runtime-environments.test.ts
- src/shared/remote-runtime-socket-liveness.test.ts
- src/renderer/src/components/terminal-pane/pty-transport-types.ts
- src/renderer/src/components/terminal-pane/pty-connection.test.ts
- src/preload/runtime-environment-subscriptions.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-lifecycle.test.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-input.test.ts
- src/renderer/src/runtime/remote-runtime-terminal-recovery-lifecycle.test.ts
- src/renderer/src/components/terminal-pane/pty-transport.ts
- src/main/runtime/rpc/ws-transport.test.ts
- src/renderer/src/runtime/remote-runtime-session-tabs-recovery-subscription.ts
- src/renderer/src/runtime/remote-runtime-terminal-recovery-coordinator.ts
- src/shared/remote-runtime-shared-control-connection.ts
- src/main/ipc/runtime-environments.ts
- src/shared/remote-runtime-shared-control-state.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-ordering.test.ts
- src/shared/remote-runtime-shared-control-keepalive-refresh.test.ts
- src/shared/remote-runtime-shared-control-reconnect.ts
- src/renderer/src/runtime/remote-runtime-terminal-recovery-coordinator.test.ts
- src/preload/runtime-environment-subscriptions.test.ts
- src/renderer/src/runtime/remote-runtime-terminal-recovery-registry.ts
- src/shared/remote-runtime-shared-control-connection.test.ts
- src/renderer/src/components/settings/RuntimeEnvironmentsPane.tsx
- src/renderer/src/components/terminal-pane/remote-runtime-pty-staged-rebind.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.ts
- src/renderer/src/runtime/remote-runtime-terminal-multiplexer.ts
- src/main/runtime/rpc/terminal-multiplex.test.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
- src/main/runtime/rpc/methods/terminal.ts
e19b65e to
7360f6f
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
docs/reference/2026-07-11-remote-runtime-terminal-recovery-design.md (1)
149-168: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd direct-handle terminal outcome coverage to the release gate.
The design defines distinct retirement and no-retry behavior for direct handles, but the test plan only exercises host-mirror recovery and generic transport failures. Add deterministic cases for each known terminal-gone result and for an unknown
runtime_error, asserting exactly-once retirement, noterminal.create/terminal.close, and no retry loop.Also applies to: 267-293
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: e1a36a61-f943-48a3-9d0e-5617eaa61406
📥 Commits
Reviewing files that changed from the base of the PR and between e19b65e15dddc222e06ae6f7a9f851dadc7c2fa5 and 7360f6f9be2e6407fa6c4fd1e1fd0ff6c3c14600.
📒 Files selected for processing (66)
config/localization-coverage-allowlist.jsondocs/reference/2026-07-11-remote-runtime-terminal-recovery-design.mdsrc/main/ipc/runtime-environment-request-connections.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/ws-transport.test.tssrc/main/runtime/rpc/ws-transport.tssrc/main/system-resume-broadcast.test.tssrc/main/system-resume-broadcast.tssrc/preload/api-types.tssrc/preload/index.tssrc/preload/runtime-environment-subscriptions.test.tssrc/preload/runtime-environment-subscriptions.tssrc/renderer/src/components/settings/RuntimeEnvironmentsPane.tsxsrc/renderer/src/components/status-bar/SshStatusSegment.tsxsrc/renderer/src/components/terminal-pane/pty-connection.test.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/pty-transport-types.tssrc/renderer/src/components/terminal-pane/pty-transport.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-input.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-lifecycle.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-ordering.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-test-fixture.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-staged-binding-state.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-staged-rebind.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-staged-rebind.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/remote-runtime-terminal-gone-error.tssrc/renderer/src/components/terminal-pane/use-terminal-window-wake-recovery.test.tssrc/renderer/src/components/terminal-pane/use-terminal-window-wake-recovery.tssrc/renderer/src/runtime/remote-runtime-host-terminal-resolution.test.tssrc/renderer/src/runtime/remote-runtime-host-terminal-resolution.tssrc/renderer/src/runtime/remote-runtime-session-tabs-recovery-subscription.tssrc/renderer/src/runtime/remote-runtime-terminal-frame-drop-resync.test.tssrc/renderer/src/runtime/remote-runtime-terminal-multiplexer.tssrc/renderer/src/runtime/remote-runtime-terminal-recovery-coordinator.test.tssrc/renderer/src/runtime/remote-runtime-terminal-recovery-coordinator.tssrc/renderer/src/runtime/remote-runtime-terminal-recovery-lifecycle.test.tssrc/renderer/src/runtime/remote-runtime-terminal-recovery-registry.tssrc/renderer/src/runtime/remote-runtime-terminal-recovery-types.tssrc/renderer/src/runtime/runtime-environment-connection-lifecycle.test.tssrc/renderer/src/runtime/runtime-environment-connection-lifecycle.tssrc/renderer/src/web/web-preload-api.test.tssrc/renderer/src/web/web-preload-api.tssrc/shared/remote-runtime-client-error-classification.test.tssrc/shared/remote-runtime-client-error-classification.tssrc/shared/remote-runtime-client.test.tssrc/shared/remote-runtime-shared-control-connection.test.tssrc/shared/remote-runtime-shared-control-connection.tssrc/shared/remote-runtime-shared-control-frame-handler.tssrc/shared/remote-runtime-shared-control-keepalive-refresh.test.tssrc/shared/remote-runtime-shared-control-open.tssrc/shared/remote-runtime-shared-control-reconnect-delay.test.tssrc/shared/remote-runtime-shared-control-reconnect.tssrc/shared/remote-runtime-shared-control-requests.tssrc/shared/remote-runtime-shared-control-resume.test.tssrc/shared/remote-runtime-shared-control-state.tssrc/shared/remote-runtime-shared-control-subscription-start.tssrc/shared/remote-runtime-shared-control-types.tssrc/shared/remote-runtime-socket-liveness.test.tssrc/shared/remote-runtime-socket-liveness.tssrc/shared/terminal-stream-protocol.test.tssrc/shared/terminal-stream-protocol.ts
✅ Files skipped from review due to trivial changes (1)
- config/localization-coverage-allowlist.json
🚧 Files skipped from review as they are similar to previous changes (60)
- src/shared/terminal-stream-protocol.test.ts
- src/shared/remote-runtime-client-error-classification.test.ts
- src/shared/remote-runtime-shared-control-resume.test.ts
- src/renderer/src/components/terminal-pane/pty-transport-types.ts
- src/renderer/src/runtime/runtime-environment-connection-lifecycle.ts
- src/shared/remote-runtime-client-error-classification.ts
- src/shared/remote-runtime-shared-control-types.ts
- src/renderer/src/runtime/runtime-environment-connection-lifecycle.test.ts
- src/shared/remote-runtime-shared-control-frame-handler.ts
- src/main/system-resume-broadcast.test.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-staged-binding-state.ts
- src/renderer/src/runtime/remote-runtime-terminal-recovery-types.ts
- src/renderer/src/components/terminal-pane/pty-connection.ts
- src/shared/remote-runtime-shared-control-open.ts
- src/renderer/src/web/web-preload-api.ts
- src/renderer/src/runtime/remote-runtime-host-terminal-resolution.ts
- src/renderer/src/components/terminal-pane/remote-runtime-terminal-gone-error.ts
- src/shared/remote-runtime-shared-control-subscription-start.ts
- src/renderer/src/web/web-preload-api.test.ts
- src/main/ipc/runtime-environment-request-connections.ts
- src/renderer/src/runtime/remote-runtime-host-terminal-resolution.test.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-staged-rebind.test.ts
- src/main/runtime/rpc/ws-transport.ts
- src/main/system-resume-broadcast.ts
- src/renderer/src/components/settings/RuntimeEnvironmentsPane.tsx
- src/renderer/src/runtime/remote-runtime-terminal-recovery-lifecycle.test.ts
- src/shared/remote-runtime-shared-control-reconnect-delay.test.ts
- src/renderer/src/components/status-bar/SshStatusSegment.tsx
- src/main/runtime/rpc/ws-transport.test.ts
- src/preload/runtime-environment-subscriptions.ts
- src/shared/remote-runtime-client.test.ts
- src/shared/remote-runtime-shared-control-state.ts
- src/renderer/src/components/terminal-pane/pty-connection.test.ts
- src/renderer/src/components/terminal-pane/pty-transport.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-input.test.ts
- src/main/ipc/runtime-environments.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-lifecycle.test.ts
- src/renderer/src/runtime/remote-runtime-terminal-recovery-registry.ts
- src/shared/terminal-stream-protocol.ts
- src/shared/remote-runtime-shared-control-connection.ts
- src/shared/remote-runtime-shared-control-requests.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-test-fixture.ts
- src/renderer/src/runtime/remote-runtime-terminal-frame-drop-resync.test.ts
- src/renderer/src/runtime/remote-runtime-terminal-recovery-coordinator.test.ts
- src/shared/remote-runtime-socket-liveness.ts
- src/shared/remote-runtime-socket-liveness.test.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-ordering.test.ts
- src/renderer/src/runtime/remote-runtime-session-tabs-recovery-subscription.ts
- src/renderer/src/runtime/remote-runtime-terminal-recovery-coordinator.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-staged-rebind.ts
- src/preload/runtime-environment-subscriptions.test.ts
- src/shared/remote-runtime-shared-control-reconnect.ts
- src/shared/remote-runtime-shared-control-connection.test.ts
- src/renderer/src/runtime/remote-runtime-terminal-multiplexer.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
- src/main/ipc/runtime-environments.test.ts
- src/main/runtime/rpc/terminal-multiplex.test.ts
- src/shared/remote-runtime-shared-control-keepalive-refresh.test.ts
- src/main/runtime/rpc/methods/terminal.ts
7360f6f to
0c52cac
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/renderer/src/components/settings/RuntimeEnvironmentsPane.tsx (1)
562-566: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a "why" comment for the
disconnectedByFocusSwitchoptimization.The conditional skip of
disconnectSavedRuntimeEnvironmentin non-local mode is a non-obvious constraint — it depends onswitchRuntimeEnvironment(null)already closing transport state. Per coding guidelines, add a brief comment explaining why the disconnect is skipped here.As per coding guidelines: "When code is driven by a design document or non-obvious constraint, add a brief one- or two-line comment explaining why it behaves that way, without restating the implementation."
💬 Suggested comment
if (!allowLocalRuntime) { + // Why: in non-local mode switching away from the active server already + // closes its transport and subscriptions, so skip the redundant disconnect. disconnectedByFocusSwitch = true }Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 324a31f9-697b-40cf-a2c3-30c0df0e6946
📥 Commits
Reviewing files that changed from the base of the PR and between 7360f6f9be2e6407fa6c4fd1e1fd0ff6c3c14600 and 0c52cac09de4b17cf0a404a3bb8e5810680d0480.
📒 Files selected for processing (66)
config/localization-coverage-allowlist.jsondocs/reference/2026-07-11-remote-runtime-terminal-recovery-design.mdsrc/main/ipc/runtime-environment-request-connections.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/ws-transport.test.tssrc/main/runtime/rpc/ws-transport.tssrc/main/system-resume-broadcast.test.tssrc/main/system-resume-broadcast.tssrc/preload/api-types.tssrc/preload/index.tssrc/preload/runtime-environment-subscriptions.test.tssrc/preload/runtime-environment-subscriptions.tssrc/renderer/src/components/settings/RuntimeEnvironmentsPane.tsxsrc/renderer/src/components/status-bar/SshStatusSegment.tsxsrc/renderer/src/components/terminal-pane/pty-connection.test.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/pty-transport-types.tssrc/renderer/src/components/terminal-pane/pty-transport.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-input.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-lifecycle.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-ordering.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-test-fixture.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-staged-binding-state.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-staged-rebind.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-staged-rebind.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/remote-runtime-terminal-gone-error.tssrc/renderer/src/components/terminal-pane/use-terminal-window-wake-recovery.test.tssrc/renderer/src/components/terminal-pane/use-terminal-window-wake-recovery.tssrc/renderer/src/runtime/remote-runtime-host-terminal-resolution.test.tssrc/renderer/src/runtime/remote-runtime-host-terminal-resolution.tssrc/renderer/src/runtime/remote-runtime-session-tabs-recovery-subscription.tssrc/renderer/src/runtime/remote-runtime-terminal-frame-drop-resync.test.tssrc/renderer/src/runtime/remote-runtime-terminal-multiplexer.tssrc/renderer/src/runtime/remote-runtime-terminal-recovery-coordinator.test.tssrc/renderer/src/runtime/remote-runtime-terminal-recovery-coordinator.tssrc/renderer/src/runtime/remote-runtime-terminal-recovery-lifecycle.test.tssrc/renderer/src/runtime/remote-runtime-terminal-recovery-registry.tssrc/renderer/src/runtime/remote-runtime-terminal-recovery-types.tssrc/renderer/src/runtime/runtime-environment-connection-lifecycle.test.tssrc/renderer/src/runtime/runtime-environment-connection-lifecycle.tssrc/renderer/src/web/web-preload-api.test.tssrc/renderer/src/web/web-preload-api.tssrc/shared/remote-runtime-client-error-classification.test.tssrc/shared/remote-runtime-client-error-classification.tssrc/shared/remote-runtime-client.test.tssrc/shared/remote-runtime-shared-control-connection.test.tssrc/shared/remote-runtime-shared-control-connection.tssrc/shared/remote-runtime-shared-control-frame-handler.tssrc/shared/remote-runtime-shared-control-keepalive-refresh.test.tssrc/shared/remote-runtime-shared-control-open.tssrc/shared/remote-runtime-shared-control-reconnect-delay.test.tssrc/shared/remote-runtime-shared-control-reconnect.tssrc/shared/remote-runtime-shared-control-requests.tssrc/shared/remote-runtime-shared-control-resume.test.tssrc/shared/remote-runtime-shared-control-state.tssrc/shared/remote-runtime-shared-control-subscription-start.tssrc/shared/remote-runtime-shared-control-types.tssrc/shared/remote-runtime-socket-liveness.test.tssrc/shared/remote-runtime-socket-liveness.tssrc/shared/terminal-stream-protocol.test.tssrc/shared/terminal-stream-protocol.ts
🚧 Files skipped from review as they are similar to previous changes (64)
- src/shared/remote-runtime-client-error-classification.test.ts
- config/localization-coverage-allowlist.json
- src/shared/remote-runtime-client-error-classification.ts
- src/shared/terminal-stream-protocol.test.ts
- src/renderer/src/runtime/remote-runtime-host-terminal-resolution.ts
- src/preload/index.ts
- src/shared/remote-runtime-shared-control-reconnect-delay.test.ts
- src/shared/remote-runtime-shared-control-resume.test.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-staged-rebind.test.ts
- src/renderer/src/runtime/remote-runtime-host-terminal-resolution.test.ts
- src/shared/terminal-stream-protocol.ts
- src/shared/remote-runtime-shared-control-open.ts
- src/renderer/src/web/web-preload-api.ts
- src/shared/remote-runtime-shared-control-types.ts
- src/renderer/src/runtime/runtime-environment-connection-lifecycle.ts
- src/main/system-resume-broadcast.ts
- src/renderer/src/components/terminal-pane/remote-runtime-terminal-gone-error.ts
- src/renderer/src/components/terminal-pane/pty-transport-types.ts
- src/shared/remote-runtime-shared-control-frame-handler.ts
- src/main/ipc/runtime-environment-request-connections.ts
- src/renderer/src/runtime/remote-runtime-terminal-recovery-lifecycle.test.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-input.test.ts
- src/main/system-resume-broadcast.test.ts
- src/renderer/src/runtime/remote-runtime-terminal-recovery-types.ts
- src/renderer/src/components/terminal-pane/pty-connection.ts
- src/renderer/src/components/status-bar/SshStatusSegment.tsx
- src/renderer/src/components/terminal-pane/remote-runtime-pty-staged-rebind.ts
- src/renderer/src/runtime/runtime-environment-connection-lifecycle.test.ts
- src/shared/remote-runtime-client.test.ts
- src/preload/api-types.ts
- src/shared/remote-runtime-shared-control-subscription-start.ts
- src/shared/remote-runtime-shared-control-state.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-test-fixture.ts
- src/renderer/src/components/terminal-pane/pty-transport.ts
- src/preload/runtime-environment-subscriptions.ts
- src/shared/remote-runtime-socket-liveness.test.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-staged-binding-state.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-ordering.test.ts
- src/renderer/src/runtime/remote-runtime-terminal-frame-drop-resync.test.ts
- src/shared/remote-runtime-shared-control-requests.ts
- src/main/runtime/rpc/ws-transport.test.ts
- src/renderer/src/components/terminal-pane/use-terminal-window-wake-recovery.ts
- src/shared/remote-runtime-shared-control-connection.ts
- src/renderer/src/runtime/remote-runtime-session-tabs-recovery-subscription.ts
- src/renderer/src/web/web-preload-api.test.ts
- src/renderer/src/components/terminal-pane/pty-connection.test.ts
- src/renderer/src/runtime/remote-runtime-terminal-recovery-registry.ts
- src/renderer/src/runtime/remote-runtime-terminal-recovery-coordinator.ts
- src/renderer/src/runtime/remote-runtime-terminal-recovery-coordinator.test.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-lifecycle.test.ts
- src/renderer/src/components/terminal-pane/use-terminal-window-wake-recovery.test.ts
- src/main/runtime/rpc/ws-transport.ts
- src/shared/remote-runtime-socket-liveness.ts
- src/preload/runtime-environment-subscriptions.test.ts
- src/main/ipc/runtime-environments.test.ts
- src/shared/remote-runtime-shared-control-keepalive-refresh.test.ts
- src/main/ipc/runtime-environments.ts
- src/renderer/src/runtime/remote-runtime-terminal-multiplexer.ts
- src/shared/remote-runtime-shared-control-reconnect.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
- src/main/runtime/rpc/terminal-multiplex.test.ts
- src/shared/remote-runtime-shared-control-connection.test.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.ts
- src/main/runtime/rpc/methods/terminal.ts
|
Addressed the latest direct-handle release-gate nitpick in The coordinator suite already parameterizes all four known terminal-gone codes and separately proves an unknown Focused outcome tests: 11/11; targeted lint/format, max-lines, and diff check pass. No production recovery behavior changed. |
|
Addressed the remaining current-code why-comment suggestion from review |
73598ff to
c0ed3d2
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review Please review current head 5b5a48b after the CI-discovered test contract fix. |
|
✅ Action performedReview finished.
|
582ad32 to
d46bb57
Compare
|
Rebased recovery layer onto rebased #8253/#8254 + latest The 8255-only delta is now a single commit on top of the foundations/stream-close layers (old multi-merge history dropped). For the heavily rewritten |
d46bb57 to
018e975
Compare
Narrow rewrite complete (post-#9774)Force-pushed a complementary-only branch onto current Kept only:
Focused tests: recovery-state + shared-control connection + wake-recovery (36 passed). Ready for re-review as a small follow-up to #9774. |
018e975 to
ce321f9
Compare
|
Rebased onto current Kept main's per-environment Focused tests: remote-runtime-pty-recovery-state 7/7 green. ahead=1 behind=0. |
ce321f9 to
604974a
Compare
604974a to
19107c6
Compare
Restack + review guide (community, awaiting maintainer)Rebased onto latest Title/body already rewritten to residual scope: What this PR still uniquely doesMain already reconnects recoverable remote PTYs. This PR only kicks pending recovery when:
via Not claiming
Depends on
Tests (local)
Ready for upstream review; community author cannot merge. |
19107c6 to
0576815
Compare
Re-restack noteRebased onto latest
Ready for upstream review; community author cannot merge. |
…line Narrow stablyai#8255 onto current main after stablyai#9774: fire pending shared-control reconnect timers and pane recovery backoffs on system resume and browser online, without replacing the per-pane recovery state machine or reconnect banner UX.
0576815 to
4c61d37
Compare
OrcaWin
left a comment
There was a problem hiding this comment.
Thanks for narrowing this to the residual resume/online backoff gap. I applied the review fixes:
- moved resume/online recovery triggers to one App-level owner so hidden panes recover without duplicate per-pane listeners
- narrowed the pane registry to scheduled backoffs and hardened timer cleanup/reentrancy
- kept the retry IPC desktop-scoped and extracted its handler to satisfy max-lines
- added listener, IPC, scheduler, and recovery cleanup regression coverage
Validated focused recovery/IPC tests, both node and tc.web typechecks, max-lines, Electron build/runtime behavior, and the terminal reattach reliability gates. The known headless activation failure reproduced on pristine main.
…8255) * fix(remote): accelerate shared-control and pane recovery on resume/online Narrow stablyai#8255 onto current main after stablyai#9774: fire pending shared-control reconnect timers and pane recovery backoffs on system resume and browser online, without replacing the per-pane recovery state machine or reconnect banner UX. * test(remote): cover online and occluded-resume recovery triggers * fix(remote): centralize recovery acceleration --------- Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
fix(remote): accelerate terminal recovery on resume/online
Status (2026-07-23 restack note)
Residual follow-up only. The original QueryReplay / recovery-coordinator / staged-rebind stack has largely landed on main (see transport recovery work including the #9774-era paths, plus host authority work in #9804 / #9687).
This PR no longer claims full “recover terminals after transport interruption.” Review only the residual:
retryConnectionsNow/ force-retry recovery schedulers when the OS resumes or the network comes onlineProblem
After OS resume or a network blip, remote PTY recovery timers can sit on long backoffs even though the daemon/session is already live again. Transport recovery on main reconnects, but resume/online does not always kick pending recovery immediately.
Solution
onlineevents to retry outstanding remote runtime PTY recoveries nowNon-goals
Test plan
Part of the remote terminal reliability set; orthogonal to closeLifecycle (#9804).
ELI5
After a remote connection blip or resume, terminals could take too long to come back. Residual recovery scheduling forces retries sooner on resume/online so panes rebind faster without claiming a full rewrite of transport recovery.