Skip to content

fix(ssh): keep 1.4.224's running terminals working after the upgrade (legacy relay bridge) - #27787

Merged
OrcaWin merged 19 commits into
mainfrom
OrcaWin/legacy-relay-bridge
Oct 12, 2026
Merged

OrcaWin merged 19 commits into
mainfrom
OrcaWin/legacy-relay-bridge

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 26 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2085 $\color{#cf222e}{\Huge{\mathbf{−}}}$​720 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1365
Prod 62 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1946 $\color{#cf222e}{\Huge{\mathbf{−}}}$​853 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1093

ELI5

Orca 1.4.224 kept your SSH terminals running on the server in a helper process (the "relay"), even after you quit the app. Orca 1.4.225 no longer has a relay client, so it refused to connect to those servers until you ended the old terminals yourself. Now upgrading no longer ends your running terminals: Orca connects as normal, the old terminals keep working in their old tabs until they exit on their own, and new terminals open on the new managed server. Nobody is asked anything.

What Changed

Before (1.4.225 today): connecting an SSH host where 1.4.224 left a terminal running fails with "Terminals started by an older version of Orca are still running on this host…". #27748 added an "End old terminals on this host" button and confirmation dialog to that refusal.

After:

  • The connect is never refused because of old relay terminals. The host converts to the managed server (orcad) as it does for any other host.
  • Each old terminal reappears in its old tab and works normally: typing, output and resizing. If the SSH connection drops, the tab waits and reattaches when the host answers again, instead of treating the terminal as dead.
  • When an old terminal exits, its tab ends like any finished terminal, and the next shell in that tab opens on orcad. New tabs always open on orcad.
  • No prompts. fix(ssh): end an older Orca's relay terminals from the connect refusal (STA-10166) #27748's button, dialog, toasts, IPC handler and stop scripts are removed (reverted), because nothing can reach that refusal anymore.

Mechanism (everything bridge-specific is in src/main/ssh/legacy-relay-bridge/, with a README and COMPAT(legacy-relay-bridge) tags on every seam):

  • Conversion gate. A census that finds live or unproven relay terminals now returns a new bridged verdict instead of refusing. Converting never stops a relay. The conversion journal records those leases in a new optional bridgedPtyIds field, so the fence and the stage/commit checks don't mistake them for terminals started mid-conversion. A lease that appears after the proof still refuses, as before.
  • The bridge (main process). After the managed connect, and before a converting host's tabs remount, it lists this target's relay sockets (POSIX, including sockets a long $HOME moved under /tmp) or named pipes (Windows, through the existing pipe inventory). It runs each relay's own relay.js --connect from its version directory, so the old build's handshake accepts it, the same way the existing census already counts relay terminals. It takes the terminal-owner role without output flow control, which is what 1.4.224's own previous-relay route did. It never deploys, starts, stops or deletes a relay, and never displaces a client that is still attached. Verdicts follow the SSH execution boundary: a dropped connection is unverifiable and retried with backoff, and a lease is marked terminated only when the relay reports the exit, or when every relay for the target answered and none holds it.
  • Renderer. A runtime pane whose tab and leaf match a bridged lease (or that still names an ssh: PTY id) gets a small transport that reattaches through the bridge's own IPC channels and hands every other connect to the normal orcad transport. A terminal the relay no longer runs comes back as the existing "session expired" error, which retires the binding and starts a fresh shell on orcad.
  • Telemetry. New ssh_host_server_legacy_relay_bridge event (enum-only, same host fields as the other ssh_host_server_* events): phase: connected with a terminals bucket when a host connects with bridged terminals, and phase: terminal_exited per exit.

Why

  • Not refusing is the point. Most active SSH users upgrading from 1.4.224 have relay terminals that 1.4.224 kept alive indefinitely. A refusal, or a button that kills their shells and agents, loses work. The bridge loses nothing, and converting the host is safe while relays run because conversion moves desktop-side catalog state and never touches relay processes.
  • Why not restore 1.4.224's bridge as it was. In 1.4.224 the host stayed on the relay route while relay terminals were live, and older relays were bridged through the relay session's SSH PTY provider. That whole stack (relay session, PTY provider and the IPC delivery for SSH PTYs, about 8k lines) has been deleted, and bringing it back would also bring back a second terminal path for SSH. This change restores only the protocol subset needed to drive an already-running relay (open client, list, attach with replay, input, resize, output, exit), on top of the multiplexer and census code that main still has.
  • Why a renderer transport instead of the main-process PTY registry. That registry is local-only now, and its delivery pipeline is tuned for the local daemon. A dedicated transport keeps the coupling to two small seams (transport selection and the reattach choice), so the bridge can be deleted later in one PR.
  • Windows. 1.4.224 never bridged Windows hosts ("Windows pipes are held, never routed"). This bridges them anyway through the existing pipe inventory and each relay's own PowerShell --connect, so no host is refused. Windows relay bridging is covered by unit tests, not by a live Windows host in this PR.
  • Removal. The README sets a revisit target of about 2027-01-15, decided by the telemetry above. Removal means deleting the folder, the COMPAT(legacy-relay-bridge) seams and the bridged verdict.

Linked Issue

Release blocker for 1.4.225 (follow-up to STA-10166, #27748).

Visual Proof

The Docker e2e saves bridged-terminal.png as a test artifact. It shows the upgraded app with the old tab ("Terminal 1") under the converted host, displaying the 1.4.224 shell's screen (GOT:before-upgrade) and the line typed after the upgrade (GOT:after-upgrade). Otherwise N/A: there is no new UI. The tab looks like any other terminal, and #27748's button and dialog are removed.

Testing

  • tests/e2e/cross-version-wire/legacy-relay-bridge.unit.test.ts builds the real v1.4.224 relay from its tagged sources, runs it detached with --grace-time 0, and leaves a shell in it the way 1.4.224 did on quit. Then:
    • the bridge lists, attaches to (with the screen), types into and resizes that shell;
    • it reattaches after a dropped connection with the screen it left;
    • it never displaces an attached 1.4.224 desktop, and that desktop keeps working;
    • the target bridge serves the leased pane until the shell exits, then retires the lease and hangs up, while the relay itself keeps running.
  • tests/e2e/ssh-orcad-legacy-relay-bridge.spec.ts (Docker SSH host, orcad-ssh-docker lane): a v1.4.224 relay with live shells for this desktop's target and another desktop's target. The upgraded desktop connects and the host converts (never refused). The old tab shows the old shell's screen and answers typing. A new terminal opens on orcad. After every SSH connection is killed, the old tab reattaches and still answers. When the old shell exits, the pane and lease retire. The other desktop's relay and shell are untouched, and its directory still exists.
  • Unit tests:
    • the relay client: owner claim, resume, never displacing an attached owner, waiting out a disconnected holder, relays that predate owner claims, and parsing;
    • the target bridge with fake relays: the live/unverifiable/exited rules, retry, dead sockets, pending stops and dispose;
    • endpoint commands, including the short /tmp socket path;
    • the renderer transport;
    • the gate's bridged verdict under the fence;
    • the connect decision and its wiring.
  • Locally: pnpm tc, pnpm lint, pnpm run check:code-quality:changed, and focused vitest. No Docker or Electron was run locally; the e2e runs in CI.

Review

P0/P1 review: my own pass plus a codex reviewer (GPT-6.1 Sol), focused on never deploying a relay, never killing or sweeping an in-use relay, the SSH boundary verdicts, mixed versions, and data loss.

  • My pass, fixed:
    • Delta moves now bridge too, instead of refusing.
    • A Windows pipe inventory with a pipe no version directory accounts for is not treated as an exhaustive listing, so absence there never retires a lease.
    • An explicit pane restart never reattaches the old terminal.
    • Panes that mount before the host connects keep a bridge retrying, and end once their relay proves them gone.
  • Codex P1s, fixed:
    • The export preflight still refused 1.4.224's detached leases (what a clean quit leaves). They are now exempted, but only the ones the bridged proof recorded.
    • A terminal whose relay could not be asked at first was not published, so its tab could start a second shell on orcad. Every leased pane is now published as unverifiable before the first look, and leaves only on proof of exit.
  • Codex P1, partly addressed:
    • The old relay forwards orca … commands run inside its terminals to its attached client. This build has no relay-era remote CLI (about 3.5k lines removed in refactor(ssh): connect fails for hosts orcad can't serve; remove the relay client path #27214), so the bridge now answers those commands with a clear message ("…started by an older version of Orca, so orca commands are unavailable in it. Run them in a new terminal on this host.") instead of "Method not found".
    • Restoring the remote CLI itself is left out of scope here.
  • Second pass (Opus, on the fixes), P1s fixed:
    • An attach the relay kept refusing (without proof of exit) could loop refresh-and-reattach with no delay. It now marks the pane unverifiable and retries on the doubling backoff, and the renderer reattaches only when a pane changes to live.
    • A lease without a leaf, or a later split inside a mirrored tab, could bind a second pane to the same old shell. Panes now match their own leaf, a leaf-less lease counts only when it is its tab's only one, and each bridged PTY is held by a single pane.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Mixed versions. Nothing on the wire changes for paired clients. bridgedPtyIds is an optional journal field, and older builds' non-strict parse drops it. The bridge's IPC is new and desktop-only (window.api.legacyRelayBridge is optional, so web clients leave it undefined). Another desktop's relay hashes a different target id, so it is never listed, connected to or stopped.
  • Folder workspaces. Leases are matched by tab and leaf, so folder workspaces bridge the same way repositories do.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@OrcaWin
OrcaWin force-pushed the OrcaWin/legacy-relay-bridge branch from 73972d1 to b32700e Compare October 12, 2026 06:12
@OrcaWin
OrcaWin marked this pull request as ready for review October 12, 2026 08:00
@OrcaWin
OrcaWin requested a review from brennanb2025 as a code owner October 12, 2026 08:00
@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough
📝 Walkthrough

Walkthrough

This change adds a bridge that connects to existing terminals on older SSH relays and serves them through the desktop terminal interface. Orcad migration can proceed with live or unverifiable relay terminals by recording their PTY leases as bridged. The change also removes the old-relay termination flow and adds unit, cross-version, and Docker-backed tests for bridge behavior and migration.


Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to 1269c

After an SSH bridge teardown and reconnect, a legacy terminal can accept keystrokes but show no output. Fix the renderer's stale attachment state before merging.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 23.75% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 80 functions across 50 files. (1 skipped:… 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 and concisely identifies the SSH compatibility fix: keeping running 1.4.224 terminals usable after upgrade through the legacy relay bridge.
Description check Passed The description is complete and directly matches the implementation. It covers the user impact, mechanism, rationale, linked issue context, visual proof, testing, review findings, compatibility notes,…

Full details: Docstring Coverage

Explanation

Docstring coverage is 23.75% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 80 functions across 50 files. (1 skipped: 1 unsupported.)


  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2755e260-2f97-40d2-a33a-4321c51b62f8
📥 Commits

Reviewing files that changed from the base of the PR and between 57a7c22 and 48a6dd2f51dd6caff720d56d04c7fceebaddfa57.

📒 Files selected for processing (88)
  • .github/workflows/e2e.yml
  • config/scripts/pr-code-change-scope.mjs
  • config/scripts/pr-e2e-source-routing.mjs
  • src/main/ipc/ssh-connect-flow.ts
  • src/main/ipc/ssh-connection-handlers.ts
  • src/main/ipc/ssh-host-server-on-connect-wiring.test.ts
  • src/main/ipc/ssh-host-server-on-connect-wiring.ts
  • src/main/ipc/ssh-old-relay-terminals-handler.ts
  • src/main/ipc/ssh-session-teardown.ts
  • src/main/ipc/ssh.ts
  • src/main/ipc/telemetry.ts
  • src/main/ssh/legacy-relay-bridge/README.md
  • src/main/ssh/legacy-relay-bridge/legacy-relay-bridge-ipc.ts
  • src/main/ssh/legacy-relay-bridge/legacy-relay-bridge-leases.ts
  • src/main/ssh/legacy-relay-bridge/legacy-relay-bridge-registry.ts
  • src/main/ssh/legacy-relay-bridge/legacy-relay-bridge-timers.ts
  • src/main/ssh/legacy-relay-bridge/legacy-relay-client.test.ts
  • src/main/ssh/legacy-relay-bridge/legacy-relay-client.ts
  • src/main/ssh/legacy-relay-bridge/legacy-relay-endpoints.test.ts
  • src/main/ssh/legacy-relay-bridge/legacy-relay-endpoints.ts
  • src/main/ssh/legacy-relay-bridge/legacy-relay-target-bridge.test.ts
  • src/main/ssh/legacy-relay-bridge/legacy-relay-target-bridge.ts
  • src/main/ssh/orcad-migration-delta-move.test.ts
  • src/main/ssh/orcad-migration-delta-move.ts
  • src/main/ssh/orcad-migration-source-assertions.ts
  • src/main/ssh/orcad-migration-source-fence.ts
  • src/main/ssh/orcad-migration-terminal-gate-host-wide.test.ts
  • src/main/ssh/orcad-migration-terminal-gate.test.ts
  • src/main/ssh/orcad-migration-terminal-gate.ts
  • src/main/ssh/orcad-runtime-conversion.test.ts
  • src/main/ssh/orcad-runtime-conversion.ts
  • src/main/ssh/ssh-host-relay-census-for-target.ts
  • src/main/ssh/ssh-host-relay-endpoint-census.ts
  • src/main/ssh/ssh-host-relay-terminals-on-connect.test.ts
  • src/main/ssh/ssh-host-relay-terminals-on-connect.ts
  • src/main/ssh/ssh-host-server-on-connect.test.ts
  • src/main/ssh/ssh-host-server-on-connect.ts
  • src/main/ssh/ssh-host-server-telemetry.ts
  • src/main/ssh/ssh-host-unserved-status.test.ts
  • src/main/ssh/ssh-host-unserved-status.ts
  • src/main/ssh/ssh-old-relay-daemons-shell.integration.test.ts
  • src/main/ssh/ssh-old-relay-daemons.test.ts
  • src/main/ssh/ssh-old-relay-daemons.ts
  • src/main/ssh/ssh-old-relay-terminals-end.test.ts
  • src/main/ssh/ssh-old-relay-terminals-end.ts
  • src/main/ssh/ssh-target-orcad-preflight.ts
  • src/preload/api-types.ts
  • src/preload/api/legacy-relay-bridge-api.ts
  • src/preload/api/ssh-api.ts
  • src/preload/api/ssh-bridge.ts
  • src/preload/index.ts
  • src/renderer/src/components/settings/SshPane.tsx
  • src/renderer/src/components/settings/SshTargetServerStatus.tsx
  • src/renderer/src/components/sidebar/WorktreeCardSshHostControl.tsx
  • src/renderer/src/components/status-bar/SshTargetStatusRow.tsx
  • src/renderer/src/components/terminal-pane/TerminalSshReconnectOverlay.tsx
  • src/renderer/src/components/terminal-pane/legacy-relay-bridge-panes.ts
  • src/renderer/src/components/terminal-pane/legacy-relay-bridge-transport.test.ts
  • src/renderer/src/components/terminal-pane/legacy-relay-bridge-transport.ts
  • src/renderer/src/components/terminal-pane/pty-connection/deferred-session-attach.ts
  • src/renderer/src/components/terminal-pane/pty-connection/pty-input-recovery.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.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/ssh/ssh-host-server-status-copy.test.ts
  • src/renderer/src/ssh/ssh-host-server-status-copy.ts
  • src/renderer/src/ssh/ssh-old-relay-terminals-action.test.tsx
  • src/renderer/src/ssh/ssh-old-relay-terminals-action.ts
  • src/shared/legacy-relay-bridge-contract.ts
  • src/shared/orcad-migration-source-cutover.ts
  • src/shared/ssh-old-relay-processes-admission.ts
  • src/shared/ssh-old-relay-stop-command.test.ts
  • src/shared/ssh-old-relay-stop-command.ts
  • src/shared/ssh-retained-payload-admission.test.ts
  • src/shared/ssh-retained-payload-admission.ts
  • src/shared/ssh-types.ts
  • src/shared/telemetry-event-registry.ts
  • src/shared/telemetry-ssh-host-server-event-schemas.ts
  • tests/e2e/cross-version-wire/legacy-relay-bridge.unit.test.ts
  • tests/e2e/cross-version-wire/released-relay-daemon.ts
  • tests/e2e/cross-version-wire/released-relay-transport.ts
  • tests/e2e/helpers/build-released-relay-bundle.mts
  • tests/e2e/helpers/legacy-relay-docker-host.ts
  • tests/e2e/helpers/orcad-upgrade-profile.ts
  • tests/e2e/ssh-orcad-legacy-relay-bridge.spec.ts
💤 Files with no reviewable changes (19)
  • src/shared/ssh-old-relay-stop-command.test.ts
  • src/main/ipc/ssh-connection-handlers.ts
  • src/renderer/src/ssh/ssh-old-relay-terminals-action.test.tsx
  • src/main/ssh/ssh-old-relay-terminals-end.ts
  • src/main/ssh/ssh-old-relay-daemons.test.ts
  • src/main/ssh/ssh-old-relay-terminals-end.test.ts
  • src/shared/ssh-old-relay-processes-admission.ts
  • src/renderer/src/components/settings/SshTargetServerStatus.tsx
  • src/main/ipc/ssh-old-relay-terminals-handler.ts
  • src/preload/api/ssh-api.ts
  • src/main/ssh/ssh-host-unserved-status.test.ts
  • src/main/ssh/ssh-host-relay-census-for-target.ts
  • src/renderer/src/ssh/ssh-old-relay-terminals-action.ts
  • src/shared/ssh-retained-payload-admission.test.ts
  • src/shared/ssh-types.ts
  • src/main/ssh/ssh-old-relay-daemons-shell.integration.test.ts
  • src/shared/ssh-old-relay-stop-command.ts
  • src/preload/api/ssh-bridge.ts
  • src/main/ssh/ssh-old-relay-daemons.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Comment on lines +99 to +105
if (!pane) {
// Still waiting on the relay: ask again, which answers exited once it is proven gone.
if (!attached) {
void reattach()
}
return
}

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.

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
rg -nP -C3 'stopLegacyRelayBridge|teardownSshTargetTransport\s*\(' src/main
rg -nP -C3 'this\.attached\.(has|set|delete|clear)' src/main/ssh/legacy-relay-bridge

Repository: stablyai/orca

Length of output: 7509


Reset the attachment state when the bridged pane disappears.

When stopLegacyRelayBridge clears the bridge, the renderer can receive an empty pane list while its local attached flag remains true. On reconnect, the new bridge reports the pane as live, but reattach() is skipped because the renderer still considers the pane attached. The new bridge therefore does not add the PTY to attached, and wireClient drops its output because it requires this.attached.has(ptyId). Input can still reach the relay through liveRoute, leaving a terminal that accepts keystrokes but shows no output.

🐛 Proposed fix
--- "a/src/renderer/src/components/terminal-pane/legacy-relay-bridge-transport.ts"
+++ "b/src/renderer/src/components/terminal-pane/legacy-relay-bridge-transport.ts"
@@ -96,13 +96,13 @@
         if (mode !== 'bridge') {
           return
         }
         if (!pane) {
-          // Still waiting on the relay: ask again, which answers exited once it is proven gone.
-          if (!attached) {
-            void reattach()
-          }
+          // Gone from main (bridge stopped, or waiting on the relay): main's attachment is lost
+          // with it, so ask again. That answers exited once the terminal is proven gone.
+          attached = false
+          void reattach()
           return
         }
         if (pane.state === 'unverifiable') {
           attached = false
           showUnreachable()
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (!pane) {
// Still waiting on the relay: ask again, which answers exited once it is proven gone.
if (!attached) {
void reattach()
}
return
}
if (!pane) {
// Gone from main (bridge stopped, or waiting on the relay): main's attachment is lost
// with it, so ask again. That answers exited once the terminal is proven gone.
attached = false
void reattach()
return
}

m4air added 19 commits October 12, 2026 01:28
…publish every leased pane before the first look
@OrcaWin
OrcaWin force-pushed the OrcaWin/legacy-relay-bridge branch from 48a6dd2 to 1269cbd Compare October 12, 2026 08:30

@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.

♻️ Duplicate comments (1)
src/renderer/src/components/terminal-pane/legacy-relay-bridge-transport.ts (1)

100-106: 🎯 Functional Correctness | 🟠 Major

Reset attached when the bridged pane disappears.

stopLegacyRelayBridge can publish an empty pane list. If it does, attached stays true. After reconnect, the pane is live again, but reattach() does not run. Main therefore never adds the PTY to its attached map, and wireClient drops all output. Input still reaches the relay. The prior review raised this, and the code is unchanged.

🐛 Proposed fix
         if (!pane) {
           lastState = null
-          if (!attached) {
-            void reattach()
-          }
+          attached = false
+          void reattach()
           return
         }

ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4bb689e0-ac9b-4d16-bb59-718441d93849
📥 Commits

Reviewing files that changed from the base of the PR and between 48a6dd2f51dd6caff720d56d04c7fceebaddfa57 and 1269cbd.

📒 Files selected for processing (7)
  • src/main/ssh/legacy-relay-bridge/legacy-relay-bridge-leases.ts
  • src/main/ssh/legacy-relay-bridge/legacy-relay-target-bridge.test.ts
  • src/main/ssh/legacy-relay-bridge/legacy-relay-target-bridge.ts
  • src/renderer/src/components/terminal-pane/legacy-relay-bridge-panes.ts
  • src/renderer/src/components/terminal-pane/legacy-relay-bridge-transport.test.ts
  • src/renderer/src/components/terminal-pane/legacy-relay-bridge-transport.ts
  • src/renderer/src/i18n/locales/en.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/renderer/src/i18n/locales/en.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

sj900211 added a commit to sj900211/orcinus that referenced this pull request Oct 14, 2026
The last stage of the catch-up. Measured from the post-stage-5 main: 425
commits, 23 conflicting files, merge base `6cbbe456c0` — the previous stage's
target, so the lineage is clean. Four analysts planned the clusters in
parallel, one implementer applied all four, and an independent critic reviewed
the staged index.

## What upstream did

Upstream deleted the SSH relay client path, the SSH PTY provider and most of
`src/main/providers/` — about 153 files and 17.8k lines — plus the
`ipc/pty.ts` and `providers/types.ts` barrels. Commits `ff27338299e`,
`a4a96fee704`, `0df25b7ac9b`, `c5224f70d8c`, `b368ebc7a6c`, `aeffeb4cfb5`,
`3c49cdf09ce`.

**It changed no owner-routing logic.** So nearly every conflict had the same
shape: the fork's per-window routing with an SSH-projection line inside it,
against upstream's main-window line with that line removed. The resolution is
the fork's logic minus the SSH lines — `combine`, never `take-ours`, which
would re-reference deleted modules and fail typecheck.

## The two decisions this merge turned on

**The legacy relay bridge must reach every window, and gate its input.**
Upstream's new `legacy-relay-bridge-ipc.ts` keeps 1.4.224's running terminals
alive after an upgrade (stablyai#27787, stablyai#27951). It merges cleanly, and its `send`
reaches `getMainWindow()` only. Three analysts found this independently: a
relay-era SSH pane whose tab lives in a fork project window attaches, replays,
and then never receives output or exit again. It now broadcasts to every app
window, which is safe because each window's transport filters by `ptyId`, and
relay-era ids (`ssh:<target>@@<relay id>`) are often unknown to
`getPtyWorktreeId` so an owner lookup would fall back to main anyway.

Its `write`, `resize` and `detach` also accepted input from any sender, where
every sibling PTY input path in this fork is gated by `isTrustedUIRenderer`
(`write.ts:18,29,41`, `resize-visibility.ts:111,166`, `delivery-flow.ts:167`,
`serialize-buffer.ts:43`). The gate is applied. The legitimate path was traced
end to end before doing so: the only renderer sender is `legacyRelayBridgeApi`,
its only caller is `pty-input-recovery.ts:294`, and that path runs in the main,
workspace and satellite windows, all registered as trusted UI renderers. The
dashboard pop-out loads the same preload and is *not* trusted, but nothing
under `components/dashboard-popout/` imports the bridge transport.

**The user-named access ratchet stays, and the fork now owns it.** Upstream
`26ee9bbfabe` (stablyai#27308, "remove source text checks") deletes the whole ratchet
from `local-file-access.test.ts` — all three lists, the three helpers and the
`node:fs`/`node:path` imports — and replaces it with nothing. Keeping it means
the fork maintains all three lists, not just its own two entries, and a future
upstream commit that adds a user-file builder or a tab opener will fail this
test. That is the point: stage 5's SFTP defect arrived exactly as "upstream
added a new way to open a user-named tab", so a failure here is the alarm
working. The block carries a comment saying the fork owns these lists and that
the response to a failure is to check each new entry against the SFTP guard,
never to delete the fork's entries. The import removal merged cleanly, so the
two imports are restored; without them six identifiers were undefined.

## Defects found that no conflict marker could show

This stage's real work was outside the 23 conflicts: 11 hand edits, three of
which no plan predicted.

- **The scoped reconnect path.** Upstream `bd54fc7fa32` deleted
  `reconnectPersistedTerminals(signal, { workspaceKeys })` as dead code — true
  upstream, where direct SSH was its only caller. The fork has three production
  callers and one test that need it for project windows, and the deletion lands
  cleanly in every region the fork did not touch: the scoping filter, the early
  return, the deferred-SSH preservation, the `remaining*` computation and the
  `workspaceSessionReady` gating. Resolving only the conflict hunks would have
  made every scoped call a silent global reconnect, so the file was replaced
  whole.
- `pty/delivery/payload.ts` — the fork-only `if (!ownerState)` block still used
  the removed `projectionAdmissionIds` and returned the old object from a
  function now typed `boolean`.
- `pty/delivery/window-flow-state.ts` — a fork-only `max-lines` extraction
  stranding upstream's SSH-projection removal; it was not on any extraction
  list. 297 → 287 lines.
- `ssh-filesystem-provider-sftp.ts` — a whole-side take still breaks, because
  the import line upstream deleted sits *outside* the conflict hunks and merges
  cleanly, leaving four types and a helper undefined. Six fork files call them.
- Two fork tests still named the deleted `ipc/pty` barrel: the fork's primary
  multi-window routing suite would have failed to load, and a `vi.mock` of the
  barrel would have silently stopped intercepting, running real PTY
  registration inside a test.
- Found by the cold typecheck: two upstream tests called `isHiddenRendererPty`
  with one argument. The fork keys hidden marks per window, so it takes two.
- Found by the sweep: `daemon-host-path-budget.test.ts` hard-coded upstream's
  `Orca` host root.
- Found by the critic, in a file no gate executes: the fork-only
  `orcinus-cd.yml` still ran `config/scripts/relay-watcher-fault-harness.mjs`,
  which upstream deleted in `2b4b60a87ea` while removing the same step from its
  own release workflows. The next `v*` tag would have failed both build legs
  before publishing. Removed, mirroring upstream.

Coverage upstream deleted and the fork still needs was restored:
`sftp-directory-entries.test.ts` ports the five cases that cover SFTP handle
cleanup on cancellation, for code the fork keeps.

## Review

An independent critic returned REJECT for the `orcinus-cd.yml` defect above and
nothing else: the 27 decisions are applied as specified, both coordinator
decisions hold when re-derived, and every gate re-measures as reported. It found
the defect with a set difference of every repo-path string in every tracked text
file, merged tree minus both parents — it was the only merge-only dangling path
in the repository. No compiler, linter or test executes a workflow file.

The critic also partitioned the sweep's "same" bucket by *which* baseline fails:
`both=2451 mainOnly=35 upOnly=131 neither=5`. Those 35 are the fork's own
pre-existing reds, none merge-caused, and three of them mean a fork feature has
no live test — project windows (`create-project-window.test.ts`), the custom
date-range usage dashboard (`UsageOverviewFilters.test.tsx`) and notifier owner
routing. A follow-up owns them; this merge does not.

`verify-orcinus-identity` is blind to the identity residue this merge adds: the
new macOS terminal-host helper's `CFBundleName` 'Orca', its Orca icon, and the
"Orca allows…" usage-description strings. All inert on an unsigned build.

## macOS terminal-host helper

Upstream `3f8d296b8d7` adds a signed `Orca Terminal Host.app`, about 124 MiB per
mac slice, started from a copy through launchd. Read statically; no Mac host was
available. The fork's unsigned build *can* produce it ad hoc, and can never load
it: the runtime requires the copy to satisfy the running app's designated
requirement, which for an ad-hoc app is its own cdhash. Every failure path falls
back to the pre-merge fork launch. No gate or packaging step the fork runs
assumes a signing identity — `orcinus-ci.yml` is ubuntu-only, `orcinus-cd.yml`
has no macOS leg, and upstream's mac workflows are guarded on their repository.
The cost is that every daemon launch on a fork mac build copies the helper, fails
the check and deletes it. Skipping `packageMacTerminalHost` on unsigned builds is
recorded as a follow-up.

## Gates

Cold typecheck (after deleting `config/*.tsbuildinfo`): 0 errors, measured
independently twice; its first run is what caught the two `isHiddenRendererPty`
arity breaks. Runtime-electron ratchet: `nothing reachable imports electron`.
oxlint: 0 warnings, 0 errors across 32,422 files; oxfmt clean.
verify-orcinus-identity: OK, `upstreamRefs=0`. Unsigned smoke: OK,
`forceCodeSigning=false`. Fork contract tests: 32/32. Windows CLI launcher: the
Rust build runs here and passes. Localization catalog: OK. max-lines ratchet: OK,
4 grandfathered, no new bypasses.

Regression sweep, scoped as the whole universe rather than by directory — the
error that cost stage 4 a rejection and left a 46% hole in stage 5:
`discoverUnitFiles()` is 12,051 files on this tree, every one reported, 0
missing. The three-tree recheck of all 493 failing files gives
`same=2615 diff=2 mergeOnly=5`. One of those five was a real merge defect, the
`Orca` host root, and is fixed. The other four are attributed with evidence:
three flakes that also fail on the upstream baseline in the same file, and one
CRLF artefact of this long-lived working copy whose index blobs are LF in all
three trees. Merge-only failures attributable to this merge: **0**.

Co-Authored-By: Claude Opus 5 (1M context) <[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