Repository navigation
fix(runtime): self-heal remote terminal routing - #10011
Conversation
07acbec to
271d387
Compare
|
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 changes add WSL and PTY incarnation metadata, terminal orphan adoption through runtime and RPC layers, topology reconciliation, and renderer-side recovery before session snapshots are applied. Runtime routing is separated into durable Active Server preference persistence and transient host selection. Browser state becomes host-scoped, terminal creation checks ownership per worktree, and runtime-host navigation preloads host data. Tests and reliability gates cover adoption conflicts, WSL ownership, mixed-version recovery, topology CAS behavior, and routing persistence. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
src/main/runtime/terminal-orphan-topology.ts (1)
111-132: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExplain the anchor-grafting heuristic with a short comment.
The single-shared-anchor graft (Line 115-120) vs. sibling-append fallback (Line 121-132) is a non-obvious design decision (e.g., what happens with 0 or 2+ shared anchors) with no comment explaining the rationale. A one-line "why" comment on each branch would help future maintainers reason about correctness when adding new merge cases.
As per coding guidelines,
**/*.{ts,tsx,js,jsx}: "Add concise, ideally one-line comments only for non-obvious code, explaining why rather than how."Source: Coding guidelines
src/main/runtime/terminal-orphan-topology.test.ts (1)
1-85: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd coverage for untested merge branches.
Tests only exercise the "zero shared / multiple new" (Line 22-50) and "single shared anchor" (Line 52-84) paths of
mergeTerminalOrphanGroupLayout. The multi-anchor fallback (sharedGroupIds.length > 1), the!existing/!proposedearly-return branches, and the no-op case (no new groups) interminal-orphan-topology.tsLines 104-109 and 121-132 have no direct test, despite being part of the core recovery-merge logic used for orphan adoption.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 61cdb451-d1ae-45b5-9c33-29d90a46e3c5
📥 Commits
Reviewing files that changed from the base of the PR and between 01bcc57 and 07acbecd7786fb9a70ec0ebebc1362931203b3e9.
📒 Files selected for processing (27)
config/reliability-gates.jsoncsrc/main/daemon/daemon-pty-adapter.test.tssrc/main/daemon/daemon-pty-adapter.tssrc/main/daemon/terminal-host-session-listing.tssrc/main/daemon/types.tssrc/main/providers/local-pty-provider.test.tssrc/main/providers/local-pty-provider.tssrc/main/providers/pty-process-info.tssrc/main/providers/types.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/index.tssrc/main/runtime/rpc/methods/session-tabs-schemas.tssrc/main/runtime/rpc/methods/terminal-orphan.tssrc/main/runtime/rpc/methods/terminal.tssrc/main/runtime/rpc/schemas.test.tssrc/main/runtime/runtime-rpc.tssrc/main/runtime/terminal-orphan-owner.test.tssrc/main/runtime/terminal-orphan-owner.tssrc/main/runtime/terminal-orphan-topology.test.tssrc/main/runtime/terminal-orphan-topology.tssrc/renderer/src/runtime/web-session-tabs-sync.tssrc/renderer/src/runtime/web-session-terminal-orphan-mixed-version.test.tssrc/renderer/src/runtime/web-session-terminal-orphan-recovery.test.tssrc/renderer/src/runtime/web-session-terminal-orphan-recovery.tssrc/renderer/src/runtime/web-session-terminal-orphan-topology.tssrc/shared/runtime-types.ts
5292dcb to
3e739ad
Compare
There was a problem hiding this comment.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
config/reliability-gates.jsonc (1)
1424-1444: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winNew orphan-adoption vitest command isn't tracked in
testFiles/evidenceRuns.The third
commandsentry (line 1427) runssrc/main/runtime/terminal-orphan-owner.test.ts, but that file is absent from this gate'stestFilesarray (1429-1444), and noevidenceRunsentry records an actual pass of this specific command (only the first command andpnpm test:repro:remote-agent-sessionhave recorded runs). This weakens the gate's own audit trail for exactly the orphan-adoption tests this PR introduces.🛠️ Proposed fix
"testFiles": [ "src/shared/claimed-agent-pty-owner.test.ts", ... + "src/main/runtime/terminal-orphan-owner.test.ts", "src/main/runtime/terminal-orphan-topology.test.ts", ... ],Also add an
evidenceRunsentry for the thirdcommandsinvocation.Also applies to: 1520-1538
src/main/ipc/settings.ts (1)
1-1: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winMissing "unknown environment id" validation is both a real gap and an unproven reliability-gate claim.
settings.ts's dedicated preference handler never resolvesenvironmentIdagainst the known-environments store, so a caller can persist an id that doesn't correspond to any registered runtime environment.
src/main/ipc/settings.ts#L211-224: add an existence check (e.g.resolveEnvironment(getUserDataPath(), environmentId)) before callingstore.updateSettings, mirroring the pattern already used inruntime-environments.ts's remove handler.config/reliability-gates.jsonc#L1625-1632: the assertionRef claims this scenario is covered bysettings.test.ts; it currently is not — either implement the validation and add the test, or narrow the claim.src/main/ipc/settings.test.ts#L128-146: once validation is added, extend this test with a case assertinghandler(settingsInvokeEvent, { environmentId: 'does-not-exist' })throws.src/renderer/src/runtime/web-session-tabs-sync.ts (1)
2717-2733: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winReplay-acceptance bookkeeping is ordered differently relative to recovery success between two near-duplicate code paths.
In the global "all worktrees" subscription handler (2717-2733),
acceptReplayedWebSessionTabsSnapshot(environmentId, event.worktree)runs unconditionally wheneverreplayedis true — before recovery has even started, and regardless of whether it later fails. InapplyActiveSnapshot(2787-2853), the equivalent call only happens afterrecoveredis confirmed non-null, usingrecovered.worktree. Both handlers can process events for the currently active worktree, so this divergence means the same freshness-tracking bookkeeping is applied on a different success condition depending on which subscription happened to deliver the event.Also applies to: 2787-2853
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 34961be4-aa04-4ce9-8bfa-4818404a62a0
📥 Commits
Reviewing files that changed from the base of the PR and between 07acbecd7786fb9a70ec0ebebc1362931203b3e9 and 3fb5f7539b8c15b221fbcd83e470c9e6ed25a8d0.
📒 Files selected for processing (56)
config/reliability-gates.jsoncresources/skills/current-manifest.jsonresources/skills/release-mapping.jsonresources/skills/snapshot-registry.jsonsrc/main/daemon/daemon-pty-adapter.test.tssrc/main/daemon/daemon-pty-adapter.tssrc/main/daemon/terminal-host-session-listing.tssrc/main/daemon/types.tssrc/main/index.tssrc/main/ipc/ephemeral-vm-runtime-handlers.tssrc/main/ipc/ephemeral-vm.test.tssrc/main/ipc/runtime-environments.test.tssrc/main/ipc/runtime-environments.tssrc/main/ipc/settings.test.tssrc/main/ipc/settings.tssrc/main/providers/local-pty-provider.test.tssrc/main/providers/local-pty-provider.tssrc/main/providers/pty-process-info.tssrc/main/providers/types.tssrc/main/runtime-environment-focus-self-heal.test.tssrc/main/runtime-environment-focus-self-heal.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/index.tssrc/main/runtime/rpc/methods/session-tabs-schemas.tssrc/main/runtime/rpc/methods/terminal-orphan.tssrc/main/runtime/rpc/methods/terminal.tssrc/main/runtime/rpc/schemas.test.tssrc/main/runtime/runtime-rpc.tssrc/main/runtime/terminal-orphan-owner.test.tssrc/main/runtime/terminal-orphan-owner.tssrc/main/runtime/terminal-orphan-topology.test.tssrc/main/runtime/terminal-orphan-topology.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/src/components/settings/BrowserPane.tsxsrc/renderer/src/components/settings/RuntimeEnvironmentsPane.tsxsrc/renderer/src/components/settings/Settings.tsxsrc/renderer/src/components/sidebar/use-add-repo-host-selection.test.tssrc/renderer/src/components/sidebar/use-add-repo-host-selection.tssrc/renderer/src/components/status-bar/SshStatusSegment.test.tssrc/renderer/src/components/status-bar/SshStatusSegment.tsxsrc/renderer/src/hooks/useIpcEvents.test.tssrc/renderer/src/hooks/useIpcEvents.tssrc/renderer/src/runtime/web-session-tabs-sync.tssrc/renderer/src/runtime/web-session-terminal-orphan-mixed-version.test.tssrc/renderer/src/runtime/web-session-terminal-orphan-recovery.test.tssrc/renderer/src/runtime/web-session-terminal-orphan-recovery.tssrc/renderer/src/runtime/web-session-terminal-orphan-topology.tssrc/renderer/src/store/slices/browser.test.tssrc/renderer/src/store/slices/browser.tssrc/renderer/src/store/slices/settings.test.tssrc/renderer/src/store/slices/settings.tssrc/renderer/src/web/web-preload-api.test.tssrc/renderer/src/web/web-preload-api.tssrc/shared/runtime-types.ts
💤 Files with no reviewable changes (3)
- src/main/runtime-environment-focus-self-heal.ts
- src/main/runtime-environment-focus-self-heal.test.ts
- src/main/ipc/ephemeral-vm-runtime-handlers.ts
🚧 Files skipped from review as they are similar to previous changes (23)
- src/main/runtime/rpc/methods/index.ts
- src/main/providers/pty-process-info.ts
- src/main/daemon/terminal-host-session-listing.ts
- src/main/runtime/runtime-rpc.ts
- src/renderer/src/runtime/web-session-terminal-orphan-mixed-version.test.ts
- src/main/daemon/types.ts
- src/main/runtime/terminal-orphan-owner.ts
- src/shared/runtime-types.ts
- src/main/daemon/daemon-pty-adapter.ts
- src/renderer/src/runtime/web-session-terminal-orphan-recovery.ts
- src/main/runtime/rpc/methods/terminal-orphan.ts
- src/main/providers/local-pty-provider.test.ts
- src/main/runtime/terminal-orphan-topology.ts
- src/renderer/src/runtime/web-session-terminal-orphan-recovery.test.ts
- src/main/daemon/daemon-pty-adapter.test.ts
- src/main/runtime/terminal-orphan-owner.test.ts
- src/main/runtime/terminal-orphan-topology.test.ts
- src/main/runtime/rpc/methods/terminal.ts
- src/main/runtime/orca-runtime.ts
- src/main/providers/types.ts
- src/renderer/src/runtime/web-session-terminal-orphan-topology.ts
- src/main/runtime/orca-runtime.test.ts
- src/main/providers/local-pty-provider.ts
fc5690d to
8dc9460
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/index.ts (1)
2262-2266: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winEmpty
ORCA_E2E_RUNTIME_WS_PORTsilently falls back to port 0 instead of failing validation.
Number('')evaluates to0, which passes theNumber.isInteger/ range checks below. If the env var is explicitly set to an empty string (e.g. a CI templating bug), this silently picks a random port instead of throwing, defeating the purpose of deterministic ports for parallel E2E runs.🐛 Proposed fix
- const requestedE2EWsPort = process.env.ORCA_E2E_RUNTIME_WS_PORT - const e2eWsPort = requestedE2EWsPort === undefined ? 0 : Number(requestedE2EWsPort) + const requestedE2EWsPort = process.env.ORCA_E2E_RUNTIME_WS_PORT + const e2eWsPort = + requestedE2EWsPort === undefined || requestedE2EWsPort === '' ? 0 : Number(requestedE2EWsPort)
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 3a2440dc-d7f5-4368-a68b-54423e11e8c6
📥 Commits
Reviewing files that changed from the base of the PR and between 3fb5f7539b8c15b221fbcd83e470c9e6ed25a8d0 and bb14a40.
📒 Files selected for processing (58)
config/reliability-gates.jsoncsrc/main/daemon/daemon-pty-adapter.test.tssrc/main/daemon/daemon-pty-adapter.tssrc/main/daemon/terminal-host-session-listing.tssrc/main/daemon/types.tssrc/main/index.tssrc/main/ipc/ephemeral-vm-runtime-handlers.tssrc/main/ipc/ephemeral-vm.test.tssrc/main/ipc/runtime-environments.test.tssrc/main/ipc/runtime-environments.tssrc/main/ipc/settings.test.tssrc/main/ipc/settings.tssrc/main/providers/local-pty-provider.test.tssrc/main/providers/local-pty-provider.tssrc/main/providers/pty-process-info.tssrc/main/providers/types.tssrc/main/runtime-environment-focus-self-heal.test.tssrc/main/runtime-environment-focus-self-heal.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/index.tssrc/main/runtime/rpc/methods/session-tabs-schemas.tssrc/main/runtime/rpc/methods/terminal-orphan.tssrc/main/runtime/rpc/methods/terminal.tssrc/main/runtime/rpc/schemas.test.tssrc/main/runtime/runtime-rpc.tssrc/main/runtime/terminal-orphan-owner.test.tssrc/main/runtime/terminal-orphan-owner.tssrc/main/runtime/terminal-orphan-topology.test.tssrc/main/runtime/terminal-orphan-topology.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/src/components/settings/BrowserPane.tsxsrc/renderer/src/components/settings/RuntimeEnvironmentsPane.tsxsrc/renderer/src/components/settings/Settings.tsxsrc/renderer/src/components/sidebar/use-add-repo-host-selection.test.tssrc/renderer/src/components/sidebar/use-add-repo-host-selection.tssrc/renderer/src/components/status-bar/SshStatusSegment.test.tssrc/renderer/src/components/status-bar/SshStatusSegment.tsxsrc/renderer/src/hooks/useIpcEvents.test.tssrc/renderer/src/hooks/useIpcEvents.tssrc/renderer/src/i18n/locales/en.jsonsrc/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/web-session-tabs-sync.tssrc/renderer/src/runtime/web-session-terminal-orphan-mixed-version.test.tssrc/renderer/src/runtime/web-session-terminal-orphan-recovery.test.tssrc/renderer/src/runtime/web-session-terminal-orphan-recovery.tssrc/renderer/src/runtime/web-session-terminal-orphan-topology.tssrc/renderer/src/store/slices/browser.test.tssrc/renderer/src/store/slices/browser.tssrc/renderer/src/store/slices/settings.test.tssrc/renderer/src/store/slices/settings.tssrc/renderer/src/web/web-preload-api.test.tssrc/renderer/src/web/web-preload-api.tssrc/shared/runtime-types.ts
💤 Files with no reviewable changes (2)
- src/main/runtime-environment-focus-self-heal.ts
- src/main/runtime-environment-focus-self-heal.test.ts
🚧 Files skipped from review as they are similar to previous changes (47)
- src/main/daemon/terminal-host-session-listing.ts
- src/preload/api-types.ts
- src/renderer/src/components/status-bar/SshStatusSegment.test.ts
- src/renderer/src/runtime/web-session-terminal-orphan-mixed-version.test.ts
- src/main/runtime/runtime-rpc.ts
- src/renderer/src/components/settings/Settings.tsx
- src/main/runtime/rpc/methods/session-tabs-schemas.ts
- src/main/runtime/terminal-orphan-topology.test.ts
- src/main/providers/pty-process-info.ts
- src/main/daemon/types.ts
- src/main/runtime/rpc/methods/terminal.ts
- src/main/providers/local-pty-provider.ts
- src/main/ipc/ephemeral-vm.test.ts
- src/main/runtime/rpc/methods/index.ts
- src/main/providers/local-pty-provider.test.ts
- src/main/daemon/daemon-pty-adapter.test.ts
- src/shared/runtime-types.ts
- src/main/runtime/terminal-orphan-owner.test.ts
- src/renderer/src/components/settings/BrowserPane.tsx
- src/main/ipc/settings.ts
- src/main/runtime/rpc/schemas.test.ts
- src/main/runtime/terminal-orphan-owner.ts
- src/main/runtime/terminal-orphan-topology.ts
- src/main/daemon/daemon-pty-adapter.ts
- src/main/ipc/settings.test.ts
- src/renderer/src/components/sidebar/use-add-repo-host-selection.test.ts
- src/renderer/src/runtime/web-session-terminal-orphan-recovery.test.ts
- src/renderer/src/components/sidebar/use-add-repo-host-selection.ts
- src/renderer/src/store/slices/settings.ts
- src/main/ipc/ephemeral-vm-runtime-handlers.ts
- src/main/providers/types.ts
- src/main/ipc/runtime-environments.test.ts
- src/renderer/src/web/web-preload-api.test.ts
- src/main/runtime/rpc/methods/terminal-orphan.ts
- src/main/ipc/runtime-environments.ts
- src/renderer/src/store/slices/browser.test.ts
- src/renderer/src/runtime/web-session-terminal-orphan-recovery.ts
- src/renderer/src/web/web-preload-api.ts
- src/renderer/src/components/settings/RuntimeEnvironmentsPane.tsx
- src/renderer/src/runtime/web-session-tabs-sync.ts
- src/renderer/src/store/slices/settings.test.ts
- src/main/runtime/orca-runtime.ts
- src/renderer/src/hooks/useIpcEvents.ts
- src/renderer/src/hooks/useIpcEvents.test.ts
- config/reliability-gates.jsonc
- src/renderer/src/store/slices/browser.ts
- src/renderer/src/components/status-bar/SshStatusSegment.tsx
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a4124de0-daf2-469b-8671-a034503bd7ae
📒 Files selected for processing (58)
config/reliability-gates.jsoncsrc/main/daemon/daemon-pty-adapter.test.tssrc/main/daemon/daemon-pty-adapter.tssrc/main/daemon/terminal-host-session-listing.tssrc/main/daemon/types.tssrc/main/index.tssrc/main/ipc/ephemeral-vm-runtime-handlers.tssrc/main/ipc/ephemeral-vm.test.tssrc/main/ipc/runtime-environments.test.tssrc/main/ipc/runtime-environments.tssrc/main/ipc/settings.test.tssrc/main/ipc/settings.tssrc/main/providers/local-pty-provider.test.tssrc/main/providers/local-pty-provider.tssrc/main/providers/pty-process-info.tssrc/main/providers/types.tssrc/main/runtime-environment-focus-self-heal.test.tssrc/main/runtime-environment-focus-self-heal.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/index.tssrc/main/runtime/rpc/methods/session-tabs-schemas.tssrc/main/runtime/rpc/methods/terminal-orphan.tssrc/main/runtime/rpc/methods/terminal.tssrc/main/runtime/rpc/schemas.test.tssrc/main/runtime/runtime-rpc.tssrc/main/runtime/terminal-orphan-owner.test.tssrc/main/runtime/terminal-orphan-owner.tssrc/main/runtime/terminal-orphan-topology.test.tssrc/main/runtime/terminal-orphan-topology.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/src/components/settings/BrowserPane.tsxsrc/renderer/src/components/settings/RuntimeEnvironmentsPane.tsxsrc/renderer/src/components/settings/Settings.tsxsrc/renderer/src/components/sidebar/use-add-repo-host-selection.test.tssrc/renderer/src/components/sidebar/use-add-repo-host-selection.tssrc/renderer/src/components/status-bar/SshStatusSegment.test.tssrc/renderer/src/components/status-bar/SshStatusSegment.tsxsrc/renderer/src/hooks/useIpcEvents.test.tssrc/renderer/src/hooks/useIpcEvents.tssrc/renderer/src/i18n/locales/en.jsonsrc/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/web-session-tabs-sync.tssrc/renderer/src/runtime/web-session-terminal-orphan-mixed-version.test.tssrc/renderer/src/runtime/web-session-terminal-orphan-recovery.test.tssrc/renderer/src/runtime/web-session-terminal-orphan-recovery.tssrc/renderer/src/runtime/web-session-terminal-orphan-topology.tssrc/renderer/src/store/slices/browser.test.tssrc/renderer/src/store/slices/browser.tssrc/renderer/src/store/slices/settings.test.tssrc/renderer/src/store/slices/settings.tssrc/renderer/src/web/web-preload-api.test.tssrc/renderer/src/web/web-preload-api.tssrc/shared/runtime-types.ts
💤 Files with no reviewable changes (3)
- src/main/runtime-environment-focus-self-heal.ts
- src/main/runtime-environment-focus-self-heal.test.ts
- src/main/ipc/ephemeral-vm-runtime-handlers.ts
🚧 Files skipped from review as they are similar to previous changes (50)
- src/main/providers/pty-process-info.ts
- src/renderer/src/components/settings/Settings.tsx
- src/preload/api-types.ts
- src/main/daemon/daemon-pty-adapter.ts
- src/preload/index.ts
- src/main/daemon/terminal-host-session-listing.ts
- src/main/runtime/terminal-orphan-topology.test.ts
- src/renderer/src/components/status-bar/SshStatusSegment.test.ts
- src/main/runtime/rpc/methods/index.ts
- src/main/runtime/terminal-orphan-owner.ts
- src/main/providers/local-pty-provider.ts
- src/main/providers/local-pty-provider.test.ts
- src/main/daemon/types.ts
- src/main/runtime/rpc/methods/session-tabs-schemas.ts
- src/main/runtime/runtime-rpc.ts
- src/shared/runtime-types.ts
- src/main/ipc/ephemeral-vm.test.ts
- src/main/runtime/rpc/schemas.test.ts
- src/main/runtime/rpc/methods/terminal-orphan.ts
- src/renderer/src/web/web-preload-api.test.ts
- src/renderer/src/runtime/web-session-terminal-orphan-recovery.test.ts
- src/main/ipc/settings.ts
- src/main/runtime/rpc/methods/terminal.ts
- src/main/runtime/orca-runtime.test.ts
- src/main/providers/types.ts
- src/renderer/src/i18n/locales/en.json
- src/main/daemon/daemon-pty-adapter.test.ts
- src/renderer/src/components/sidebar/use-add-repo-host-selection.test.ts
- src/renderer/src/components/settings/BrowserPane.tsx
- src/main/runtime/terminal-orphan-topology.ts
- src/renderer/src/store/slices/settings.ts
- src/main/ipc/settings.test.ts
- src/main/ipc/runtime-environments.ts
- src/main/ipc/runtime-environments.test.ts
- src/renderer/src/store/slices/browser.test.ts
- src/renderer/src/hooks/useIpcEvents.test.ts
- src/renderer/src/store/slices/settings.test.ts
- src/renderer/src/i18n/locales/ja.json
- src/renderer/src/i18n/locales/es.json
- src/renderer/src/i18n/locales/zh.json
- src/renderer/src/runtime/web-session-terminal-orphan-topology.ts
- src/renderer/src/runtime/web-session-terminal-orphan-recovery.ts
- src/main/runtime/orca-runtime.ts
- src/renderer/src/components/sidebar/use-add-repo-host-selection.ts
- src/renderer/src/web/web-preload-api.ts
- src/renderer/src/runtime/web-session-tabs-sync.ts
- src/renderer/src/i18n/locales/ko.json
- src/renderer/src/components/status-bar/SshStatusSegment.tsx
- config/reliability-gates.jsonc
- src/renderer/src/store/slices/browser.ts
8dc9460 to
8966f16
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
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/settings/RuntimeEnvironmentsPane.tsx (1)
468-489: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winAvoid showing two success toasts when adding a server.
connectEnvironment()already displays a success toast (runtimeReachable) on success, so this branch immediately displays a second success toast for the same operation whenallowLocalRuntimeis false. Remove this second toast or add an explicit notification-suppression option toconnectEnvironment().Proposed fix
- if (mountedRef.current) { - toast.success( - translate( - 'auto.components.settings.RuntimeEnvironmentsPane.a5b58465b6', - 'Connected to {{value0}}.', - { value0: result.environment.name } - ) - ) - }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 404692af-6a76-495e-b89a-26bf93245205
📥 Commits
Reviewing files that changed from the base of the PR and between 8dc9460 and 8966f16df597a3db6a8fd8bdcb60624391ad808f.
📒 Files selected for processing (59)
config/reliability-gates.jsoncsrc/main/daemon/daemon-pty-adapter.test.tssrc/main/daemon/daemon-pty-adapter.tssrc/main/daemon/terminal-host-session-listing.tssrc/main/daemon/types.tssrc/main/index.tssrc/main/ipc/ephemeral-vm-runtime-handlers.tssrc/main/ipc/ephemeral-vm.test.tssrc/main/ipc/runtime-environments.test.tssrc/main/ipc/runtime-environments.tssrc/main/ipc/settings.test.tssrc/main/ipc/settings.tssrc/main/providers/local-pty-provider.test.tssrc/main/providers/local-pty-provider.tssrc/main/providers/pty-process-info.tssrc/main/providers/types.tssrc/main/runtime-environment-focus-self-heal.test.tssrc/main/runtime-environment-focus-self-heal.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/index.tssrc/main/runtime/rpc/methods/session-tabs-schemas.tssrc/main/runtime/rpc/methods/terminal-orphan.tssrc/main/runtime/rpc/methods/terminal.tssrc/main/runtime/rpc/schemas.test.tssrc/main/runtime/runtime-rpc.tssrc/main/runtime/terminal-orphan-owner.test.tssrc/main/runtime/terminal-orphan-owner.tssrc/main/runtime/terminal-orphan-topology.test.tssrc/main/runtime/terminal-orphan-topology.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/src/components/settings/BrowserPane.tsxsrc/renderer/src/components/settings/RuntimeEnvironmentsPane.test.tssrc/renderer/src/components/settings/RuntimeEnvironmentsPane.tsxsrc/renderer/src/components/settings/Settings.tsxsrc/renderer/src/components/sidebar/use-add-repo-host-selection.test.tssrc/renderer/src/components/sidebar/use-add-repo-host-selection.tssrc/renderer/src/components/status-bar/SshStatusSegment.test.tssrc/renderer/src/components/status-bar/SshStatusSegment.tsxsrc/renderer/src/hooks/useIpcEvents.test.tssrc/renderer/src/hooks/useIpcEvents.tssrc/renderer/src/i18n/locales/en.jsonsrc/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/web-session-tabs-sync.tssrc/renderer/src/runtime/web-session-terminal-orphan-mixed-version.test.tssrc/renderer/src/runtime/web-session-terminal-orphan-recovery.test.tssrc/renderer/src/runtime/web-session-terminal-orphan-recovery.tssrc/renderer/src/runtime/web-session-terminal-orphan-topology.tssrc/renderer/src/store/slices/browser.test.tssrc/renderer/src/store/slices/browser.tssrc/renderer/src/store/slices/settings.test.tssrc/renderer/src/store/slices/settings.tssrc/renderer/src/web/web-preload-api.test.tssrc/renderer/src/web/web-preload-api.tssrc/shared/runtime-types.ts
💤 Files with no reviewable changes (4)
- src/main/runtime-environment-focus-self-heal.ts
- src/main/runtime-environment-focus-self-heal.test.ts
- src/main/ipc/ephemeral-vm-runtime-handlers.ts
- src/main/index.ts
🚧 Files skipped from review as they are similar to previous changes (49)
- src/main/providers/pty-process-info.ts
- src/preload/api-types.ts
- src/preload/index.ts
- src/main/runtime/rpc/methods/index.ts
- src/renderer/src/components/settings/Settings.tsx
- src/renderer/src/components/status-bar/SshStatusSegment.test.ts
- src/main/runtime/runtime-rpc.ts
- src/main/daemon/daemon-pty-adapter.ts
- src/renderer/src/runtime/web-session-terminal-orphan-mixed-version.test.ts
- src/main/daemon/terminal-host-session-listing.ts
- src/shared/runtime-types.ts
- src/main/runtime/rpc/schemas.test.ts
- src/main/runtime/rpc/methods/terminal-orphan.ts
- src/main/daemon/types.ts
- src/main/runtime/terminal-orphan-owner.ts
- src/main/daemon/daemon-pty-adapter.test.ts
- src/main/runtime/rpc/methods/session-tabs-schemas.ts
- src/renderer/src/components/settings/BrowserPane.tsx
- src/renderer/src/runtime/web-session-terminal-orphan-recovery.test.ts
- src/main/runtime/terminal-orphan-owner.test.ts
- src/main/ipc/settings.ts
- src/main/providers/local-pty-provider.test.ts
- src/main/runtime/orca-runtime.test.ts
- src/renderer/src/components/sidebar/use-add-repo-host-selection.test.ts
- src/main/runtime/terminal-orphan-topology.test.ts
- src/main/runtime/terminal-orphan-topology.ts
- src/main/providers/types.ts
- src/main/ipc/runtime-environments.ts
- src/renderer/src/i18n/locales/es.json
- src/renderer/src/i18n/locales/en.json
- src/renderer/src/components/sidebar/use-add-repo-host-selection.ts
- src/renderer/src/runtime/web-session-terminal-orphan-recovery.ts
- src/main/ipc/runtime-environments.test.ts
- src/main/ipc/settings.test.ts
- src/renderer/src/store/slices/settings.ts
- src/renderer/src/runtime/web-session-terminal-orphan-topology.ts
- src/renderer/src/hooks/useIpcEvents.test.ts
- src/renderer/src/web/web-preload-api.test.ts
- src/renderer/src/store/slices/settings.test.ts
- src/renderer/src/components/status-bar/SshStatusSegment.tsx
- src/renderer/src/i18n/locales/zh.json
- src/renderer/src/store/slices/browser.test.ts
- config/reliability-gates.jsonc
- src/main/runtime/orca-runtime.ts
- src/renderer/src/i18n/locales/ja.json
- src/renderer/src/i18n/locales/ko.json
- src/renderer/src/runtime/web-session-tabs-sync.ts
- src/renderer/src/web/web-preload-api.ts
- src/renderer/src/store/slices/browser.ts
bf5eadd to
3c10e5c
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/runtime/web-session-terminal-orphan-mixed-version.test.ts (1)
60-72: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert that the legacy terminal remains in state.
This only verifies that recovery returns
null. Assert thattabsByWorktreeand theleaf-1PTY mapping still retainterm_live; otherwise a destructive prune before the null return would pass despite the test name and fail-closed recovery contract.Proposed test strengthening
- recoverWebSessionTerminalOrphansBeforeApply( - legacyRecoveryState(), + recoverWebSessionTerminalOrphansBeforeApply( + state, missingSnapshot, 'windows-2', call as never ) ).resolves.toBeNull() expect(call).toHaveBeenCalledOnce() + expect(state.tabsByWorktree[worktree]).toHaveLength(1) + expect( + state.terminalLayoutsByTabId['web-terminal-host-tab'].ptyIdsByLeafId['leaf-1'] + ).toBe(toRemoteRuntimePtyId('term_live', 'windows-2'))
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 5f46299c-b327-4814-928d-29b3e89287e7
📥 Commits
Reviewing files that changed from the base of the PR and between 8dc9460 and 3c10e5cf14f7ed9764c3959e2b3d097644ef8391.
📒 Files selected for processing (59)
config/reliability-gates.jsoncsrc/main/daemon/daemon-pty-adapter.test.tssrc/main/daemon/daemon-pty-adapter.tssrc/main/daemon/terminal-host-session-listing.tssrc/main/daemon/types.tssrc/main/index.tssrc/main/ipc/ephemeral-vm-runtime-handlers.tssrc/main/ipc/ephemeral-vm.test.tssrc/main/ipc/runtime-environments.test.tssrc/main/ipc/runtime-environments.tssrc/main/ipc/settings.test.tssrc/main/ipc/settings.tssrc/main/providers/local-pty-provider.test.tssrc/main/providers/local-pty-provider.tssrc/main/providers/pty-process-info.tssrc/main/providers/types.tssrc/main/runtime-environment-focus-self-heal.test.tssrc/main/runtime-environment-focus-self-heal.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/index.tssrc/main/runtime/rpc/methods/session-tabs-schemas.tssrc/main/runtime/rpc/methods/terminal-orphan.tssrc/main/runtime/rpc/methods/terminal.tssrc/main/runtime/rpc/schemas.test.tssrc/main/runtime/runtime-rpc.tssrc/main/runtime/terminal-orphan-owner.test.tssrc/main/runtime/terminal-orphan-owner.tssrc/main/runtime/terminal-orphan-topology.test.tssrc/main/runtime/terminal-orphan-topology.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/src/components/settings/BrowserPane.tsxsrc/renderer/src/components/settings/RuntimeEnvironmentsPane.test.tssrc/renderer/src/components/settings/RuntimeEnvironmentsPane.tsxsrc/renderer/src/components/settings/Settings.tsxsrc/renderer/src/components/sidebar/use-add-repo-host-selection.test.tssrc/renderer/src/components/sidebar/use-add-repo-host-selection.tssrc/renderer/src/components/status-bar/SshStatusSegment.test.tssrc/renderer/src/components/status-bar/SshStatusSegment.tsxsrc/renderer/src/hooks/useIpcEvents.test.tssrc/renderer/src/hooks/useIpcEvents.tssrc/renderer/src/i18n/locales/en.jsonsrc/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/web-session-tabs-sync.tssrc/renderer/src/runtime/web-session-terminal-orphan-mixed-version.test.tssrc/renderer/src/runtime/web-session-terminal-orphan-recovery.test.tssrc/renderer/src/runtime/web-session-terminal-orphan-recovery.tssrc/renderer/src/runtime/web-session-terminal-orphan-topology.tssrc/renderer/src/store/slices/browser.test.tssrc/renderer/src/store/slices/browser.tssrc/renderer/src/store/slices/settings.test.tssrc/renderer/src/store/slices/settings.tssrc/renderer/src/web/web-preload-api.test.tssrc/renderer/src/web/web-preload-api.tssrc/shared/runtime-types.ts
💤 Files with no reviewable changes (4)
- src/main/runtime-environment-focus-self-heal.ts
- src/main/runtime-environment-focus-self-heal.test.ts
- src/main/index.ts
- src/main/ipc/ephemeral-vm-runtime-handlers.ts
🚧 Files skipped from review as they are similar to previous changes (49)
- src/main/daemon/daemon-pty-adapter.ts
- src/main/runtime/rpc/methods/index.ts
- src/main/runtime/terminal-orphan-owner.test.ts
- src/main/runtime/rpc/methods/session-tabs-schemas.ts
- src/main/daemon/terminal-host-session-listing.ts
- src/main/runtime/terminal-orphan-topology.test.ts
- src/renderer/src/components/settings/Settings.tsx
- src/main/runtime/runtime-rpc.ts
- src/main/runtime/rpc/schemas.test.ts
- src/main/providers/pty-process-info.ts
- src/renderer/src/runtime/web-session-terminal-orphan-recovery.test.ts
- src/main/daemon/types.ts
- src/main/runtime/rpc/methods/terminal.ts
- src/preload/api-types.ts
- src/main/runtime/terminal-orphan-owner.ts
- src/renderer/src/store/slices/settings.ts
- src/main/runtime/terminal-orphan-topology.ts
- src/renderer/src/components/status-bar/SshStatusSegment.test.ts
- src/main/ipc/ephemeral-vm.test.ts
- src/preload/index.ts
- src/renderer/src/web/web-preload-api.test.ts
- src/renderer/src/components/settings/RuntimeEnvironmentsPane.test.ts
- src/main/daemon/daemon-pty-adapter.test.ts
- src/main/ipc/runtime-environments.ts
- src/main/ipc/settings.test.ts
- src/shared/runtime-types.ts
- src/renderer/src/runtime/web-session-terminal-orphan-recovery.ts
- src/renderer/src/components/sidebar/use-add-repo-host-selection.ts
- src/renderer/src/hooks/useIpcEvents.test.ts
- src/main/runtime/rpc/methods/terminal-orphan.ts
- src/renderer/src/runtime/web-session-terminal-orphan-topology.ts
- src/renderer/src/hooks/useIpcEvents.ts
- src/renderer/src/components/settings/BrowserPane.tsx
- src/main/ipc/settings.ts
- src/renderer/src/components/sidebar/use-add-repo-host-selection.test.ts
- src/renderer/src/runtime/web-session-tabs-sync.ts
- src/main/runtime/orca-runtime.test.ts
- src/main/providers/local-pty-provider.test.ts
- src/main/ipc/runtime-environments.test.ts
- src/renderer/src/web/web-preload-api.ts
- src/renderer/src/components/status-bar/SshStatusSegment.tsx
- src/renderer/src/i18n/locales/en.json
- src/renderer/src/components/settings/RuntimeEnvironmentsPane.tsx
- src/main/runtime/orca-runtime.ts
- src/renderer/src/i18n/locales/ja.json
- src/renderer/src/i18n/locales/ko.json
- src/renderer/src/i18n/locales/zh.json
- config/reliability-gates.jsonc
- src/renderer/src/store/slices/browser.ts
|
@coderabbitai review |
✅ Action performedReview finished.
|
f383a80 to
2945746
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
2945746 to
a425725
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: c78b39fc-23dd-4410-a8c5-05ad84388637
📥 Commits
Reviewing files that changed from the base of the PR and between f383a80b5c0bde185fabcca7ab1195a52bfb5a83 and a425725.
📒 Files selected for processing (60)
config/reliability-gates.jsoncsrc/main/daemon/daemon-pty-adapter.test.tssrc/main/daemon/daemon-pty-adapter.tssrc/main/daemon/terminal-host-session-listing.tssrc/main/daemon/types.tssrc/main/index.tssrc/main/ipc/ephemeral-vm-runtime-handlers.tssrc/main/ipc/ephemeral-vm.test.tssrc/main/ipc/pty.test.tssrc/main/ipc/runtime-environments.test.tssrc/main/ipc/runtime-environments.tssrc/main/ipc/settings.test.tssrc/main/ipc/settings.tssrc/main/providers/local-pty-provider.test.tssrc/main/providers/local-pty-provider.tssrc/main/providers/pty-process-info.tssrc/main/providers/types.tssrc/main/runtime-environment-focus-self-heal.test.tssrc/main/runtime-environment-focus-self-heal.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/index.tssrc/main/runtime/rpc/methods/session-tabs-schemas.tssrc/main/runtime/rpc/methods/terminal-orphan.tssrc/main/runtime/rpc/methods/terminal.tssrc/main/runtime/rpc/schemas.test.tssrc/main/runtime/runtime-rpc.tssrc/main/runtime/terminal-orphan-owner.test.tssrc/main/runtime/terminal-orphan-owner.tssrc/main/runtime/terminal-orphan-topology.test.tssrc/main/runtime/terminal-orphan-topology.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/src/components/settings/BrowserPane.tsxsrc/renderer/src/components/settings/RuntimeEnvironmentsPane.test.tssrc/renderer/src/components/settings/RuntimeEnvironmentsPane.tsxsrc/renderer/src/components/settings/Settings.tsxsrc/renderer/src/components/sidebar/use-add-repo-host-selection.test.tssrc/renderer/src/components/sidebar/use-add-repo-host-selection.tssrc/renderer/src/components/status-bar/SshStatusSegment.test.tssrc/renderer/src/components/status-bar/SshStatusSegment.tsxsrc/renderer/src/hooks/useIpcEvents.test.tssrc/renderer/src/hooks/useIpcEvents.tssrc/renderer/src/i18n/locales/en.jsonsrc/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/web-session-tabs-sync.tssrc/renderer/src/runtime/web-session-terminal-orphan-mixed-version.test.tssrc/renderer/src/runtime/web-session-terminal-orphan-recovery.test.tssrc/renderer/src/runtime/web-session-terminal-orphan-recovery.tssrc/renderer/src/runtime/web-session-terminal-orphan-topology.tssrc/renderer/src/store/slices/browser.test.tssrc/renderer/src/store/slices/browser.tssrc/renderer/src/store/slices/settings.test.tssrc/renderer/src/store/slices/settings.tssrc/renderer/src/web/web-preload-api.test.tssrc/renderer/src/web/web-preload-api.tssrc/shared/runtime-types.ts
💤 Files with no reviewable changes (5)
- src/main/ipc/ephemeral-vm-runtime-handlers.ts
- src/main/index.ts
- src/main/runtime-environment-focus-self-heal.test.ts
- src/main/runtime-environment-focus-self-heal.ts
- src/main/ipc/pty.test.ts
🚧 Files skipped from review as they are similar to previous changes (49)
- src/main/runtime/runtime-rpc.ts
- src/main/daemon/terminal-host-session-listing.ts
- src/main/daemon/types.ts
- src/main/runtime/rpc/methods/index.ts
- src/renderer/src/components/settings/Settings.tsx
- src/main/runtime/terminal-orphan-owner.ts
- src/main/providers/pty-process-info.ts
- src/preload/api-types.ts
- src/main/runtime/rpc/methods/session-tabs-schemas.ts
- src/shared/runtime-types.ts
- src/main/ipc/ephemeral-vm.test.ts
- src/renderer/src/components/settings/RuntimeEnvironmentsPane.test.ts
- src/main/runtime/terminal-orphan-owner.test.ts
- src/main/daemon/daemon-pty-adapter.ts
- src/main/daemon/daemon-pty-adapter.test.ts
- src/renderer/src/components/status-bar/SshStatusSegment.test.ts
- src/preload/index.ts
- src/renderer/src/runtime/web-session-terminal-orphan-recovery.ts
- src/renderer/src/store/slices/browser.test.ts
- src/main/providers/local-pty-provider.ts
- src/renderer/src/components/sidebar/use-add-repo-host-selection.ts
- src/main/providers/local-pty-provider.test.ts
- src/main/runtime/rpc/methods/terminal-orphan.ts
- src/renderer/src/web/web-preload-api.ts
- src/main/runtime/terminal-orphan-topology.ts
- src/renderer/src/components/settings/RuntimeEnvironmentsPane.tsx
- src/renderer/src/store/slices/settings.ts
- src/main/runtime/rpc/schemas.test.ts
- config/reliability-gates.jsonc
- src/main/providers/types.ts
- src/renderer/src/hooks/useIpcEvents.test.ts
- src/renderer/src/store/slices/settings.test.ts
- src/renderer/src/web/web-preload-api.test.ts
- src/main/ipc/runtime-environments.ts
- src/renderer/src/runtime/web-session-terminal-orphan-topology.ts
- src/main/ipc/settings.test.ts
- src/main/ipc/settings.ts
- src/renderer/src/i18n/locales/es.json
- src/renderer/src/components/status-bar/SshStatusSegment.tsx
- src/main/ipc/runtime-environments.test.ts
- src/renderer/src/hooks/useIpcEvents.ts
- src/main/runtime/orca-runtime.test.ts
- src/renderer/src/runtime/web-session-tabs-sync.ts
- src/main/runtime/orca-runtime.ts
- src/renderer/src/i18n/locales/en.json
- src/renderer/src/i18n/locales/zh.json
- src/renderer/src/store/slices/browser.ts
- src/renderer/src/i18n/locales/ko.json
- src/renderer/src/i18n/locales/ja.json
|
@coderabbitai review |
✅ Action performedReview finished.
|
…ing, alt-screen snapshot) (#10614) * test(e2e): register a real runtime host and publish the alt-screen frame as its snapshot Two long-running scheduled-E2E failures on main were stale test setup, not product defects. `onboarding.spec.ts:420` seeded the Active Server by faking a runtime environment in the renderer store and writing `activeRuntimeEnvironmentId` through the generic `settings:set` IPC. Since #10011 that setter strips the key, and the dedicated `settings:set-active-runtime-environment-preference` handler resolves the id against the main-process environment store — CI logged `RuntimeEnvironmentStoreError: Unknown environment: env-e2e` from `runtimeEnvironments:subscribe`/`:call` alongside the assertion failure. Register the host for real via `runtimeEnvironments:addFromPairingCode` (offline; no live server) and write the preference through its own channel. `terminal-tab-switch-visual-restore.spec.ts:604` wrote alt-screen frames straight into the renderer's xterm, so those bytes never transited the PTY and main's model could not contain them. On cycle 0 the freshly spawned shell still has queued startup output, so hiding the pane makes main's hidden-delivery gate drop bytes and latch a reveal restore, which repaints main's snapshot over the fabricated frame; later cycles run against an idle shell and survive. Arm the existing `setHiddenSnapshotOverride` seam (already used by sibling tests in this file) with the same frame so the live-write and restore paths render identically, and keep the `markerPresent` assertion. Co-authored-by: Orca <[email protected]> * test(e2e): keep the alt-screen restore path observable Numbering the snapshot frame one higher than the live-written frame keeps the marker assertion path-agnostic while leaving the frame number on screen as the signal for which path painted. An unrecognised frame now fails, and the per-cycle path is recorded rather than asserted because which cycles latch a restore is load-dependent. Frame authoring and readback move to a helper module; the additions crossed the spec's max-lines cap. Co-authored-by: Orca <[email protected]> * Escape regex metacharacters in alt-screen marker pattern Marker is treated as a literal string, so escape regex metacharacters to prevent them from being interpreted as regex syntax. --------- Co-authored-by: Orca <[email protected]>
…stablyai#10011) Adds guarded host-authoritative orphan PTY adoption and keeps Active Server durable preference mutations exclusive to its explicit settings control.
…ing, alt-screen snapshot) (stablyai#10614) * test(e2e): register a real runtime host and publish the alt-screen frame as its snapshot Two long-running scheduled-E2E failures on main were stale test setup, not product defects. `onboarding.spec.ts:420` seeded the Active Server by faking a runtime environment in the renderer store and writing `activeRuntimeEnvironmentId` through the generic `settings:set` IPC. Since stablyai#10011 that setter strips the key, and the dedicated `settings:set-active-runtime-environment-preference` handler resolves the id against the main-process environment store — CI logged `RuntimeEnvironmentStoreError: Unknown environment: env-e2e` from `runtimeEnvironments:subscribe`/`:call` alongside the assertion failure. Register the host for real via `runtimeEnvironments:addFromPairingCode` (offline; no live server) and write the preference through its own channel. `terminal-tab-switch-visual-restore.spec.ts:604` wrote alt-screen frames straight into the renderer's xterm, so those bytes never transited the PTY and main's model could not contain them. On cycle 0 the freshly spawned shell still has queued startup output, so hiding the pane makes main's hidden-delivery gate drop bytes and latch a reveal restore, which repaints main's snapshot over the fabricated frame; later cycles run against an idle shell and survive. Arm the existing `setHiddenSnapshotOverride` seam (already used by sibling tests in this file) with the same frame so the live-write and restore paths render identically, and keep the `markerPresent` assertion. Co-authored-by: Orca <[email protected]> * test(e2e): keep the alt-screen restore path observable Numbering the snapshot frame one higher than the live-written frame keeps the marker assertion path-agnostic while leaving the frame number on screen as the signal for which path painted. An unrecognised frame now fails, and the per-cycle path is recorded rather than asserted because which cycles latch a restore is load-dependent. Frame authoring and readback move to a helper module; the additions crossed the spec's max-lines cap. Co-authored-by: Orca <[email protected]> * Escape regex metacharacters in alt-screen marker pattern Marker is treated as a literal string, so escape regex metacharacters to prevent them from being interpreted as regex syntax. --------- Co-authored-by: Orca <[email protected]>
Summary
This combines the remote-runtime control-plane fixes that must agree on host ownership and routing. It supersedes #10010 and #10014 and targets
maindirectly.terminal.adoptOrphansrecovery for live PTYs whose client-persisted tabs no longer have host visual ownership.Deterministic reproduction
Active Server isolation
Start with Active Server = Local desktop, connect to Windows 2, navigate its workspaces, then reveal a local terminal. Before this change, connection/navigation could persist Windows 2 and reveal failed with:
The composed test repeats Local -> connect Windows 2 -> remote workspace -> local reveal -> restart. Reveal succeeds and the durable preference remains Local desktop. Multi-client, multi-server, pairing, browser/mobile routing, stale async completion, server updating, and restart are covered.
Live orphan PTYs
The v1.4.150-shaped upgrade harness retains agent, setup, and ordinary shell PTYs while the upgraded host initially has no visual owner for their persisted tab/leaf identities. The affected Windows 2 Setup PTY was live and writable but rendered stale output: typing
fdsfollowed by a marker left the hidden prefix queued in ConPTY; after interrupt, the marker executed and replay still showed stale/duplicated fragments.The current-to-current host restart and disconnect/reconnect harness preserves handle, incarnation, tab, leaf, title, output, input, resize, active group, and multi-client convergence. That narrows missing host identity to the legacy migration path; the renderer replay/parse issue is handled separately in #10012.
Safety contract
Only the dedicated validated preference IPC invoked by Advanced Active Server can persist the default runtime. It rejects unknown saved-server IDs. Workspace operations route to their owning host without rewriting the preference.
Orphan adoption fails closed for stale/reused handles, invalid or mismatched incarnations, wrong worktree, SSH/native/WSL owner mismatch, inadequate mixed-version identity, competing ownership, occupied/tombstoned surfaces, truncated unresolved inventory, and topology revision conflict. First writer wins; later clients receive the converged host snapshot.
Platforms
Path-normalized identity and ownership checks cover macOS, Linux, Windows, native, WSL, SSH, mixed versions, headless hosts, and multiple clients. Unknown mixed-version Windows/WSL ownership fails closed; successful native Windows fixtures report the provider's explicit
wslDistro: nullownership.Screenshots
No structural UI change. The only visible adjustment is corrected/localized server-removal copy; the terminal failure and recovery are asserted through deterministic state and live PTY evidence.
Testing
497138435: 23 files, 1,750/1,750 tests; provider/daemon follow-up 195 passed with 3 platform skips.mainatc445f2654: verify, Windows restart, Windows/Ubuntu native smoke, Wayland, and packaged crash survival all green.mainatc445f2654is clean.AI Review Report
CodeRabbit findings were addressed: saved-server existence validation, shared incarnation validation, recovery promise handling, localized removal/browser copy, removed transient browser-host repair, topology-merge rationale and branch coverage, and reliability-gate file coverage. Repeated
internal-review-until-cleanpasses covered persistence boundaries, stale async results, wrong-process attachment, handle reuse, incarnation fencing, partial split recovery, replay freshness, canonical preference IDs, competing owners, CAS races, topology validation, truncated inventories, failure rollback, SSH/WSL routing, and multi-client convergence. The final CodeRabbit pass is clean and all GitHub review threads are resolved.Security Audit
The adoption RPC grants no process-selection freedom beyond a host-listed exact handle/incarnation pair. It verifies execution owner, worktree, visual ownership, bounded topology input, and a topology CAS before persisting. Unknown identity fails closed, and rollback restores the prior session if persistence fails. The Active Server IPC resolves the requested saved environment before persistence and generic settings writes strip the protected field.
Notes
Related parsed-output flow-control follow-up: #10012. Both PRs are direct to
main; keeping them separate isolates host/topology migration risk from terminal throughput/backpressure risk.