Skip to content

fix(runtime): self-heal remote terminal routing - #10011

Merged
OrcaWin merged 13 commits into
mainfrom
fix/remote-terminal-orphan-adoption
Jul 23, 2026
Merged

OrcaWin merged 13 commits into
mainfrom
fix/remote-terminal-orphan-adoption

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Jul 22, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This combines the remote-runtime control-plane fixes that must agree on host ownership and routing. It supersedes #10010 and #10014 and targets main directly.

  • Make Advanced > Active Server the only durable writer of the default runtime preference.
  • Keep connection, pairing, remote navigation, workspace selection, reveal/create, browser/mobile handoff, reconnect, updating, and cleanup on transient or target-owner routing.
  • Add guarded terminal.adoptOrphans recovery for live PTYs whose client-persisted tabs no longer have host visual ownership.
  • Require exact live handle/incarnation, worktree, host/connection/WSL owner, no competing owner, and a topology revision CAS.
  • Restore legacy tabs, splits, groups, active IDs, titles, output, input, and resize while preserving host authority and multi-client convergence.
  • Sanitize absent active tab/group references only after recoverable orphan adoption resolves.

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:

Local terminal reveal is unavailable while a remote runtime is active.

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 fds followed 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: null ownership.

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

  • Latest-main orphan/adoption gate: 6 files, 939/939 tests.
  • Latest-main Active Server gate: 10 files, 282/282 tests.
  • Earlier combined Windows 2 validation head 497138435: 23 files, 1,750/1,750 tests; provider/daemon follow-up 195 passed with 3 platform skips.
  • Typecheck.
  • Reliability manifest.
  • Windows input/output/resize/title/tab/leaf/active-group and first-writer convergence contracts.
  • WSL match/mismatch/unknown-owner, SSH owner mismatch, mixed-version, stale incarnation, handle reuse, and topology CAS cases.
  • Latest-head GitHub CI against main at c445f2654: verify, Windows restart, Windows/Ubuntu native smoke, Wayland, and packaged crash survival all green.
  • Conflict audit against main at c445f2654 is 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-clean passes 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.

@OrcaWin
OrcaWin force-pushed the fix/remote-terminal-orphan-adoption branch from 07acbec to 271d387 Compare July 22, 2026 23:33
@OrcaWin
OrcaWin changed the base branch from main to fix/node-types-stat-nonnull July 22, 2026 23:33
@coderabbitai

coderabbitai Bot commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The 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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly matches the PR’s main focus on remote-runtime routing and self-healing terminal orphan recovery.
Description check ✅ Passed The description includes all required sections and covers summary, testing, AI review, security, screenshots, and platform-specific notes.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
src/main/runtime/terminal-orphan-topology.ts (1)

111-132: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Explain 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 win

Add 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/!proposed early-return branches, and the no-op case (no new groups) in terminal-orphan-topology.ts Lines 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.jsonc
  • src/main/daemon/daemon-pty-adapter.test.ts
  • src/main/daemon/daemon-pty-adapter.ts
  • src/main/daemon/terminal-host-session-listing.ts
  • src/main/daemon/types.ts
  • src/main/providers/local-pty-provider.test.ts
  • src/main/providers/local-pty-provider.ts
  • src/main/providers/pty-process-info.ts
  • src/main/providers/types.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/rpc/methods/index.ts
  • src/main/runtime/rpc/methods/session-tabs-schemas.ts
  • src/main/runtime/rpc/methods/terminal-orphan.ts
  • src/main/runtime/rpc/methods/terminal.ts
  • src/main/runtime/rpc/schemas.test.ts
  • src/main/runtime/runtime-rpc.ts
  • src/main/runtime/terminal-orphan-owner.test.ts
  • src/main/runtime/terminal-orphan-owner.ts
  • src/main/runtime/terminal-orphan-topology.test.ts
  • src/main/runtime/terminal-orphan-topology.ts
  • src/renderer/src/runtime/web-session-tabs-sync.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-mixed-version.test.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-recovery.test.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-recovery.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-topology.ts
  • src/shared/runtime-types.ts

Comment thread src/main/runtime/orca-runtime.ts Resolved
@OrcaWin OrcaWin changed the title fix(terminal): adopt live orphan PTYs safely fix(runtime): self-heal remote terminal routing Jul 22, 2026
@OrcaWin
OrcaWin changed the base branch from fix/node-types-stat-nonnull to main July 22, 2026 23:56
@OrcaWin
OrcaWin force-pushed the fix/remote-terminal-orphan-adoption branch from 5292dcb to 3e739ad Compare July 23, 2026 00:56

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

New orphan-adoption vitest command isn't tracked in testFiles/evidenceRuns.

The third commands entry (line 1427) runs src/main/runtime/terminal-orphan-owner.test.ts, but that file is absent from this gate's testFiles array (1429-1444), and no evidenceRuns entry records an actual pass of this specific command (only the first command and pnpm test:repro:remote-agent-session have 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 evidenceRuns entry for the third commands invocation.

Also applies to: 1520-1538

src/main/ipc/settings.ts (1)

1-1: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Missing "unknown environment id" validation is both a real gap and an unproven reliability-gate claim. settings.ts's dedicated preference handler never resolves environmentId against 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 calling store.updateSettings, mirroring the pattern already used in runtime-environments.ts's remove handler.
  • config/reliability-gates.jsonc#L1625-1632: the assertionRef claims this scenario is covered by settings.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 asserting handler(settingsInvokeEvent, { environmentId: 'does-not-exist' }) throws.
src/renderer/src/runtime/web-session-tabs-sync.ts (1)

2717-2733: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Replay-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 whenever replayed is true — before recovery has even started, and regardless of whether it later fails. In applyActiveSnapshot (2787-2853), the equivalent call only happens after recovered is confirmed non-null, using recovered.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.jsonc
  • resources/skills/current-manifest.json
  • resources/skills/release-mapping.json
  • resources/skills/snapshot-registry.json
  • src/main/daemon/daemon-pty-adapter.test.ts
  • src/main/daemon/daemon-pty-adapter.ts
  • src/main/daemon/terminal-host-session-listing.ts
  • src/main/daemon/types.ts
  • src/main/index.ts
  • src/main/ipc/ephemeral-vm-runtime-handlers.ts
  • src/main/ipc/ephemeral-vm.test.ts
  • src/main/ipc/runtime-environments.test.ts
  • src/main/ipc/runtime-environments.ts
  • src/main/ipc/settings.test.ts
  • src/main/ipc/settings.ts
  • src/main/providers/local-pty-provider.test.ts
  • src/main/providers/local-pty-provider.ts
  • src/main/providers/pty-process-info.ts
  • src/main/providers/types.ts
  • src/main/runtime-environment-focus-self-heal.test.ts
  • src/main/runtime-environment-focus-self-heal.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/rpc/methods/index.ts
  • src/main/runtime/rpc/methods/session-tabs-schemas.ts
  • src/main/runtime/rpc/methods/terminal-orphan.ts
  • src/main/runtime/rpc/methods/terminal.ts
  • src/main/runtime/rpc/schemas.test.ts
  • src/main/runtime/runtime-rpc.ts
  • src/main/runtime/terminal-orphan-owner.test.ts
  • src/main/runtime/terminal-orphan-owner.ts
  • src/main/runtime/terminal-orphan-topology.test.ts
  • src/main/runtime/terminal-orphan-topology.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/components/settings/BrowserPane.tsx
  • src/renderer/src/components/settings/RuntimeEnvironmentsPane.tsx
  • src/renderer/src/components/settings/Settings.tsx
  • src/renderer/src/components/sidebar/use-add-repo-host-selection.test.ts
  • src/renderer/src/components/sidebar/use-add-repo-host-selection.ts
  • src/renderer/src/components/status-bar/SshStatusSegment.test.ts
  • src/renderer/src/components/status-bar/SshStatusSegment.tsx
  • src/renderer/src/hooks/useIpcEvents.test.ts
  • src/renderer/src/hooks/useIpcEvents.ts
  • src/renderer/src/runtime/web-session-tabs-sync.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-mixed-version.test.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-recovery.test.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-recovery.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-topology.ts
  • src/renderer/src/store/slices/browser.test.ts
  • src/renderer/src/store/slices/browser.ts
  • src/renderer/src/store/slices/settings.test.ts
  • src/renderer/src/store/slices/settings.ts
  • src/renderer/src/web/web-preload-api.test.ts
  • src/renderer/src/web/web-preload-api.ts
  • src/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

Comment thread config/reliability-gates.jsonc Resolved
Comment thread src/main/ipc/settings.test.ts Resolved
Comment thread src/main/ipc/settings.ts Resolved
@OrcaWin
OrcaWin force-pushed the fix/remote-terminal-orphan-adoption branch 2 times, most recently from fc5690d to 8dc9460 Compare July 23, 2026 01:58

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Empty ORCA_E2E_RUNTIME_WS_PORT silently falls back to port 0 instead of failing validation.

Number('') evaluates to 0, which passes the Number.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.jsonc
  • src/main/daemon/daemon-pty-adapter.test.ts
  • src/main/daemon/daemon-pty-adapter.ts
  • src/main/daemon/terminal-host-session-listing.ts
  • src/main/daemon/types.ts
  • src/main/index.ts
  • src/main/ipc/ephemeral-vm-runtime-handlers.ts
  • src/main/ipc/ephemeral-vm.test.ts
  • src/main/ipc/runtime-environments.test.ts
  • src/main/ipc/runtime-environments.ts
  • src/main/ipc/settings.test.ts
  • src/main/ipc/settings.ts
  • src/main/providers/local-pty-provider.test.ts
  • src/main/providers/local-pty-provider.ts
  • src/main/providers/pty-process-info.ts
  • src/main/providers/types.ts
  • src/main/runtime-environment-focus-self-heal.test.ts
  • src/main/runtime-environment-focus-self-heal.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/rpc/methods/index.ts
  • src/main/runtime/rpc/methods/session-tabs-schemas.ts
  • src/main/runtime/rpc/methods/terminal-orphan.ts
  • src/main/runtime/rpc/methods/terminal.ts
  • src/main/runtime/rpc/schemas.test.ts
  • src/main/runtime/runtime-rpc.ts
  • src/main/runtime/terminal-orphan-owner.test.ts
  • src/main/runtime/terminal-orphan-owner.ts
  • src/main/runtime/terminal-orphan-topology.test.ts
  • src/main/runtime/terminal-orphan-topology.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/components/settings/BrowserPane.tsx
  • src/renderer/src/components/settings/RuntimeEnvironmentsPane.tsx
  • src/renderer/src/components/settings/Settings.tsx
  • src/renderer/src/components/sidebar/use-add-repo-host-selection.test.ts
  • src/renderer/src/components/sidebar/use-add-repo-host-selection.ts
  • src/renderer/src/components/status-bar/SshStatusSegment.test.ts
  • src/renderer/src/components/status-bar/SshStatusSegment.tsx
  • src/renderer/src/hooks/useIpcEvents.test.ts
  • src/renderer/src/hooks/useIpcEvents.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/runtime/web-session-tabs-sync.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-mixed-version.test.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-recovery.test.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-recovery.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-topology.ts
  • src/renderer/src/store/slices/browser.test.ts
  • src/renderer/src/store/slices/browser.ts
  • src/renderer/src/store/slices/settings.test.ts
  • src/renderer/src/store/slices/settings.ts
  • src/renderer/src/web/web-preload-api.test.ts
  • src/renderer/src/web/web-preload-api.ts
  • src/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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between bb14a40 and 8dc9460.

📒 Files selected for processing (58)
  • config/reliability-gates.jsonc
  • src/main/daemon/daemon-pty-adapter.test.ts
  • src/main/daemon/daemon-pty-adapter.ts
  • src/main/daemon/terminal-host-session-listing.ts
  • src/main/daemon/types.ts
  • src/main/index.ts
  • src/main/ipc/ephemeral-vm-runtime-handlers.ts
  • src/main/ipc/ephemeral-vm.test.ts
  • src/main/ipc/runtime-environments.test.ts
  • src/main/ipc/runtime-environments.ts
  • src/main/ipc/settings.test.ts
  • src/main/ipc/settings.ts
  • src/main/providers/local-pty-provider.test.ts
  • src/main/providers/local-pty-provider.ts
  • src/main/providers/pty-process-info.ts
  • src/main/providers/types.ts
  • src/main/runtime-environment-focus-self-heal.test.ts
  • src/main/runtime-environment-focus-self-heal.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/rpc/methods/index.ts
  • src/main/runtime/rpc/methods/session-tabs-schemas.ts
  • src/main/runtime/rpc/methods/terminal-orphan.ts
  • src/main/runtime/rpc/methods/terminal.ts
  • src/main/runtime/rpc/schemas.test.ts
  • src/main/runtime/runtime-rpc.ts
  • src/main/runtime/terminal-orphan-owner.test.ts
  • src/main/runtime/terminal-orphan-owner.ts
  • src/main/runtime/terminal-orphan-topology.test.ts
  • src/main/runtime/terminal-orphan-topology.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/components/settings/BrowserPane.tsx
  • src/renderer/src/components/settings/RuntimeEnvironmentsPane.tsx
  • src/renderer/src/components/settings/Settings.tsx
  • src/renderer/src/components/sidebar/use-add-repo-host-selection.test.ts
  • src/renderer/src/components/sidebar/use-add-repo-host-selection.ts
  • src/renderer/src/components/status-bar/SshStatusSegment.test.ts
  • src/renderer/src/components/status-bar/SshStatusSegment.tsx
  • src/renderer/src/hooks/useIpcEvents.test.ts
  • src/renderer/src/hooks/useIpcEvents.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/runtime/web-session-tabs-sync.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-mixed-version.test.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-recovery.test.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-recovery.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-topology.ts
  • src/renderer/src/store/slices/browser.test.ts
  • src/renderer/src/store/slices/browser.ts
  • src/renderer/src/store/slices/settings.test.ts
  • src/renderer/src/store/slices/settings.ts
  • src/renderer/src/web/web-preload-api.test.ts
  • src/renderer/src/web/web-preload-api.ts
  • src/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

Comment thread src/renderer/src/hooks/useIpcEvents.ts Resolved
@OrcaWin
OrcaWin force-pushed the fix/remote-terminal-orphan-adoption branch from 8dc9460 to 8966f16 Compare July 23, 2026 02:18

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Avoid 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 when allowLocalRuntime is false. Remove this second toast or add an explicit notification-suppression option to connectEnvironment().

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.jsonc
  • src/main/daemon/daemon-pty-adapter.test.ts
  • src/main/daemon/daemon-pty-adapter.ts
  • src/main/daemon/terminal-host-session-listing.ts
  • src/main/daemon/types.ts
  • src/main/index.ts
  • src/main/ipc/ephemeral-vm-runtime-handlers.ts
  • src/main/ipc/ephemeral-vm.test.ts
  • src/main/ipc/runtime-environments.test.ts
  • src/main/ipc/runtime-environments.ts
  • src/main/ipc/settings.test.ts
  • src/main/ipc/settings.ts
  • src/main/providers/local-pty-provider.test.ts
  • src/main/providers/local-pty-provider.ts
  • src/main/providers/pty-process-info.ts
  • src/main/providers/types.ts
  • src/main/runtime-environment-focus-self-heal.test.ts
  • src/main/runtime-environment-focus-self-heal.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/rpc/methods/index.ts
  • src/main/runtime/rpc/methods/session-tabs-schemas.ts
  • src/main/runtime/rpc/methods/terminal-orphan.ts
  • src/main/runtime/rpc/methods/terminal.ts
  • src/main/runtime/rpc/schemas.test.ts
  • src/main/runtime/runtime-rpc.ts
  • src/main/runtime/terminal-orphan-owner.test.ts
  • src/main/runtime/terminal-orphan-owner.ts
  • src/main/runtime/terminal-orphan-topology.test.ts
  • src/main/runtime/terminal-orphan-topology.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/components/settings/BrowserPane.tsx
  • src/renderer/src/components/settings/RuntimeEnvironmentsPane.test.ts
  • src/renderer/src/components/settings/RuntimeEnvironmentsPane.tsx
  • src/renderer/src/components/settings/Settings.tsx
  • src/renderer/src/components/sidebar/use-add-repo-host-selection.test.ts
  • src/renderer/src/components/sidebar/use-add-repo-host-selection.ts
  • src/renderer/src/components/status-bar/SshStatusSegment.test.ts
  • src/renderer/src/components/status-bar/SshStatusSegment.tsx
  • src/renderer/src/hooks/useIpcEvents.test.ts
  • src/renderer/src/hooks/useIpcEvents.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/runtime/web-session-tabs-sync.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-mixed-version.test.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-recovery.test.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-recovery.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-topology.ts
  • src/renderer/src/store/slices/browser.test.ts
  • src/renderer/src/store/slices/browser.ts
  • src/renderer/src/store/slices/settings.test.ts
  • src/renderer/src/store/slices/settings.ts
  • src/renderer/src/web/web-preload-api.test.ts
  • src/renderer/src/web/web-preload-api.ts
  • src/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

@OrcaWin
OrcaWin force-pushed the fix/remote-terminal-orphan-adoption branch from bf5eadd to 3c10e5c Compare July 23, 2026 02:37
@OrcaWin

OrcaWin commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@OrcaWin

OrcaWin commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/renderer/src/runtime/web-session-terminal-orphan-mixed-version.test.ts (1)

60-72: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert that the legacy terminal remains in state.

This only verifies that recovery returns null. Assert that tabsByWorktree and the leaf-1 PTY mapping still retain term_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.jsonc
  • src/main/daemon/daemon-pty-adapter.test.ts
  • src/main/daemon/daemon-pty-adapter.ts
  • src/main/daemon/terminal-host-session-listing.ts
  • src/main/daemon/types.ts
  • src/main/index.ts
  • src/main/ipc/ephemeral-vm-runtime-handlers.ts
  • src/main/ipc/ephemeral-vm.test.ts
  • src/main/ipc/runtime-environments.test.ts
  • src/main/ipc/runtime-environments.ts
  • src/main/ipc/settings.test.ts
  • src/main/ipc/settings.ts
  • src/main/providers/local-pty-provider.test.ts
  • src/main/providers/local-pty-provider.ts
  • src/main/providers/pty-process-info.ts
  • src/main/providers/types.ts
  • src/main/runtime-environment-focus-self-heal.test.ts
  • src/main/runtime-environment-focus-self-heal.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/rpc/methods/index.ts
  • src/main/runtime/rpc/methods/session-tabs-schemas.ts
  • src/main/runtime/rpc/methods/terminal-orphan.ts
  • src/main/runtime/rpc/methods/terminal.ts
  • src/main/runtime/rpc/schemas.test.ts
  • src/main/runtime/runtime-rpc.ts
  • src/main/runtime/terminal-orphan-owner.test.ts
  • src/main/runtime/terminal-orphan-owner.ts
  • src/main/runtime/terminal-orphan-topology.test.ts
  • src/main/runtime/terminal-orphan-topology.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/components/settings/BrowserPane.tsx
  • src/renderer/src/components/settings/RuntimeEnvironmentsPane.test.ts
  • src/renderer/src/components/settings/RuntimeEnvironmentsPane.tsx
  • src/renderer/src/components/settings/Settings.tsx
  • src/renderer/src/components/sidebar/use-add-repo-host-selection.test.ts
  • src/renderer/src/components/sidebar/use-add-repo-host-selection.ts
  • src/renderer/src/components/status-bar/SshStatusSegment.test.ts
  • src/renderer/src/components/status-bar/SshStatusSegment.tsx
  • src/renderer/src/hooks/useIpcEvents.test.ts
  • src/renderer/src/hooks/useIpcEvents.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/runtime/web-session-tabs-sync.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-mixed-version.test.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-recovery.test.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-recovery.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-topology.ts
  • src/renderer/src/store/slices/browser.test.ts
  • src/renderer/src/store/slices/browser.ts
  • src/renderer/src/store/slices/settings.test.ts
  • src/renderer/src/store/slices/settings.ts
  • src/renderer/src/web/web-preload-api.test.ts
  • src/renderer/src/web/web-preload-api.ts
  • src/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

@OrcaWin

OrcaWin commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@OrcaWin
OrcaWin force-pushed the fix/remote-terminal-orphan-adoption branch from f383a80 to 2945746 Compare July 23, 2026 03:02
@OrcaWin

OrcaWin commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@OrcaWin
OrcaWin force-pushed the fix/remote-terminal-orphan-adoption branch from 2945746 to a425725 Compare July 23, 2026 05:18
@OrcaWin

OrcaWin commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.jsonc
  • src/main/daemon/daemon-pty-adapter.test.ts
  • src/main/daemon/daemon-pty-adapter.ts
  • src/main/daemon/terminal-host-session-listing.ts
  • src/main/daemon/types.ts
  • src/main/index.ts
  • src/main/ipc/ephemeral-vm-runtime-handlers.ts
  • src/main/ipc/ephemeral-vm.test.ts
  • src/main/ipc/pty.test.ts
  • src/main/ipc/runtime-environments.test.ts
  • src/main/ipc/runtime-environments.ts
  • src/main/ipc/settings.test.ts
  • src/main/ipc/settings.ts
  • src/main/providers/local-pty-provider.test.ts
  • src/main/providers/local-pty-provider.ts
  • src/main/providers/pty-process-info.ts
  • src/main/providers/types.ts
  • src/main/runtime-environment-focus-self-heal.test.ts
  • src/main/runtime-environment-focus-self-heal.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/rpc/methods/index.ts
  • src/main/runtime/rpc/methods/session-tabs-schemas.ts
  • src/main/runtime/rpc/methods/terminal-orphan.ts
  • src/main/runtime/rpc/methods/terminal.ts
  • src/main/runtime/rpc/schemas.test.ts
  • src/main/runtime/runtime-rpc.ts
  • src/main/runtime/terminal-orphan-owner.test.ts
  • src/main/runtime/terminal-orphan-owner.ts
  • src/main/runtime/terminal-orphan-topology.test.ts
  • src/main/runtime/terminal-orphan-topology.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/components/settings/BrowserPane.tsx
  • src/renderer/src/components/settings/RuntimeEnvironmentsPane.test.ts
  • src/renderer/src/components/settings/RuntimeEnvironmentsPane.tsx
  • src/renderer/src/components/settings/Settings.tsx
  • src/renderer/src/components/sidebar/use-add-repo-host-selection.test.ts
  • src/renderer/src/components/sidebar/use-add-repo-host-selection.ts
  • src/renderer/src/components/status-bar/SshStatusSegment.test.ts
  • src/renderer/src/components/status-bar/SshStatusSegment.tsx
  • src/renderer/src/hooks/useIpcEvents.test.ts
  • src/renderer/src/hooks/useIpcEvents.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/runtime/web-session-tabs-sync.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-mixed-version.test.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-recovery.test.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-recovery.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-topology.ts
  • src/renderer/src/store/slices/browser.test.ts
  • src/renderer/src/store/slices/browser.ts
  • src/renderer/src/store/slices/settings.test.ts
  • src/renderer/src/store/slices/settings.ts
  • src/renderer/src/web/web-preload-api.test.ts
  • src/renderer/src/web/web-preload-api.ts
  • src/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

@OrcaWin

OrcaWin commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@OrcaWin
OrcaWin merged commit 88b7e69 into main Jul 23, 2026
9 checks passed
AmethystLiang added a commit that referenced this pull request Jul 25, 2026
…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]>
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…stablyai#10011)

Adds guarded host-authoritative orphan PTY adoption and keeps Active Server durable preference mutations exclusive to its explicit settings control.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant