Repository navigation
fix(ssh): bind reattached SSH panes into the target's own session partition - #26088
Conversation
…tition A relay reattach persisted the pane binding into the local partition, minting a minimal copy of every reattached SSH tab there. When nothing saved over it (a reconnect with no window open), the next startup kept that copy and skipped the SSH partition's rows for the workspace: its open editor tabs were missing for a launch and its agent-resume records were dropped (STA-9544). Bind into ssh:<target>, where the spawn bound the same pane.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to This change adds an end-to-end test for SSH relay reattachment that runs only when the SSH Docker flag is enabled. No merge-blocking risk was found in the supplied material. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Linked Issues checkExplanation Issue
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Waits for the SSH partition to persist the open file and for main's SSH state to report the reattached connection, instead of fixed 3s/30s sleeps that could pass vacuously on a slow reconnect.
…tition (stablyai#26088) * fix(ssh): bind reattached SSH panes into the target's own session partition A relay reattach persisted the pane binding into the local partition, minting a minimal copy of every reattached SSH tab there. When nothing saved over it (a reconnect with no window open), the next startup kept that copy and skipped the SSH partition's rows for the workspace: its open editor tabs were missing for a launch and its agent-resume records were dropped (STA-9544). Bind into ssh:<target>, where the spawn bound the same pane. * test(e2e): run the reattach home-partition spec only in the Docker SSH lane * test(e2e): keep Electron running after its last window closes on Linux in the reattach spec * test(e2e): sync the SSH reattach spec on state, not sleeps Waits for the SSH partition to persist the open file and for main's SSH state to report the reattached connection, instead of fixed 3s/30s sleeps that could pass vacuously on a slow reconnect. (cherry picked from commit d68f3bb)
ELI5
Orca saves each SSH workspace's terminal layout under that SSH host. After an SSH reconnect, Orca also wrote a second, stripped-down copy under "this computer". If nothing overwrote that copy before the next launch, Orca loaded it instead of the real one. That launch was missing the workspace's open files, and its paused agent sessions could no longer be resumed. This PR saves the reconnected terminal under the SSH host, where it belongs.
What Changed
Before. When an SSH connection drops and comes back, Orca reattaches each still-running remote terminal. The reattach saved the terminal into the
localsession store, so every reattached SSH tab got a minimal copy there: generic title, default split. With a window open, the window's next save deleted that copy within about a second. With no window open, the copy stayed on disk. That happens on macOS, where Orca keeps running after its window closes and reconnects SSH by itself. On the next launch, startup seeslocalholding tabs for the workspace and skips the SSH host's saved rows for it. The user sees:After. The reattach saves into
ssh:<target>, the same store the terminal's original spawn wrote to. Nolocalcopy is created, so startup has nothing to prefer over the real one.Mechanism.
restoreReattachedPtyRuntime(src/main/ssh/ssh-relay-session.ts) now passesssh:<targetId>topersistPtyBinding. It also decides "does this pane still exist?" from that store instead of fromlocal.localis still checked for the pane, so a pane that only an older build's leftoverlocalrows hold is not refused. Other changes: four comments that described the old behavior, a unit assertion, and a new Docker SSH e2e spec, registered inrun-ssh-docker-e2e.mjs.Not changed.
localcopies that older builds already wrote are not migrated. Startup still prefers such a copy one more time; the window's first save then moves that workspace home and clears it.Why
This is the narrowest change at the source of the bug: the only path that kept writing SSH panes into
local. The spawn path and the window already write SSH workspaces tossh:<target>. Alternatives considered:Linked Issue
Fixes #25616
Refs #23390 (this stops new
localcopies; it does not change the startup rule that issue describes)Visual Proof
N/A: there is no UI change. The behavior is pinned by
tests/e2e/ssh-reattach-home-partition.spec.ts(real sshd container and relay; hidden window; three launches on one profile):localholds 2 SSH tabs after the reattach, and the relaunched workspace shows{"tabs":2,"files":[]}(the open README.md tab is missing);localholds no SSH tabs, and the workspace relaunches with{"tabs":2,"files":["README.md"]}.Testing
tests/e2e/ssh-reattach-home-partition.spec.ts: fails on main, passes here. Also passing here:ssh-restart-tab-accumulation,ssh-reconnect-tab-destruction,ssh-docker-reconnect-pane-restore,ssh-lost-kill-tab-resurrection(7 tests, macOS + Docker sshd).ssh-relay-session-reconnect-incarnation.test.tsasserts the reattach binds intossh:target-1; it fails on main.pnpm test src/main/ssh src/main/persistence/terminal-topology: green apart from 3 tests that depend on this machine (fish config, real-SQLite integration).pnpm run test:e2e:terminal-layout-parity -- --base origin/main --head HEAD: PASS: all 9 local scenarios identical to main (base358e4f92e0c). No SSH parity scenario: the parity harness has no Docker lifecycle yet (listed as a follow-up intests/e2e/AGENTS.md), so the SSH scenario is the dedicated spec above.pnpm tcandpnpm run check:code-quality:changedpass.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
runtime:) workspaces do not use this path.localcopies are handled as described above.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)