Skip to content

refactor(ssh): delete relay-only GC, takeover and install remnants - #27770

Merged
OrcaWin merged 1 commit into
mainfrom
OrcaWin/p399-2-2
Oct 12, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
OrcaWin/p399-2-2

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 34 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​265 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2956 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2691
Prod 43 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​133 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2760 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2627

ELI5

The old SSH "relay" was removed a few releases ago, but a lot of code that cleaned up after it, took over its sockets, or installed its pieces was left behind. Nothing in the app calls that code any more. This PR deletes it, so the code that is left is the code that actually runs.

What Changed

Users see no difference. Nothing deleted here had a production caller after #27214.

Deleted outright (relay-only, no production caller):

  • Relay version-directory cleanup: gcOldRelayVersions, the relay liveness probe (relay-version-dir-liveness), the "previous build" pin (remote-install-previous-version), and the relay native-dependency cache and its cleanup (ssh-relay-native-deps-*).
  • Relay socket takeover: ssh-relay-endpoint-takeover (the "reap an empty relay" kill), the superseded-endpoint sweep, the held/unresponsive endpoint errors, and the handshake-refusal helpers.
  • Relay install plumbing: ssh-relay-install-namespace, the short-socket-path relocation (relay-socket-path-limit keeps only the directory prefix the host census still lists), the Windows relay launch script (only the connect command the census uses is kept), and relay-only command builders in ssh-remote-commands (relay probe, relay listing, relay liveness, directory-exists, mkdir/chmod).
  • Dead exports: isRelayAlreadyInstalled, computeRemoteRelayDir, relayHookEndpointDirForHost, windowsActivePipeMarkerPath, isWindowsRelayPipePath, strictestHostKeyChecking, loadKnownHostsEntries (tests use the evidence reader it wrapped), writeStringsViaSftp, the host-Node "addon-only" probe and its parsers, three unused SFTP filesystem helpers plus ssh-sftp-directory-close, resolveWindowsAgentForegroundProcess, classifyLoginPreflightError, the unused relay grace-period constants and relay.configureGraceTime method name, RELAY_PID_FILENAME, and the relay Windows breakaway contract.
  • offerMove on a relay server status: older hosts may still send it; the admission code now drops it (nothing ever read it). Wire-safe: an optional field the receiver ignored.

Kept, and renamed in place because this PR edits them: ssh-relay-versioned-install → remote-versioned-install (orcad's install probe/finalize), ssh-relay-gc-tombstone → remote-install-gc-tombstone. The re-export of the GC from the versioned-install module is gone; orcad-remote-gc imports the GC from its own file.

The read-only relay census that converts relay-era hosts (≤1.4.223) is untouched apart from one move: the four-line classification it borrowed from the deleted sweep now lives in ssh-host-relay-endpoint-census.ts (readRelayEndpointProbe, same verdicts, its tests moved with it).

One small fix on a path that was already failing: the orcad GC's leftover-tombstone cleanup only matched relay-* names, so orcad's own interrupted-GC leftovers (orcad-<v>.gc-tombstone.<pid>.<ts>) were never removed. The cleanup now matches the model's own prefix (remoteInstallGcTombstoneRegex). It still never touches the other model's directories.

Net: production −2,393 lines (+123 / −2,516), tests −2,924 (+265 / −3,189), config −1.

Why

Every one of these modules was only reachable from relay code that #27214/#27215 removed. Keeping them meant new SSH work had to step around a GC, takeover and installer that never run, and their tests kept pinning behaviour no user can reach. The shared GC pass, install lock, GC claim and tombstone code that orcad does run are kept, and the tests that exercised them through the relay entry point now drive the same pass with the orcad model, so that coverage is not lost.

Relay version directories on hosts were already never reclaimed after #27214 (nothing called the relay GC). That is accepted until the ≤1.4.223 upgrade window closes and is recorded in the relay-retire notes; this PR adds no sweep.

Linked Issue

N/A — internal Phase 3.99 cleanup (PR 2.2).

Visual Proof

N/A — no UI or behaviour change.

Testing

Dead-code proof: every removed symbol has zero references across src, config, tests, mobile (including the @ts-nocheck files) apart from comments, and build:electron-vite, build:cli and build:orcad all succeed. pnpm tc, oxlint, pnpm run check:code-quality:changed (0 new findings) pass.

Focused tests (all pass): remote-versioned-install, remote-install-gc-termination, orcad-remote-gc, orcad-remote-windows-decommission, orcad-managed-version-gc, remote-node-runtime-store-gc, ssh-host-relay-endpoint-census, ssh-host-relay-windows-census, orcad-migration-terminal-gate-host-wide, ssh-relay-endpoint-incumbent (+shell integration), ssh-remote-commands, ssh-known-hosts-source, ssh-host-key-decision, sftp-stream-late-error, ssh-remote-node-toolchain-probe, ssh-retained-payload-admission, ssh-managed-server-state-effects, windows-breakaway-launcher, remote-install-model, and the orcad deploy/lifecycle tests that mock the renamed module. ssh-relay-incumbent-process only lost one assertion; its two wall-clock cases went over their 10s bound locally at load average ~80 and are left to CI.

Reliability gates: the renamed test file is updated, the deleted relay install-namespace test is removed from the staged-upload gate, and the watcher gate's completeness assertion now names the model artifacts.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Review

P0/P1 review: own review plus an independent reviewer.

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

SSH: the execution boundary is unchanged — the census still reads unverifiable for anything it cannot prove, and nothing new stops or deletes anything on a host. Windows/WSL: the WSL relay bundle and the census's Windows connect command are kept. Wire: only the receive side drops an optional field no one read.

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)

@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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: 2d7db911-4701-4b53-920b-e929158cc202

📥 Commits

Reviewing files that changed from the base of the PR and between 822bd9f and 9dcbc02.


📒 Files selected for processing (77)
  • config/reliability-gates.jsonc
  • src/main/providers/macos-login-session-pty-probe.ts
  • src/main/providers/sftp-directory-test-fixture.ts
  • src/main/providers/ssh-filesystem-provider-sftp.ts
  • src/main/providers/ssh-sftp-directory-close.ts
  • src/main/providers/windows-agent-foreground-process.ts
  • src/main/ssh/orcad-activation-crash-recovery.test.ts
  • src/main/ssh/orcad-managed-auto-update.test.ts
  • src/main/ssh/orcad-managed-auto-update.ts
  • src/main/ssh/orcad-managed-runtime-context.ts
  • src/main/ssh/orcad-recovery-slot.ts
  • src/main/ssh/orcad-remote-deploy.test.ts
  • src/main/ssh/orcad-remote-deploy.ts
  • src/main/ssh/orcad-remote-gc.test.ts
  • src/main/ssh/orcad-remote-gc.ts
  • src/main/ssh/orcad-remote-install.ts
  • src/main/ssh/orcad-remote-lifecycle-windows.test.ts
  • src/main/ssh/orcad-remote-windows-decommission.test.ts
  • src/main/ssh/orcad-state-mutation-timeout.test.ts
  • src/main/ssh/relay-socket-path-limit-shell.integration.test.ts
  • src/main/ssh/relay-socket-path-limit.test.ts
  • src/main/ssh/relay-socket-path-limit.ts
  • src/main/ssh/relay-version-dir-liveness.test.ts
  • src/main/ssh/relay-version-dir-liveness.ts
  • src/main/ssh/remote-install-gc-termination.test.ts
  • src/main/ssh/remote-install-gc-tombstone.ts
  • src/main/ssh/remote-install-gc.ts
  • src/main/ssh/remote-install-model.ts
  • src/main/ssh/remote-install-previous-version.test.ts
  • src/main/ssh/remote-install-previous-version.ts
  • src/main/ssh/remote-versioned-install.test.ts
  • src/main/ssh/remote-versioned-install.ts
  • src/main/ssh/sftp-stream-late-error.test.ts
  • src/main/ssh/sftp-upload.ts
  • src/main/ssh/ssh-host-key-decision.test.ts
  • src/main/ssh/ssh-host-key-decision.ts
  • src/main/ssh/ssh-host-relay-endpoint-census.test.ts
  • src/main/ssh/ssh-host-relay-endpoint-census.ts
  • src/main/ssh/ssh-known-hosts-source.test.ts
  • src/main/ssh/ssh-known-hosts-source.ts
  • src/main/ssh/ssh-relay-credential-mismatch-error.ts
  • src/main/ssh/ssh-relay-endpoint-incumbent-shell.integration.test.ts
  • src/main/ssh/ssh-relay-endpoint-incumbent.test.ts
  • src/main/ssh/ssh-relay-endpoint-incumbent.ts
  • src/main/ssh/ssh-relay-endpoint-takeover.test.ts
  • src/main/ssh/ssh-relay-endpoint-takeover.ts
  • src/main/ssh/ssh-relay-endpoints.ts
  • src/main/ssh/ssh-relay-incumbent-process.test.ts
  • src/main/ssh/ssh-relay-install-marker.ts
  • src/main/ssh/ssh-relay-install-namespace.test.ts
  • src/main/ssh/ssh-relay-install-namespace.ts
  • src/main/ssh/ssh-relay-native-deps-cache-commands.ts
  • src/main/ssh/ssh-relay-native-deps-cache-gc-real.test.ts
  • src/main/ssh/ssh-relay-native-deps-cache-gc.ts
  • src/main/ssh/ssh-relay-native-deps-cache-shell.test.ts
  • src/main/ssh/ssh-relay-native-deps-cache.test.ts
  • src/main/ssh/ssh-relay-native-deps-cache.ts
  • src/main/ssh/ssh-relay-native-deps-install-fixture.ts
  • src/main/ssh/ssh-relay-superseded-endpoints.test.ts
  • src/main/ssh/ssh-relay-superseded-endpoints.ts
  • src/main/ssh/ssh-relay-version-mismatch-error.ts
  • src/main/ssh/ssh-relay-versioned-install-termination.test.ts
  • src/main/ssh/ssh-relay-windows-launch-command.test.ts
  • src/main/ssh/ssh-relay-windows-launch-command.ts
  • src/main/ssh/ssh-remote-commands.test.ts
  • src/main/ssh/ssh-remote-commands.ts
  • src/main/ssh/ssh-remote-node-toolchain-probe.test.ts
  • src/main/ssh/ssh-remote-node-toolchain-probe.ts
  • src/packages/process-host/src/posix-lsof-probe.test.ts
  • src/renderer/src/hooks/ipc-events/ssh-managed-server-state-effects.test.ts
  • src/shared/relay-artifacts.ts
  • src/shared/ssh-retained-payload-admission.test.ts
  • src/shared/ssh-retained-payload-admission.ts
  • src/shared/ssh-types.ts
  • src/shared/unix-socket-path-limit.ts
  • src/shared/windows-breakaway-launch.ts
  • src/shared/windows-breakaway-launcher.test.ts

💤 Files with no reviewable changes (33)
  • src/main/ssh/ssh-relay-native-deps-cache-gc-real.test.ts
  • src/main/ssh/ssh-relay-windows-launch-command.test.ts
  • src/shared/ssh-retained-payload-admission.ts
  • src/main/ssh/ssh-relay-superseded-endpoints.test.ts
  • src/main/ssh/relay-socket-path-limit-shell.integration.test.ts
  • src/shared/windows-breakaway-launch.ts
  • src/main/ssh/relay-version-dir-liveness.test.ts
  • src/main/ssh/remote-install-previous-version.test.ts
  • src/main/providers/sftp-directory-test-fixture.ts
  • src/shared/relay-artifacts.ts
  • src/main/providers/ssh-sftp-directory-close.ts
  • src/main/ssh/ssh-host-key-decision.ts
  • src/main/ssh/ssh-relay-native-deps-cache-shell.test.ts
  • src/main/ssh/ssh-relay-native-deps-cache.test.ts
  • src/main/ssh/ssh-relay-install-namespace.test.ts
  • src/main/ssh/ssh-known-hosts-source.ts
  • src/main/ssh/ssh-relay-credential-mismatch-error.ts
  • src/main/ssh/ssh-relay-incumbent-process.test.ts
  • src/main/ssh/ssh-relay-version-mismatch-error.ts
  • src/main/providers/windows-agent-foreground-process.ts
  • src/main/ssh/ssh-relay-install-namespace.ts
  • src/main/ssh/ssh-relay-endpoint-takeover.test.ts
  • src/main/ssh/remote-install-previous-version.ts
  • src/main/ssh/ssh-relay-install-marker.ts
  • src/main/ssh/relay-version-dir-liveness.ts
  • src/main/ssh/relay-socket-path-limit.test.ts
  • src/shared/ssh-types.ts
  • src/main/ssh/ssh-relay-superseded-endpoints.ts
  • src/main/ssh/ssh-relay-native-deps-install-fixture.ts
  • src/main/ssh/ssh-relay-endpoint-takeover.ts
  • src/main/ssh/ssh-relay-native-deps-cache-gc.ts
  • src/main/ssh/ssh-relay-native-deps-cache-commands.ts
  • src/main/ssh/ssh-relay-native-deps-cache.ts

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



📝 Walkthrough

Walkthrough

The changes generalize remote-install completeness checks and garbage collection to use install models, and update OrCAD callers and tests. They remove relay-specific endpoint takeover, socket-path, liveness, install-namespace, Windows-launch, and native dependency-cache code. The changes also remove several provider and SSH helper APIs, update shared SSH status fields, and revise related tests and reliability-gate references.


Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 9dcbc

This change removes unused SSH relay cleanup, takeover and install code, and narrows garbage collection to orcad installs. No concrete user-facing regression was found. The owners should confirm before merge that restoring the legacy relay terminal bridge does not need any of the deleted helpers.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 43.18% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 44 functions across 43 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely summarizes the primary change: removing relay-only SSH garbage collection, takeover, and installation remnants.
Description check Passed The description is detailed and covers the required explanation, scope, rationale, testing, visual proof, review notes, compatibility considerations, and checklist. The Linked Issue section uses “N/A”…
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: Docstring Coverage

Explanation

Docstring coverage is 43.18% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 44 functions across 43 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.

@OrcaWin
OrcaWin marked this pull request as draft October 12, 2026 04:45
@OrcaWin

OrcaWin commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator Author

Held: the legacy relay terminal bridge is being restored so users upgrading from 1.4.224 keep their running terminals. This PR deletes relay leftovers that the bridge may need. It will be re-checked against the bridge before it merges.

@OrcaWin
OrcaWin marked this pull request as ready for review October 12, 2026 09:58
@OrcaWin
OrcaWin merged commit b368ebc into main Oct 12, 2026
91 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