Skip to content

Reconnect managed servers through the current SSH connection - #26645

Merged
OrcaWin merged 1 commit into
mainfrom
nwparker/managed-start-reconnect-fence
Oct 9, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
nwparker/managed-start-reconnect-fence

Conversation

@nwparker

@nwparker nwparker commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​72 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​70
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​20 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​17

ELI5

Reconnecting while the server is starting can keep waiting for a check on the connection you just closed. After three minutes, the canceled check becomes the answer for the new connection. Now cancellation ends that check and the new connection runs its own.

What Changed

The readiness wait stops retrying a locally canceled SSH operation and rejects a readiness reply received after cancellation. Ordinary failed reads still retry.

After waiting for server identity or serving checks, tunnel setup verifies that it still owns the SSH connection. A retired setup removes its own forward and returns the existing superseded result. The existing once-only retry then lets a joining reconnect build its current tunnel, without removing a replacement's forward.

CI routes readiness-source changes into the idle-exit end-to-end lane.

Why

The reconnect already knows the previous connection was retired. Retrying its readiness read cannot recover that connection. Reusing the existing ownership checks, exact-forward cleanup and once-only joined retry keeps recovery in one place. A live process stays alive; startup may truthfully remain unverifiable until it answers.

Visual Proof

N/A — backend connection-result and startup-wait correction, with no renderer changes. Actual hidden Electron / owned Linux SSH before-and-after evidence:

  • Before runtime: unchanged parent takes 3.1 minutes, returns providerEpoch: null and SSH operation was cancelled; original PID 564 remains live and terminal.list succeeds independently.
  • After runtime: identical cold-start case passes in 8.2 seconds with current connection authority, the same PID and actual RPC success. It truthfully reports pending startup before that RPC becomes ready. All four cases pass together in 1.8 minutes: idle stop/restart 56.9 s, paused-live recovery 28.7 s, cold-start overlap 8.2 s, killed-server/reboot recovery 13.5 s.
  • Before unit tests: nine regressions fail, 72 controls pass.

Testing

  • Actual macOS client / disposable Linux SSH hosts, hidden with ORCA_BACKGROUND_LAUNCH=1.
  • Readiness cancellation, late identity/serving replies, once-only joined recovery, both deployment/access link types and real cold-start overlap covered.

264 tests / 24 files pass, including activation, rollback, recovery, host fences and connection decisions. Full pnpm tc, pnpm lint, changed-code quality, fresh E2E build and all four runtime cases pass.

After an E2E build, set ORCA_BACKGROUND_LAUNCH=1, SKIP_BUILD=1, ORCA_E2E_SSH_DOCKER=1, ORCA_E2E_ORCAD_CONVERT_HOST=docker and ORCA_E2E_ORCAD_CONVERT_TEMPLATE to an appropriate Linux server template. Run pnpm test:e2e --project=electron-headless tests/e2e/ssh-orcad-idle-exit.spec.ts --workers=1.

Review

Now based directly on main and independent of #26637. The Docker cold-start spec and idle-stop control changes depended on #26637's helpers and serving semantics, so they were dropped here; the unit regressions (nine fail without the fix) cover the change. Product changes are limited to the existing readiness wait and tunnel checks. Activation and rollback strip the cancel signal before launching, so the post-read cancel check cannot reject a ready update candidate.

Agent skill upstream boundary

  • Not applicable; no upstream skill source copied or translated.

Notes

No server build or remote wire change. Cancellation says nothing about host process death; the host keeps its existing live / unverifiable / exited rules. Existing authentication failures do not gain another retry. Actual runtime coverage is macOS / Linux SSH; Windows runtime was not exercised. PID capture, SIGSTOP/SIGCONT and cleanup are confined to disposable Docker hosts.

Checklist

  • Focused PR
  • ELI5, before/after, mechanism and approach explained
  • Nonvisual backend proof explained; actual runtime logs attached
  • Self-reviewed for correctness, security and performance
  • Cross-platform, SSH, mixed-version and folder/worktree impact considered
  • Local typecheck, lint, tests, build and runtime cases pass

@OrcaWin
OrcaWin force-pushed the nwparker/managed-start-reconnect-fence branch from ad088c9 to ebf6a29 Compare October 9, 2026 02:33
@OrcaWin
OrcaWin changed the base branch from nwparker/managed-serving-live-process to main October 9, 2026 02:33
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

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 30 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: a3437596-cd65-4918-8a0d-a523fa95292a
📥 Commits

Reviewing files that changed from the base of the PR and between 820277c and ebf6a29.

📒 Files selected for processing (8)
  • config/scripts/orcad-e2e-routing.test.mjs
  • config/scripts/pr-e2e-source-routing.mjs
  • src/main/ssh/orcad-managed-tunnel-manager.ts
  • src/main/ssh/orcad-managed-tunnel-target.test.ts
  • src/main/ssh/orcad-managed-tunnel-target.ts
  • src/main/ssh/orcad-managed-tunnel.test.ts
  • src/main/ssh/orcad-remote-runtime-control.test.ts
  • src/main/ssh/orcad-remote-runtime-control.ts
  • Autopilot · 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.

@OrcaWin
OrcaWin merged commit 5264a7d into main Oct 9, 2026
77 of 107 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.

2 participants