Skip to content

feat(ssh): open a plain SSH terminal to a host whose move to its Orca server is blocked - #31716

Merged
nwparker merged 10 commits into
mainfrom
nwparker/plain-ssh-terminal
Oct 22, 2026
Merged

nwparker merged 10 commits into
mainfrom
nwparker/plain-ssh-terminal

Conversation

@nwparker

@nwparker nwparker commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​716 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​716
Prod 24 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1350 $\color{#cf222e}{\Huge{\mathbf{−}}}$​174 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1176

ELI5

When Orca can't finish setting itself up on an SSH host, connecting to that host fails, and every Orca terminal on it stops working. Your files on the host are untouched, but until now Orca gave you no way to reach them. This adds an Open plain SSH terminal button for exactly that case. It opens an ordinary ssh login in a small window that you can move, minimize or close, so you can keep working on the host while the setup problem is sorted out.

What Changed

Before: a host whose move to its Orca server was blocked (a refusal, an unsupported host, a failed setup) failed the whole connect. The terminal pane showed "SSH connection required" with only Retry, and Settings showed only the reason. A user with work on the host had no way in from Orca (reported in Slack for a host called "lambda").

After: while the move is blocked, the banner in the terminal pane and the host's row in Settings > SSH Hosts both offer Open plain SSH terminal.

  • The window it opens does not block the rest of Orca, and it can be minimized to a strip in the bottom-right corner. Each host gets one.
  • It permanently says "Plain SSH — unmanaged. Not an Orca workspace: agents and tabs here aren't tracked, and this terminal isn't restored. Closing it ends the SSH session."
  • Passphrase, one-time-code and host-key prompts appear in it, just as in any terminal.
  • When ssh logs out cleanly, the window closes. On any other exit it keeps the output and offers only Close. It never falls back to a local shell.
  • The blocker message and Retry stay visible, and the host is never shown as connected because of this window.
  • On Windows without OpenSSH, it says to install "OpenSSH Client" from Optional features.

Mechanism:

  • Main process (src/main/ssh/plain-ssh-terminal/, src/main/ipc/ssh/plain-ssh-terminal-handlers.ts):
    • The IPC is narrow. plainSsh:open takes only a saved target id. write, resize, close and ack take a session id and are checked against the window that opened it. data and exit events go only to that window.
    • Main refuses a target it doesn't know, an internal target, or a host that isn't blocked.
    • Main builds the argv from the stored target, and the renderer never supplies argv, cwd or env. The argv reuses only the target-identity part of system-ssh-args.ts, now appendSshTargetDestinationArgs. There is no -T, BatchMode or Orca ControlMaster, and -- comes before the destination. A config alias stays bare, so the user's ssh_config (Include, Match, ProxyJump, their own ControlMaster) applies. Host-key checking is never changed.
    • It spawns through spawnPtyExecutable, added next to spawnShellWithFallback, so it gets the same ConPTY options and the same spawn-helper repair. The env comes from buildInheritedLocalPtyEnvironment, extracted from the pane env builder with no change in behaviour.
  • Lifecycle:
    • Each host's claim is taken before any await, so two opens for the same host never both spawn. The same window may replace its own claim (a remount, or close then reopen); another window gets "already open".
    • Reloading, crashing or closing the window ends its sessions, including ones still opening. Quit stops new opens, hangs up, force-kills after 1 second and waits for ssh to exit within the SSH shutdown budget.
    • Native pty calls on an exited Windows pty can't throw into main.
  • Backpressure: the window acknowledges output once it has drawn it. Main pauses ssh when more than 512K UTF-16 units are unacknowledged and resumes it below 128K. A paused pty is resumed before hang-up, because a paused Windows pty never reports its exit.
  • One terminal implementation: AgentTerminalPreview's xterm setup moved into components/standalone-terminal/open-standalone-terminal.ts: Unicode widths, links, the IME bridge, kitty flags, copy/paste/right-click, the shortcut policy and input routing. The preview and plain SSH both use it. The only new knob is answersQueries: plain SSH is its session's only emulator, so it answers cursor, device and keyboard queries; the preview, which only mirrors, keeps suppressing them. createPreviewClipboardPaster now takes an input sink instead of routing by pty id.

Why

  • A separate unmanaged session, not a workspace tab. pty:spawn and the daemon only take a command string typed into a shell, and every terminal tab is tied to a worktree and persisted. A dedicated session can't be restored, synced or used by agents, which is exactly the "not an Orca workspace" promise. It also needs no shell interpolation.
  • Not a fallback transport. Orca deliberately has no relay fallback (Phase 3: every SSH host runs a managed Orca server (orcad), replacing the relay, and orca serve runs on it #24863). This doesn't revive one; it hands the user a plain ssh login and changes no host state.
  • Reusing the preview's terminal. An earlier version of this PR built its own xterm setup, and review rounds kept finding gaps against Orca's terminals: Unicode widths, kitty flags, IME, backpressure. Extracting one standalone terminal closes that whole class of gaps, and the preview's existing tests still pass unchanged.

ref-oss check: VS Code Remote opens a plain local terminal profile when its remote server can't start. It is unmanaged and separate from remote workspaces, which matches this approach. The standalone-terminal extraction follows the same "one terminal implementation" rule as VS Code's xterm wrapper.

Linked Issue

Reported in Slack (a user locked out of host "lambda" whose move was refused). No GitHub issue.

Visual Proof

Screenshots to follow. The new UI is covered by PlainSshTerminalPanels.test.tsx: the label, minimize/close, the exit behaviour and the missing-OpenSSH message.

Testing

  • Automated tests added/updated
  • plain-ssh-terminal-args.test.ts:
    • no -T, BatchMode, multiplexing or host-key overrides;
    • a manual endpoint, a bare config alias, and an alias no config block claims;
    • Windows paths and option-like hosts stay single argv elements after --.
  • plain-ssh-terminal-sessions.test.ts:
    • spawns ssh with an argv array in the home directory;
    • refuses unknown, internal or non-string targets and unblocked hosts;
    • the Windows missing-OpenSSH message;
    • one session per host, with no double spawn from concurrent opens;
    • a reload during a pending open spawns nothing, and a close frees the host at once;
    • owner checks;
    • quit waits for exit and blocks new opens;
    • pause/resume backpressure, and resume before hang-up;
    • signal exits;
    • swallowed native calls on an exited pty.
  • PlainSshTerminalPanels.test.tsx:
    • offered only while blocked and only for this desktop's hosts;
    • early output is shown, acknowledged, and survives a flood from another session;
    • a clean exit closes the window, while a failed or killed ssh keeps its output;
    • closing hangs up;
    • a minimized window never refits.
  • open-standalone-terminal.test.ts: query replies are forwarded only when answersQueries is set.
  • The dashboard-popout suite (23 files, 222 tests) passes unchanged after the extraction.
  • Single-worker local runs: src/main/ssh/plain-ssh-terminal, src/main/ipc/ssh, src/main/providers, src/renderer/src/components/{plain-ssh-terminal,standalone-terminal,dashboard-popout,settings}, src/preload.
  • The full static job runs locally.
  • Verified live vs only in tests:
    • Live on macOS: real node-pty plus real OpenSSH through spawnPtyExecutable, with the argv from buildPlainSshTerminalArgs (-p 1 -- [email protected]). It exited with 255 and "Connection refused" in the pty.
    • Not verified: the Electron UI, an interactive login to a real host, and Windows ConPTY are covered only by tests.

Review

  • Codex (gpt-6.1-sol, high): the final round is clean. Earlier rounds found these problems, all fixed:
    • pending-open races;
    • quit not waiting for ssh to exit;
    • copy shortcuts, Unicode widths, kitty flags, IME and backpressure, which led to the standalone-terminal redesign;
    • query replies;
    • early exits being dropped;
    • theme changes not applying live;
    • native calls on a pty that had already exited.
  • Independent Opus review: no P0–P2 on the final head. Its P2s, all fixed: the StrictMode or close-then-reopen "already open" error; Windows hang-up while paused; a refit while minimized shrinking the remote terminal to 2x1.

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

  • Cross-platform: ssh is found through findSystemSsh, including Windows System32\OpenSSH, and spawned through node-pty's ConPTY path.
  • SSH: shown only for hosts this desktop dials itself, never for a host owned by a remote Orca server.
  • Compatibility: no wire change for paired clients.

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)

nwparker and others added 7 commits October 21, 2026 16:13
… server is blocked

A refused or unserved host fails the whole connect, so the user had no way to
reach their work there. The blocked-move banner and the SSH host row now offer
an unmanaged, unpersisted ssh login in a non-modal window. Main builds the argv
from the saved target (no -T, BatchMode or Orca multiplexing; the config alias
stays bare so ssh_config applies) and spawns ssh with an argv array through the
local PTY spawn primitive.

Co-Authored-By: Claude <[email protected]>
… plain SSH

Extracts the preview's xterm setup (Unicode widths, links, IME bridge, kitty
flags, copy/paste and shortcut policy, user-input routing) into
openStandaloneTerminal, so the plain SSH terminal reuses it instead of a second
copy. Plain SSH output is now acked once rendered, and main pauses ssh while too
much is unrendered.

Co-Authored-By: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 3 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9bdf0bca-958c-4647-9a80-ad55ea5a6fd9
📥 Commits

Reviewing files that changed from the base of the PR and between cfe0dbf and ec97bcd.

📒 Files selected for processing: 28
  • src/main/ipc/ssh/plain-ssh-terminal-handlers.ts
  • src/main/ipc/ssh/ssh-shutdown-drain.ts
  • src/main/ipc/ssh/ssh.ts
  • src/main/providers/local-pty-spawn-environment.ts
  • src/main/providers/local-pty-utils.ts
  • src/main/ssh/plain-ssh-terminal/plain-ssh-terminal-args.test.ts
  • src/main/ssh/plain-ssh-terminal/plain-ssh-terminal-args.ts
  • src/main/ssh/plain-ssh-terminal/plain-ssh-terminal-sessions.test.ts
  • src/main/ssh/plain-ssh-terminal/plain-ssh-terminal-sessions.ts
  • src/main/ssh/system-transport/system-ssh-args.ts
  • src/preload/api-types.ts
  • src/preload/api/plain-ssh-terminal-bridge.ts
  • src/preload/index.ts
  • src/renderer/src/App.tsx
  • src/renderer/src/components/dashboard-popout/AgentTerminalPreview.tsx
  • src/renderer/src/components/dashboard-popout/preview-terminal-paste.ts
  • src/renderer/src/components/plain-ssh-terminal/OpenPlainSshTerminalButton.tsx
  • src/renderer/src/components/plain-ssh-terminal/PlainSshTerminalPanels.test.tsx
  • src/renderer/src/components/plain-ssh-terminal/PlainSshTerminalPanels.tsx
  • src/renderer/src/components/plain-ssh-terminal/PlainSshTerminalView.tsx
  • src/renderer/src/components/settings/SshTargetServerStatus.tsx
  • src/renderer/src/components/standalone-terminal/open-standalone-terminal.test.ts
  • src/renderer/src/components/standalone-terminal/open-standalone-terminal.ts
  • src/renderer/src/components/terminal-pane/TerminalSshReconnectOverlay.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/ssh/plain-ssh-terminal-panels.ts
  • src/shared/plain-ssh-terminal.ts
  • src/shared/ssh-host-move-blocked.ts

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 175eeef6-ad34-4fb8-a332-e09a14abc6ed
📥 Commits

Reviewing files that changed from the base of the PR and between 82512a4 and cfe0dbf.

📒 Files selected for processing: 28
  • src/main/ipc/ssh/plain-ssh-terminal-handlers.ts
  • src/main/ipc/ssh/ssh-shutdown-drain.ts
  • src/main/ipc/ssh/ssh.ts
  • src/main/providers/local-pty-spawn-environment.ts
  • src/main/providers/local-pty-utils.ts
  • src/main/ssh/plain-ssh-terminal/plain-ssh-terminal-args.test.ts
  • src/main/ssh/plain-ssh-terminal/plain-ssh-terminal-args.ts
  • src/main/ssh/plain-ssh-terminal/plain-ssh-terminal-sessions.test.ts
  • src/main/ssh/plain-ssh-terminal/plain-ssh-terminal-sessions.ts
  • src/main/ssh/system-transport/system-ssh-args.ts
  • src/preload/api-types.ts
  • src/preload/api/plain-ssh-terminal-bridge.ts
  • src/preload/index.ts
  • src/renderer/src/App.tsx
  • src/renderer/src/components/dashboard-popout/AgentTerminalPreview.tsx
  • src/renderer/src/components/dashboard-popout/preview-terminal-paste.ts
  • src/renderer/src/components/plain-ssh-terminal/OpenPlainSshTerminalButton.tsx
  • src/renderer/src/components/plain-ssh-terminal/PlainSshTerminalPanels.test.tsx
  • src/renderer/src/components/plain-ssh-terminal/PlainSshTerminalPanels.tsx
  • src/renderer/src/components/plain-ssh-terminal/PlainSshTerminalView.tsx
  • src/renderer/src/components/settings/SshTargetServerStatus.tsx
  • src/renderer/src/components/standalone-terminal/open-standalone-terminal.test.ts
  • src/renderer/src/components/standalone-terminal/open-standalone-terminal.ts
  • src/renderer/src/components/terminal-pane/TerminalSshReconnectOverlay.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/ssh/plain-ssh-terminal-panels.ts
  • src/shared/plain-ssh-terminal.ts
  • src/shared/ssh-host-move-blocked.ts

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

📝 Walkthrough

The application adds unmanaged plain SSH terminal sessions for blocked, user-owned hosts. The change includes SSH argument and PTY helpers, session ownership and lifecycle handling, IPC and preload APIs, and renderer panels with session controls. It also adds a reusable standalone terminal wrapper and updates the dashboard preview to use it.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to cfe0d

This change adds an opt-in plain SSH terminal window for blocked hosts and reuses the standalone terminal code in the dashboard preview. No concrete merge-blocking issue was identified. Manual checks of the Electron window and Windows ConPTY behavior are still worthwhile before release.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description is detailed and covers the user impact, implementation, rationale, testing, compatibility, and checklist. However, it does not provide the required linked GitHub issue, and the require… Add an actual linked GitHub issue under Linked Issue. Attach before-and-after screenshots or a video under Visual Proof. Update the testing section if manual testing remains incomplete.
Docstring Coverage Warning Docstring coverage is 41.82% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 55 functions across 27 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: adding a plain SSH terminal for hosts whose move to an Orca server is blocked.
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.
Full details: Description check

Explanation

The description is detailed and covers the user impact, implementation, rationale, testing, compatibility, and checklist. However, it does not provide the required linked GitHub issue, and the required visual proof for the UI change is still missing; it only states that screenshots will follow.

Resolution

Add an actual linked GitHub issue under Linked Issue. Attach before-and-after screenshots or a video under Visual Proof. Update the testing section if manual testing remains incomplete.

Full details: Docstring Coverage

Explanation

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

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

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

@nwparker
nwparker merged commit 56143a9 into main Oct 22, 2026
94 of 98 checks passed
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