Skip to content

fix(ssh): a user's Disconnect sticks until they connect the host again - #23487

Closed
brennanb2025 wants to merge 24 commits into
mainfrom
brennanb2025/ssh-disconnect-sticks
Closed

brennanb2025 wants to merge 24 commits into
mainfrom
brennanb2025/ssh-disconnect-sticks

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 44 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2493 $\color{#cf222e}{\Huge{\mathbf{−}}}$​179 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2314
Prod 69 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1249 $\color{#cf222e}{\Huge{\mathbf{−}}}$​422 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​827

ELI5

When you click Disconnect on an SSH host, Orca now keeps it disconnected until you connect it again. Before, a terminal in that workspace quietly dialed the host again less than a second later, so Disconnect did nothing. A dropped network connection still reconnects by itself, because losing the network is not you asking to disconnect.

What Changed

Before: Disconnect closed the connection, but nothing remembered that you asked for it. "Disconnected" only meant "no connection right now". Any background caller that wanted the host (a terminal pane attaching, startup restore, a scheduled automation, a paired web client's panes) simply connected it again, typically about 0.4 s after the click.

After:

  • Disconnect records your choice for that host. It persists across restarts.
  • Background callers can no longer connect a host you disconnected. A terminal on it shows "You disconnected " with a Connect button and waits; the browser and editor show the same message and button. Opening a new terminal on it shows the same card rather than reconnecting.
  • Only something you do connects it again: Connect on that card, in the sidebar or in settings, or the Connect buttons on your phone.
  • Scheduled automations on that host are skipped, and the run says "Skipped: you disconnected . Connect it again to resume."
  • A network drop still reconnects automatically, exactly as before. Your choice only changes when you click Disconnect or Connect.

Mechanism:

  • The SSH target stores the user's intent: desiredConnection?: 'connected' | 'disconnected' (absent means connected, which is how every existing target and older build behaves). Only the ssh:disconnect handler writes 'disconnected', and only a user connect writes 'connected'. Targets owned by a runtime (ephemeral VMs) never get an intent.
  • There are two ways in. A user connect (ssh:connect, or the runtime ssh.connect without a flag) records intent and connects. A background connect (ssh.ensureConnected, or ssh.connect with background: true from a paired web client) never records intent. It is refused with a typed ssh_disconnected_by_user when you disconnected the host. The check runs in connectTarget, before any connection attempt is registered or broadcast, and again after the per-target lifecycle wait.
  • A test pins which renderer files may call the user connect, so a new background caller cannot quietly use it to get past the refusal.
  • The published SSH state gains an optional disconnectedBy: 'user', stamped in the one place every published state passes through. Panes decide from that published fact, not from the error, so a pane whose in-flight connect was cancelled by the Disconnect also shows the card rather than an error.
  • The shared per-workspace host signal gains an unavailableReason derived from it; the phase stays "unavailable".
  • Terminating sessions and removing a target use a cleanup connect that passes the refusal without changing your choice.

Why

A Disconnect that background work undoes 0.4 s later is meaningless. The fix models your intent once, at the connection owner, instead of adding a "don't reconnect" check to each caller. Connection status alone cannot answer the question: "disconnected" looks the same after you disconnect, after a failed connect, and for a host that was never dialed. So the intent has to be stored, and it is persisted so a restart does not undo it either.

Alternatives considered:

  • A check at each caller that reconnects. Every new caller would have to remember it, and the first one that didn't would bring the bug back.
  • A single connect with a "cause" argument. Any future caller could pass "user" to make a failing path work. Two separate entry points plus the test that pins user callers make that mistake visible.
  • In-memory only. The terminal's attach would reconnect the host on the first focus after a restart.

Differences from the common pattern

The common pattern stores a per-host desired-connection state at the connection owner, refuses background recovery while it is off, and publishes a distinct "suspended" state.

  • What matches: the persisted per-host intent at the owner, the refusal of non-user reconnects at one point, and the explicit user action being the only thing that ends it.
  • What differs: Orca publishes the reason as an optional field on the existing "disconnected" status instead of a new status value, because the main process owns recovery and older clients must keep understanding the status. It also splits user and background connects into two entry points instead of passing a cause with each request.

Linked Issue

Found while fixing the SSH browser-route e2e regression (#23465): after ssh.disconnect, the workspace terminal's deferred attach redialed the host within about 0.4 s in every CI run.

Visual Proof

TODO: screenshots of the terminal, browser and editor "You disconnected " cards from live QA.

Testing

  • Owner tests (main process):

    • After a user Disconnect, a background connect is refused with no attempt, broadcast or generation change, including after the lifecycle wait.
    • A user connect records intent and connects; the refusal survives a store reload.
    • A network drop still reconnects, and a background connect after reconnection-failed is allowed.
    • A Disconnect during an in-flight user connect wins.
    • A VM teardown never records intent, and a later VM connect succeeds.
    • A web client's background RPC is refused while its plain connect is allowed; the refusal code reaches the client.
    • disconnectedBy is published, including when no connection object exists and after a restart.
  • Renderer tests: the terminal attach waits (no error, no retry) and attaches exactly once after Connect; a cancelled in-flight connect lands on the same wait; the signal, the terminal overlay, the browser card and the editor card show the message and call the user connect; startup restore, automation dispatch and target removal use the right entry point; the ratchet test.

  • Each behaviour was removed in turn (23 ablations), and each removal reddens its tests.

  • New e2e (ssh-user-disconnect-sticks.spec.ts, Docker SSH lane): with a terminal open, after Disconnect the status, generation and disconnectedBy stay unchanged for 6 s; then the overlay's Connect reconnects and the pane reattaches.

  • pnpm tc, full oxlint, pnpm lint (including the localization verifiers), check:code-quality:changed and check:react-doctor:changed are clean.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Mixed versions: the new background flag on ssh.connect and the disconnectedBy field are optional, so older clients ignore them. Caveat: a paired web tab running an older bundle sends plain ssh.connect from its panes, which the host treats as a user connect. Such a tab keeps undoing a Disconnect until it reloads.
  • Agents and the CLI: terminals created by agents or orca terminal create do not count as you acting on the host, including when you run orca terminal create yourself. They wait behind the card until you connect.
  • Follow-ups (not in this PR): an orca ssh connect CLI command, and a Connect button on the phone's terminal view. Until then, a host disconnected on the desktop is reconnected from the desktop or from the phone's New Workspace flow.
  • Remote SSH: loss of contact still never changes intent; the reconnect ladder, relay backoff and sleep/resume paths are unchanged.
  • Folder workspaces: unaffected; intent is per SSH target.
  • Interaction with fix(browser): a failed SSH route keeps its card while the host redials #23465: that PR changes the same e2e spec. Whichever lands second reconciles it.

Author X handle: @BrennanKB5

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)

… nobody clicked

A user's Disconnect used to mean only "there is no connection object", so the
next connect from anywhere redialed the host. Main now stores what the user
asked for on the target row (desiredConnection), written only by the ssh:connect
and ssh:disconnect handlers. Connects nobody clicked go through a separate
ensureConnected entry point that is refused with ssh_disconnected_by_user while
the Disconnect holds, before any authority rotation, registration or broadcast.
Runtime-owned targets never record or enforce it.

Every published state (broadcast, getState, paired clients) carries
disconnectedBy: 'user' while it holds, including after a restart when no
connection object exists. The runtime RPC takes an optional background flag;
absent keeps meaning a user's Connect.
…ling a Disconnect

A terminal pane's deferred attach, startup restore and automation dispatch now
connect through ensureConnected. When it fails and the host publishes that the
user's own Disconnect holds it down, the pane reports nothing, dials nothing
more, and waits for the user's Connect; the same holds when a connect already in
flight fails as a cancellation because of the Disconnect. An automation on such
a host is skipped with a plain reason. Terminating or removing a target's
sessions uses a cleanup connect that leaves the user's Disconnect in place.
… host down

The shared host-connection signal derives unavailableReason: 'user-disconnected'
from the published disconnectedBy, so the terminal overlay, the SSH-routed browser
card and the editor's load-error view say "You disconnected <host>" and offer
Connect, which is the user's own connect and lifts the Disconnect. A new terminal
on such a host shows the same card instead of redialing.

The overlay's and the sidebar card's Connect share one handler, and a ratchet test
pins every renderer caller of the user's connect so a background path cannot
start using it.
…verlay's Connect

A Docker SSH spec disconnects the host with a terminal pane open, checks the
published state stays disconnected, attributed to the user and on the same
connection generation for six seconds, then connects from the overlay. The
browser-routing spec's unavailable-host case now expects the card for a host the
user disconnected, which offers Connect in place of Retry.
@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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

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: 21a9a76d-6efa-4907-aac5-f79699bde4a7

📥 Commits

Reviewing files that changed from the base of the PR and between 0336e20 and 6ef7fba.

📒 Files selected for processing (15)
  • src/main/ipc/ssh-connect-flow.ts
  • src/main/ipc/ssh-connection-handlers.ts
  • src/main/ipc/ssh-relay-session-callbacks.ts
  • src/main/ipc/ssh-terminate-sessions.test.ts
  • src/main/ipc/ssh-terminate-sessions.ts
  • src/main/ipc/ssh-user-disconnect-intent.test.ts
  • src/main/ipc/ssh.ts
  • src/main/ssh/ssh-target-registry.ts
  • src/preload/api/ssh-api.ts
  • src/preload/api/ssh-bridge.ts
  • src/renderer/src/components/settings/SshPane.tsx
  • src/renderer/src/components/settings/ssh-session-termination.ts
  • src/renderer/src/components/settings/ssh-target-remove.test.ts
  • src/renderer/src/components/settings/ssh-target-remove.ts
  • src/renderer/src/web/preload-api/web-terminal-api.ts
💤 Files with no reviewable changes (5)
  • src/preload/api/ssh-api.ts
  • src/preload/api/ssh-bridge.ts
  • src/renderer/src/web/preload-api/web-terminal-api.ts
  • src/renderer/src/components/settings/ssh-session-termination.ts
  • src/main/ipc/ssh.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/main/ipc/ssh-connect-flow.ts
  • src/renderer/src/components/settings/ssh-target-remove.test.ts
  • src/main/ipc/ssh-user-disconnect-intent.test.ts

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


📝 Walkthrough

Walkthrough

The change records user Connect and Disconnect intent for SSH targets and distinguishes user, background, and session-cleanup connection attempts. Background reconnection respects a user Disconnect. Renderer state and interfaces identify user-disconnected hosts and provide Connect actions. Terminal and automation workflows use background connection APIs, and E2E coverage checks that the disconnect state persists until a user reconnects.

Priority: ➖ Normal

Merge Risk: 🔵 Low · up to 6ef7f

A Connect made just before Terminate Sessions may fail and need to be retried. This is a bounded concurrency risk rather than a general failure of disconnect or session cleanup.

Security Architecture Review

Security architecture risk: 🟡 Moderate · up to 6ef7f

A Disconnect now controls future SSH connections, but an error while closing a temporary cleanup connection may leave that connection open despite the saved choice. The reviewed path does not establish what happens to the transport after such an error.

Retained concerns

  • Medium · security · inferred: If teardown of a session-cleanup dial fails, the error is logged and suppressed while user-disconnected intent remains set. The reviewed code does not establish that the SSH transport is closed or that cleanup will be retried.
Security review details

Security Blast Radius

  • inferred — The identified failure path concerns the SSH transport for the target being terminated. The reviewed evidence does not establish cross-target or unauthenticated reachability.

Security Findings and Attack Paths

  • inferred — A teardown failure during the newly permitted cleanup dial could leave SSH connectivity contrary to saved Disconnect intent. Whether the production disconnect failure leaves a live transport is unresolved.

Trust Boundaries and Controls

  • observed — Paired socket messages are forwarded only after an authenticated device is associated with the socket. The SSH RPC handler does not independently verify that a user gesture caused a request classified as user admission.

Resilience and Maintainability Implications

  • observed — Successful cleanup attempts transport teardown, but its error handler logs rather than propagates a failed teardown. The caller therefore cannot treat completion alone as proof that the temporary connection closed.

Hardening Proposals

  • proposed — Make failed cleanup closure observable and ensure it is retried or otherwise contained; verify that paired clients making automatic connects explicitly identify them as background requests.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 26.47% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 68 functions across 56 files. 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 describes the main change: a user’s SSH Disconnect intent persists until the host is connected again.
Description check ✅ Passed The description is detailed and aligned with the template. It explains the user-facing behavior, mechanism, rationale, testing, compatibility considerations, and scope. The visual proof section remain…
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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: effd77ef-9f4d-4e4a-885f-76b6b20d805a

📥 Commits

Reviewing files that changed from the base of the PR and between 433986f and 54c0bc0.

⛔ Files ignored due to path filters (1)
  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
📒 Files selected for processing (78)
  • .github/workflows/e2e.yml
  • config/scripts/run-ssh-docker-e2e.mjs
  • src/main/ephemeral-vm-runtime-ssh.ts
  • src/main/ipc/ssh-connect-flow.ts
  • src/main/ipc/ssh-connection-handlers.ts
  • src/main/ipc/ssh-connection-intent.ts
  • src/main/ipc/ssh-renderer-broadcast.ts
  • src/main/ipc/ssh-target-crud-handlers.ts
  • src/main/ipc/ssh-target-registry.test.ts
  • src/main/ipc/ssh-user-disconnect-intent.test.ts
  • src/main/ipc/ssh.ts
  • src/main/runtime/rpc/errors.ts
  • src/main/runtime/rpc/methods/ssh.test.ts
  • src/main/runtime/rpc/methods/ssh.ts
  • src/main/ssh/ssh-connection-store.ts
  • src/main/ssh/ssh-target-registry.ts
  • src/preload/api/ssh-api.ts
  • src/preload/api/ssh-bridge.ts
  • src/renderer/src/components/browser-pane/assemble-chrome/ssh-routed-browser-page-gate.tsx
  • src/renderer/src/components/browser-pane/assemble-chrome/ssh-routed-browser-page-gate.user-disconnected.test.tsx
  • src/renderer/src/components/browser-pane/use-ssh-workspace-browser-route.host-connection.test.tsx
  • src/renderer/src/components/editor/EditorConflictReviewSurface.tsx
  • src/renderer/src/components/editor/EditorContent.tsx
  • src/renderer/src/components/editor/EditorEditFileSurface.tsx
  • src/renderer/src/components/editor/EditorFileLoadErrorView.tsx
  • src/renderer/src/components/editor/EditorFileLoadErrorView.user-disconnected.test.tsx
  • src/renderer/src/components/editor/local-host-test-fixture.ts
  • src/renderer/src/components/editor/useEditorPanelFileLoadRetry.host-connection.test.tsx
  • src/renderer/src/components/settings/ssh-session-termination.ts
  • src/renderer/src/components/settings/ssh-target-remove.test.ts
  • src/renderer/src/components/settings/ssh-target-remove.ts
  • src/renderer/src/components/sidebar/WorktreeCardSshHostControl.tsx
  • src/renderer/src/components/terminal-pane/TerminalPaneRuntimePortals.tsx
  • src/renderer/src/components/terminal-pane/TerminalSshReconnectOverlay.test.tsx
  • src/renderer/src/components/terminal-pane/TerminalSshReconnectOverlay.tsx
  • src/renderer/src/components/terminal-pane/pty-connection-deferred-ssh-passphrase.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection-deferred-ssh-user-disconnect.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection-parked-ssh-snapshot.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection-reattach-binding.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection-remote-runtime-attach.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection-runtime-owner-spawn-routing.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection-test-environment.ts
  • src/renderer/src/components/terminal-pane/pty-connection/deferred-session-attach.ts
  • src/renderer/src/components/terminal-pane/pty-connection/ssh-session-connect.ts
  • src/renderer/src/components/terminal-pane/terminal-pane-host-state.test.ts
  • src/renderer/src/components/terminal-pane/terminal-pane-host-state.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-foundation.ts
  • src/renderer/src/hooks/automation-dispatch-workspace.ts
  • src/renderer/src/hooks/automation-dispatch-workspace.user-disconnect.test.ts
  • src/renderer/src/hooks/useAutomationDispatchEvents.test.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/lib/worktree-host-connection-phase.test.ts
  • src/renderer/src/lib/worktree-host-connection-phase.ts
  • src/renderer/src/ssh/ssh-user-connect-callers.test.ts
  • src/renderer/src/ssh/ssh-user-connect.ts
  • src/renderer/src/ssh/use-user-disconnected-host-connect.ts
  • src/renderer/src/startup/startup-ssh-connection-restore.test.ts
  • src/renderer/src/startup/startup-ssh-connection-restore.ts
  • src/renderer/src/store/slices/runtime-environment-ssh-selectors.ts
  • src/renderer/src/store/slices/runtime-environment-ssh.ts
  • src/renderer/src/store/slices/ssh-target-cleanup.ts
  • src/renderer/src/store/slices/ssh.test.ts
  • src/renderer/src/web/preload-api/web-terminal-api.ts
  • src/renderer/src/web/web-preload-api-ssh.test.ts
  • src/shared/execution-host.ts
  • src/shared/rpc-contract/ssh-params.ts
  • src/shared/ssh-disconnected-by-user.ts
  • src/shared/ssh-retained-payload-admission.test.ts
  • src/shared/ssh-retained-payload-admission.ts
  • src/shared/ssh-types.ts
  • tests/e2e/helpers/browser-pane-mount-census.ts
  • tests/e2e/local-ssh-browser-routing.spec.ts
  • tests/e2e/ssh-user-disconnect-sticks.spec.ts

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

Comment thread src/main/ipc/ssh-connect-flow.ts Resolved

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

ℹ️ No critical issues — the user-disconnect flow is well covered end to end. The intent gate, though, is not quite the single choke point the PR describes: a few dial sites bypass it. Details below.

Reviewed changes

  • Persisted per-target intent. SshTarget.desiredConnection ('connected' | 'disconnected', absent = connected) is written only by ssh:disconnect and by a user connect, is stripped from renderer-authored target saves, and is preserved across restarts by the target-row normalizer.
  • Admission split. connectTarget(targetId, admission) gains 'user' | 'background' | 'session-cleanup'; 'background' is refused with ssh_disconnected_by_user when the user's Disconnect holds the host. New ssh:ensureConnected / ssh:connectForSessionCleanup IPC and web-preload plumbing; ssh.connect gains an optional background flag.
  • Published disconnectedBy. Stamped at the single enrichment point, synthesized into a disconnected state when no connection object exists (restart), and carried through payload admission and store equality.
  • Renderer wait cards. Terminal overlay, browser gate and editor error view show "You disconnected <host>" with a Connect button; connectPaneSshHost waits instead of redialing; automation dispatch skips with a plain reason; unavailableReason derives from the published field.
  • Ratchet + coverage. A test pins the renderer callers allowed to reach the user connect; owner tests (a–h), renderer tests, and a new Docker-SSH e2e cover the behavior.

ℹ️ The intent gate is not the only place an SSH transport opens

connectTarget is described as the one place that refuses a connect to a host the user disconnected, but two handlers dial connectionManager.connect directly without consulting isSshTargetDisconnectedByUser, and one admission can leave the host connected while intent still says disconnected. The core flow (pane attach, startup restore, automation, VM) is correctly gated and proven by the e2e; these are the remaining gaps.

Technical details
# Unguarded dial sites against a user-disconnected target

## Affected sites
- `src/main/ipc/ssh-connection-handlers.ts:60-67` — `doResetRelay` opens a fresh transport
  (`connectionManager.connect(target)`) when none exists, with only the shutdown fence, no intent
  check. Reachable from the settings "Reset relay" action, which the UI offers while the host is
  `disconnected` (`src/renderer/src/components/settings/SshTargetDestructiveActions.tsx:143-148`).
  It force-stops and disconnects again in `finally`, so the resurrection is transient, but it
  broadcasts a mid-flight `{ status: 'connected', disconnectedBy: 'user' }` and rotates the
  provider authority/generation the renderer keys panes on.
- `src/main/ipc/ssh-connection-handlers.ts:291-300` — `ssh:testConnection` likewise dials
  `connectionManager.connect(target)` with no intent check (user "Test connection"; broadcasts are
  suppressed via `testingTargets`, so silent and transient).
- `src/main/ipc/ssh-connection-handlers.ts:212-216` + `src/renderer/src/components/settings/ssh-session-termination.ts:18-19`
  — the `session-cleanup` connect is allowed past the refusal by design ("the caller closes it
  again"), but the only close is the teardown at `:216`, which `:214` skips by throwing when a
  remote shutdown fails. The cleanup transport then stays live while `desiredConnection` is still
  `'disconnected'`: background connects keep being refused and the UI shows the wait card on a
  host that is actually connected, until the user clicks Connect.

## Required outcome
Decide explicitly whether Reset-relay and Test-connection are sanctioned exceptions (in which case
the invariant statement should say so) or should route through admission / record intent. For
`session-cleanup`, ensure the transport opened for cleanup cannot outlive a failed terminate while
intent is `'disconnected'` — e.g. tear the transport down on the error path, or leave intent
unchanged but force a publish that reflects the live transport.

## Open questions for the human
Is `session-cleanup` winning over a Disconnect intentional even when the terminate fails, or should
a failed terminate fall back to leaving the host down (refusing the cleanup connect)?

ℹ️ Nitpicks

  • Restart delivery currently rests on renderer initial hydration, not the startup reconnect flow: restoreSshConnectionsForStartup only logs a refusal (startup-ssh-connection-restore.ts:73-75) and republishes only connected states, so the wait card after a restart depends on direct-ssh-initial-state-hydration.ts calling ssh.getState. The main-process (c) test pins ssh:getState at the IPC boundary; a renderer test that a restarted pane lands on the wait card would lock the wiring in place.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@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: b8d599b8-49d2-440d-aadd-9ab65776e8bd

📥 Commits

Reviewing files that changed from the base of the PR and between 54c0bc0 and 7599fa8.

📒 Files selected for processing (5)
  • src/main/ipc/ssh-renderer-broadcast.ts
  • src/main/ipc/ssh-user-disconnect-intent.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection-deferred-ssh-user-disconnect.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection/ssh-session-connect.ts
  • src/shared/ssh-types.ts

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

Comment on lines +138 to +156
/**
* Waits on a host the user's Disconnect holds down until the user's own Connect succeeds or
* fails. Only those, or the pane closing, end it: nothing else reattaches this pane once its
* connect gave up, so a Connect abandoned before it finished keeps the pane waiting.
*/
function waitForUserConnectOfHeldDownHost(
session: ConnectPanePtySession
): Promise<UserInitiatedSshConnectOutcome> {
const entryState = useAppStore.getState().sshConnectionStates.get(session.connectionId)
return waitForPublishedSshOutcome(session, (state) => {
if (state?.disconnectedBy === 'user') {
return null
}
const outcome = sshPromptConnectOutcomeForStatus(state?.status, false)
// Why skip the entry state's failure: it was published before this pane waited, so it is
// not the outcome of the user's Connect (the refusal can beat the Disconnect's push).
return outcome === 'failed' && state === entryState ? null : outcome
})
}

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.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '1,225p' src/renderer/src/components/terminal-pane/pty-connection/ssh-session-connect.ts
sed -n '80,155p' src/renderer/src/components/terminal-pane/pty-connection/deferred-session-attach.ts

Repository: stablyai/orca

Length of output: 10659


🏁 Script executed:

#!/bin/bash
set -o pipefail
printf '%s\n' '--- relevant files ---'
git ls-files | rg 'ssh|pty-connection|terminal-pane' | head -200
printf '%s\n' '--- symbols and tests ---'
rg -n --glob '!node_modules' \
  'waitForUserConnectOfHeldDownHost|connectPaneSshHost|waitForPublishedSshOutcome|ensureConnected|getState\(\{ targetId|disconnectedBy|sshConnectionStates|auth-failed|reconnection-failed' \
  src/renderer src/shared src/main test tests 2>/dev/null | head -500
printf '%s\n' '--- changed-file diff summary and focused diff ---'
git diff --stat 433986fa3be37911a0f13f7ffd454b831b87a64c 7599fa8f0bbc7003795ae3fddfdcd8ab33676245 -- src/renderer/src/components/terminal-pane/pty-connection/ssh-session-connect.ts
git diff --unified=30 433986fa3be37911a0f13f7ffd454b831b87a64c 7599fa8f0bbc7003795ae3fddfdcd8ab33676245 -- src/renderer/src/components/terminal-pane/pty-connection/ssh-session-connect.ts

Repository: stablyai/orca

Length of output: 42060


🏁 Script executed:

set -o pipefail
rg -n --glob '!node_modules' \
  'waitForUserConnectOfHeldDownHost|connectPaneSshHost|waitForPublishedSshOutcome|ensureConnected|getState\(\{ targetId|disconnectedBy|sshConnectionStates|auth-failed|reconnection-failed' \
  src/renderer src/shared src/main test tests 2>/dev/null | head -500
printf '%s\n' '--- focused diff ---'
git diff --unified=25 433986fa3be37911a0f13f7ffd454b831b87a64c 7599fa8f0bbc7003795ae3fddfdcd8ab33676245 -- src/renderer/src/components/terminal-pane/pty-connection/ssh-session-connect.ts

Repository: stablyai/orca

Length of output: 41704


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- renderer SSH slice ---'
fd -i '^ssh(\.test)?\.(ts|tsx)$' src/renderer/src/store src/renderer/src 2>/dev/null | head -30
sed -n '1,130p' src/renderer/src/store/slices/ssh.ts
printf '%s\n' '--- IPC handlers and state publication ---'
sed -n '90,155p' src/main/ipc/ssh-connection-handlers.ts
sed -n '1,115p' src/main/ipc/ssh-renderer-broadcast.ts
printf '%s\n' '--- user disconnect/Connect contract tests ---'
sed -n '110,255p' src/main/ipc/ssh-user-disconnect-intent.test.ts
sed -n '295,375p' src/main/ipc/ssh-user-disconnect-intent.test.ts
printf '%s\n' '--- renderer Connect callers/tests ---'
cat -n src/renderer/src/ssh/ssh-user-connect-callers.test.ts
rg -n --glob '!node_modules' 'ssh-session-connect|connectPaneSshHost|waitForUserInitiatedSshConnect' src tests

Repository: stablyai/orca

Length of output: 26955


Capture the entry state before the asynchronous hold check.

isSshHostHeldDownByUser can await ssh.getState. If the user's Connect publishes auth-failed during that await, the later entryState read captures that real failure. The waiter then suppresses it because state === entryState, so the pane can remain pending instead of returning the Connect error.

Suggested fix
 function waitForUserConnectOfHeldDownHost(
-  session: ConnectPanePtySession
+  session: ConnectPanePtySession,
+  entryState: SshConnectionState | undefined
 ): Promise<UserInitiatedSshConnectOutcome> {
-  const entryState = useAppStore.getState().sshConnectionStates.get(session.connectionId)
   return waitForPublishedSshOutcome(session, (state) => {
@@
   if (result.connected || session.disposed) {
     return result
   }
+  const entryState = useAppStore.getState().sshConnectionStates.get(session.connectionId)
   if (!(await isSshHostHeldDownByUser(session.connectionId))) {
     return result
   }
-  const outcome = await waitForUserConnectOfHeldDownHost(session)
+  const outcome = await waitForUserConnectOfHeldDownHost(session, entryState)

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

✅ No new issues found.

Reviewed changes

Since the prior pullfrog review (54c0bc0a), three commits close the gaps that review raised, and I found no new problems.

  • A held-down host always publishes as disconnected. withUserConnectionIntent (src/main/ipc/ssh-renderer-broadcast.ts:59-75) coerces every publication through broadcastSshState and getPublicSshState to { status: 'disconnected', error: null, reconnectAttempt: 0, disconnectedBy: 'user' } while the intent holds, so a transport opened for Reset Relay or a session cleanup can no longer present as the host coming back.
  • A failed terminate closes the cleanup transport it needed. closeTransportHeldDownByUser (src/main/ipc/ssh-connection-handlers.ts:106-122) is wired to the ssh:terminateSessions error path and tears the transport/session down when the host is held down, so no live transport outlives a failed terminate. The nested runTargetLifecycle cannot deadlock: the queue entry is deleted in finally before the rejection reaches the .catch.
  • A held-down pane waits through the races. waitForUserConnectOfHeldDownHost (.../pty-connection/ssh-session-connect.ts:143-156) is single-shot rather than looping, keeps waiting when a user Connect is abandoned at the passphrase prompt, and suppresses a stale pre-Disconnect failure via the state === entryState identity guard. Disposal still resolves the wait.
  • Coverage. New owner tests pin both behaviours — every published state masked while getState is connected, and the failed-terminate teardown (connection undefined, lease left detached) — and two renderer tests cover the refusal-beats-the-push race and the abandoned Connect.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

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

✅ No new issues found.

Reviewed changes

Since the prior pullfrog review (103dec31), the delta is one test-only commit that locks in the fix that review approved. No production code changed, and no new problems.

  • A failed terminate must not cancel a user's Connect. New owner test (h) a user's Connect during a failed terminate keeps the connection it asked for (src/main/ipc/ssh-user-disconnect-intent.test.ts:379) races a user ssh:connect against an in-flight ssh:terminateSessions that fails, on a host the user had disconnected, and asserts the connect still resolves connected with a live transport and intent connected. It is genuine coverage: removing the !isSshTargetDisconnectedByUser guard from closeTransportHeldDownByUser makes the test reject with SshConnectAttemptCancelledError, because the unguarded close reaches disconnectRegisteredSshTarget and rotates the provider authority out from under the parked user connect.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

… host-side operation

The renderer used to make two calls to end remote terminals on a detached host: a cleanup
connect, then the terminate. A reload between them left a live transport, relay session and
redial on a host the user had disconnected, and a Connect clicked between them joined the
cleanup dial only for the terminate to tear it down.

ssh:terminateSessions now owns the whole operation in the target's lifecycle queue: it dials
the relay itself when the sessions need it, terminates, and closes the transport again when the
user's Disconnect holds the host down. A user Connect made meanwhile waits for the operation and
dials its own session. A relay that reaches ready while the Disconnect holds restores no port
forwards and republishes no phone tabs. The ssh:connectForSessionCleanup channel is removed.

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

✅ No new issues found.

Reviewed changes

Since the prior pullfrog review (0336e20), one commit consolidates how a user's "end terminals" reaches a host: the host now dials and closes the relay in a single lifecycle operation, so the renderer no longer reconnects before terminating.

  • ssh:terminateSessions owns both ends. The new terminateSshTargetSessions (src/main/ipc/ssh-terminate-sessions.ts) runs inside the target lifecycle queue, calls terminateReachableSessions, and on SSH_TERMINATE_RECONNECT_REQUIRED dials with connectTarget(targetId, 'session-cleanup') and retries; its finally closes the cleanup transport (detach, so a failed terminate keeps its leases for retry). A user Connect parked behind the operation therefore waits for it instead of joining the dial.
  • ssh:connectForSessionCleanup is gone. The IPC handler, preload API, web stub and SshTargetRemoveApi.connect are removed; only terminateSshTargetSessions may pass the session-cleanup admission (RegisteredSshConnectAdmission excludes it from the registry/RPC), and connectTarget skips the lifecycle wait for it so the in-operation dial cannot self-deadlock.
  • Renderer retry deleted. terminateSshSessionsWithReconnect is removed; SshPane calls terminateSessions directly, and removeSshTargetWithBestEffortCleanup drops its reconnect/retry while preserving the #2626 guarantee that an unreachable host cannot block target removal.
  • Held-down publication. A session-cleanup relay that reaches ready on a user-disconnected host restores no port forwards and republishes no phone tabs (ssh-relay-session-callbacks.ts).
  • Coverage. Five owner tests cover the single-dial success, the masked publication, the failed-terminate close, a user Connect during a failed cleanup, and a user Connect during the cleanup's dial; the existing terminate tests now assert the host dials itself. I ran these plus the touched renderer/preload tests (54 green) and pnpm tc (clean).

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

…cted host back

End Terminals, Remove and Reset Relay used to reach a host with no live session by
registering a full connection and relay session, then hiding it from readers. They now
run over a maintenance channel: a bare connection (and, for terminate, a bare relay mux)
that is never registered, publishes no state, rejects on any drop instead of reconnecting,
is closed on every exit path, and is aborted and joined by the shutdown drain.

This removes the session-cleanup connect admission and the relay-ready skip it needed;
while the user's Disconnect holds, nothing registers a transport or session for the host.

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

✅ No new issues found.

Reviewed changes

Since the prior pullfrog review (6ef7fba), two commits replace the registered session-cleanup connection with a genuinely unregistered maintenance channel, and add relay-side proof that a stop from a client with no consumer session is honoured. I found no new problems and ran two focused specialist passes over the concurrency and teardown seams.

  • Dropped the session-cleanup admission. SshConnectAdmission is now only 'user' | 'background'; connectTarget always waits the target lifecycle queue and re-asserts admission after it, so there is no admission that could bypass the queue or the refusal.
  • New maintenance channel. withSshMaintenanceTransport / withSshMaintenanceRelay (src/main/ipc/ssh-maintenance-channel.ts) open a bare SshConnection that is never registered in the connection manager, a relay session or a provider registry, publishes no state and rotates no authority; it reuses the host relay over the same instance id and hands callers a raw multiplexer.
  • ssh:terminateSessions rewritten around it. A live provider still ends its own sessions; a target with no provider but owned leases now dials over the maintenance relay and issues pty.shutdown per relay pty id, while an unreachable host still surfaces SSH_TERMINATE_RECONNECT_REQUIRED so target removal is never blocked (#2626).
  • ssh:resetRelay uses the maintenance channel when no connection is registered, so a Reset cannot bring a user-disconnected host back through the registry.
  • Shutdown drain owns the maintenance transports. beginSshShutdown aborts and joins each operation, and the held-down setOnReady guard was reverted because no relay session can reach ready on a held-down host any more.
  • Coverage. Owner tests for the passphrase prompt/cancel, relay-deploy failure and drain join/abort; the terminate/reset intent tests now assert nothing is registered while the Disconnect holds; a new relay test pins pty.shutdown from a no-consumer-session client and that an owner-fenced stop is still refused.

Two open questions I traced to a negative: the maintenance channel has no path that stays unsettled or leaks its transport (disconnect() settles an in-flight connect(); deploy and mux.request are each timeout-bounded), and a maintenance dial on a host whose session is mid-reconnect shares the incumbent relay rather than displacing it.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

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

✅ No new issues found.

Reviewed changes

One commit landed while the previous review was posting (7910b1a → 44fff19), and it is test-only. No production code changed.

  • A queued Connect survives End Terminals. New owner test (ii) a user's Connect while the terminate waits behind the Disconnect ends connected races a user ssh:connect behind an in-flight ssh:disconnect and a queued ssh:terminateSessions, then asserts the Connect still resolves connected, the target's intent is connected, the transport and session are live, and the relay-ready effects fired. It would fail if the maintenance terminate cancelled or tore down a Connect that waited behind it.
  • A relay reconnect on a connected host restores forwards. New owner test (ii) after the user's Connect, a relay reconnect restores forwards and republishes drops and recovers a transport after the user reconnects, then asserts the relay redeploys, the session returns to ready, notifySshRelayReady fires, and exactly one port forward is restored — locking in the callbacks that the held-down setOnReady guard used to skip.
  • Tighter rejection timing. The drop-mid-operation test now attaches its .rejects handler before awaiting the transport teardown, so the assertion is registered earlier without changing what it checks.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

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

✅ No new issues found.

Reviewed changes

Since the prior pullfrog review (44fff19), the delta is one test-only commit that strengthens the owner test covering a user Connect parked behind End Terminals. No production code changed.

  • The parked Connect restores its forwards. The (ii) a user's Connect while the terminate waits behind the Disconnect ends connected test now clears mockPortForwardManager.addForward history before the held Disconnect is released and asserts it is called exactly once (src/main/ipc/ssh-user-disconnect-intent.test.ts:571,583). It is genuine coverage rather than a tautology: the assertion reddens if the user connect that waited behind the terminate stops restoring its persisted port forwards. I ran the file — 20 tests pass.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

…explorer and editor

Quitting with a user-disconnected host said the host "could not be reached";
the prompt now says the user disconnected it and its terminals keep running,
and still names any other host that really went quiet. The file explorer
showed a raw readDir error on that host; it now shows the same
"You disconnected <host>" card and Connect as the other panes. The editor
card drops its red error title and icon for that case.

All three read the shared host-connection signal's user-disconnected reason.
…nnects

The retry only counted this client's own SSH targets, so connecting a host a
remote runtime owns (including from the new Connect card) left the tree on its
read error. It now also follows the workspace's shared host-connection epoch.
…nnected

"Terminals there keep running" is false for a host with a timeout after
disconnect: its relay ends them once that runs out, whether or not Orca quits.
The prompt now states only what closing does.

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

✅ No new issues found.

Reviewed changes

Since the prior pullfrog review (2867f14), one renderer commit extends the user-disconnect treatment to three more surfaces. I read the incremental and full diffs, ran the six touched renderer test files (32 tests), pnpm tc:web, and the localization extraction/catalog verifiers — all green; no new problems.

  • File explorer shows the wait card. FileExplorerTreeStatus now takes a worktreeId, reads the shared host-connection signal, and renders "You disconnected <host>" with a Connect button when the failed tree read is on a user-disconnected host, in place of the raw readDir error. FileExplorer and FileExplorerFilesTreePane thread activeWorktreeId through.
  • Editor card reads as neutral. EditorFileLoadErrorView drops the red error title/icon for a user-disconnected host and splits editor.fileLoad.userDisconnectedHost into userDisconnectedTitle and userDisconnectedDescription.
  • Quit prompt names the disconnected host. WindowCloseRunningWork gains a user-disconnected kind and the unverifiable variant carries userDisconnectedHostLabels; classifyUnobservedHosts maps each unobserved remote pty back to its worktree and separates hosts the user disconnected from ones that genuinely went quiet. Prompt copy moves to terminal/window-close-dialog-copy.ts, and use-terminal-editor-close-foundation now stores the whole work object.
  • Coverage. New unit tests for the classification and the prompt copy, renderer tests for both new cards, and the connect-caller ratchet now permits FileExplorerTreeStatus.tsx.

I traced the classification edge cases (all-unobserved-user-disconnected → user-disconnected; any non-user-disconnected unobserved host → unverifiable with the named labels; local probes still excluded on quit) and the null/local worktree paths through useWorktreeHostConnection, and found nothing to correct.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

… connects

Clicking Connect on the "You disconnected" card moves the host to connecting,
which is no longer user-disconnected, so the card fell back to the dropped
connection's raw read error until the reload landed. A connecting host now shows
the loading state instead.
…le the host connects

Clicking Connect on the "You disconnected" card moves the host to connecting, which
is no longer user-disconnected, so the card fell back to the dropped connection's raw
read error until the reload landed. A failure the retry gate reloads on connect now
shows the existing connecting message instead.
…nd Chinese copy

"There" came across as a vague place (そこの, 那里的) rather than the hosts the
user disconnected, and the Spanish sentence repeated termina/terminales.

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

✅ No new issues found.

Reviewed changes

Since the prior pullfrog review (0dac851), four renderer commits improve how the file explorer and quit prompt handle a host the user disconnected. No owner (main-process) code changed.

  • Reload a failed file-explorer tree when its host connects. use-file-explorer-tree-load-effects now watches the worktree's connectedEpoch (threaded from use-file-explorer-tree-pane-state.ts) in addition to this client's own sshConnectedGeneration, so a failed tree on a target a remote runtime owns — whose connect moves sshStateByEnvironment, not the local generation — reloads once the host is up. The epoch term is scoped to the same worktree, so switching workspaces is not read as a connect.
  • Hide the raw read error while the host connects. FileExplorerTreeStatus renders the loading spinner when there is a read error and host.phase === 'connecting', since that error belongs to the connection being replaced; the tree reloads on its own once the connect lands.
  • Reword the quit prompt for a user-disconnected host. The copy changes from "Terminals there keep running." to "Closing the window does not end terminals there." in window-close-dialog-copy.ts and all six locale catalogs.
  • Coverage. New host-connect tests for the reload/no-op/worktree-switch cases and a status test asserting the raw error and the wait card stay hidden while connecting.

I ran the four touched test files (13 tests, all green), pnpm tc:web, and the localization extraction/catalog verifiers — all clean. The reload logic is guarded by rootError, updated in one place per run, and cannot loop (epoch is stable per connection); the connecting-spinner is bounded because startup restoration always settles (startup-degraded-recovery.ts).

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

…gate reloads

The retry gate reloads only the panel's active edit or preview file, but conflict
review rows share the load-error view, so a row read "retrying once the workspace
is ready" while connecting and then fell back to its raw error with no reload.

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

✅ No new issues found.

Reviewed changes

Since the prior pullfrog review (9295ba4), two commits land. One replaces the stale editor read error with the connecting state while a host connects; the other corrects the Spanish, Japanese and Chinese quit-prompt copy.

  • Replaced the stale editor error with the connecting state. EditorFileLoadErrorView now swaps a connection-caused load failure for the transient "Connecting to the remote host…" message whenever the workspace's host is in the connecting phase, so the card no longer shows a raw error the in-flight connect is about to replace. A failure the connection cannot fix (e.g. ENOENT) still renders as-is.
  • Shared the reload predicate. The condition the retry hook uses to reload a file once its host connects is extracted into isReloadedWhenHostConnects and reused by the view, so the two surfaces cannot drift.
  • Corrected quit-prompt copy. The userDisconnectedHosts and userDisconnectedAndUnreachableHosts strings now name the host's terminals explicitly in the Spanish, Japanese and Chinese catalogs.

I ran the two touched editor test files (7 tests), pnpm tc:web, and both localization verifiers — all green. The new EditorFileLoadErrorView test is genuine coverage: without the shownMessage branch it would see the raw SSH connection is not available text instead of the connecting message. No owner (main-process) code changed.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

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

✅ No new issues found.

Reviewed changes

Since the prior pullfrog review (30e8971), one commit narrows the editor connecting-state substitution to the files the retry gate actually reloads.

  • Scoped the connecting-state promise to the retry gate's file. EditorFileLoadErrorView gains reloadsWhenHostConnects (default false), and the stale-error substitution now requires it. EditorContent (markdown-preview) and EditorEditFileSurface (edit) pass it — the two modes useEditorPanelFileLoadRetry reloads for the active file — while EditorConflictReviewSurface does not, so a conflict row keeps its truthful raw read error instead of showing a "Connecting…" message that would never be followed by a reload.

I ran the three touched editor test files (10 tests) and pnpm tc:web — all green. The added test is genuine coverage: it renders without the prop and fails if the guard is dropped, since the raw SSH connection is not available text would otherwise be replaced. No owner (main-process) code changed.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

…ot a refused host

The escape hatch is offered on the "You disconnected" card, so the spec keeps the
user's Disconnect. The refused-host setup it picked up from main was there to stop a
terminal redial from recovering the route; a held Disconnect admits no redial, so the
host stays reachable and an unmoved connection generation now proves nothing redialed
behind the card before the escape hatch is clicked. The helper that refused
connections has no other caller and goes with it.

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

✅ No new issues found.

Reviewed changes

Since the prior pullfrog review (853925f), the delta is a merge of origin/main (upstream only, no PR-authored production change) plus one test-only commit that reworks the SSH browser-routing escape-hatch e2e.

  • The escape hatch now proves a held Disconnect, not an unreachable host. tests/e2e/local-ssh-browser-routing.spec.ts drops the merged-in refuseDockerSshRelayTargetConnections TCP refusal and keeps the user's ssh.disconnect, then asserts the pane shows the "You disconnected" card and that ssh:getState is unchanged (status, connectionGeneration, providerEpoch) before "Browse from this device instead" is clicked.
  • Dead helper removed. The refusal helper in tests/e2e/helpers/docker-ssh-relay-target.ts and the spec's readRendererSshStatus helper had no remaining callers and are deleted; the generic ssh-unavailable gate card keeps unit coverage, so no e2e-only path is lost.

I confirmed no lingering references to the removed symbols, that ssh:getState synthesizes a disconnected state while the intent holds (so the new poll resolves), and that ssh:disconnect awaits teardown before resolving (so the captured baseline is stable). pnpm run typecheck:e2e reports no errors in the two changed files.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@OrcaWin

OrcaWin commented Oct 11, 2026

Copy link
Copy Markdown
Collaborator

Thanks @brennanb2025. Since this was opened, the SSH relay was removed (#27214, #27215) and SSH hosts now reach Orca's managed remote server through a managed tunnel that resumes on its own. Runtime environments have an in-memory manual-disconnect flag (runtime-environment-manual-disconnect.ts) that doesn't survive a restart, so a sticky Disconnect still looks needed, but this would need rebasing onto the managed-server path.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Closing as superseded: a merged PR already covers this change. Merged #30130 (27cfee6, 10-17, another author) does the same thing: a Disconnect is recorded for the session and background dials refuse it until an explicit Connect (main src/main/ssh/ssh-user-disconnect.ts). #29918 (03be5bb) and #30245 (06618fd) also landed. 17 of this PR's files have since moved or been

(Stale-PR cleanup 2026-10-20, approved by Brennan. Reopen if something here is still missing on main.)

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.

2 participants