Skip to content

feat(ssh): opt-in SSH relay on the pinned Node with prebuilt addons - #24129

Merged
OrcaWin merged 5 commits into
mainfrom
OrcaWin/node-rt-p2-relay
Oct 1, 2026
Merged

OrcaWin merged 5 commits into
mainfrom
OrcaWin/node-rt-p2-relay

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1247 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1246
Prod 14 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1197 $\color{#cf222e}{\Huge{\mathbf{−}}}$​99 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1098

ELI5

The SSH relay can now run on Orca's pinned Node with node-pty prebuilt by Orca, so a host needs no Node, npm or compiler. It's opt-in per host (remoteRuntime: "pinned-node"); the current path stays the default.

What Changed

  • Setting: SshTarget.remoteRuntime is legacy (default) or pinned-node. ORCA_SSH_REMOTE_RUNTIME=pinned-node turns it on for development. There's no settings UI yet.
  • Target detection: resolveOrcadDeploymentTargetFacts returns the target plus the glibc major.minor.
  • Pinned path:
    • Uploads this target's prebuilt node-pty and @parcel/watcher from the verified orcad artifact, plus .runtime-ref-node-<sha>.
    • Sets up the runtime through ensureRemoteOrcadNodeRuntime and launches the relay with runtimes/node-<sha>/bin/node.
    • The relay version includes the runtime and addon digests, so pinned and host-Node builds never share a folder or socket.
  • Self-test: node --version, then relay --orca-runtime-selftest <nonce> (loads pty.node and opens a PTY).
    • A timeout or lost channel is unverifiable: retry, never step down.
    • A classified refusal (noexec, missing library, glibc too old, illegal instruction, wrong libc) falls back to the legacy path with the reason logged.
    • Windows hosts, glibc below 2.28 and an unidentified libc go straight to legacy.
  • Handshake: a new optional informational field, runtime: {kind, version}. That's safe under the remote wire-compatibility rules.

Why

This removes on-host npm and node-gyp, the root cause of #1693, #20386, #22159 and #23554. It sits behind a setting so the team can try it on real hosts before changing the default (design D8).

Linked Issue

Part of the Node runtime plan (Phase 2). Stacked on #24110.

Visual Proof

N/A. The setting is off by default and has no UI yet.

Testing

  • Unit tests cover target detection, the version hash, command construction, self-test classification and fallback.

  • A local-host integration test runs on darwin.

  • The reviewer fixed one bug: a lost SSH channel during the libc probe used to fall back to legacy. It now surfaces as unverifiable.

  • Not done: an SSH end-to-end run against a real Linux host (no Docker here, and ssh to localhost is refused), the full fallback ladder (rungs B and C), telemetry, and Windows hosts.

  • I manually tested these changes locally

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

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.

@greptile-apps

greptile-apps Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 2/5

[High risk] Adds SSH relay deployment on pinned Node runtime with new install paths.

The PR does not appear safe to merge until relay GC accounts for relocated live sockets, older-glibc vault fallbacks are addressed, and explicit legacy host settings remain effective.

Findings

  1. P1 Explicit legacy setting is lost ▶

Summary

The PR adds an opt-in SSH relay using a pinned Node and prebuilt addons. Changes since the prior review also add runtime-store GC, relay PID-based liveness checks, a glibc compatibility build, Node-based vault-reader fallbacks, and C31 rollout updates.

  • New blocking concerns are deletion of a live relay’s version directory when its socket is relocated, and loss of WSL vault reads on older-glibc distros.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[SSH relay install] --> B{Runtime selection}
  B -->|legacy| C[Host Node]
  B -->|pinned-node| D[Pinned Node and prebuilt addons]
  D --> E[Versioned relay directory]
  E --> F[Daemon socket and PID]
  F --> G[Version-directory liveness probe]
  G --> H[Version GC]
Loading

Reviews (5) · Last reviewed commit: "test(ssh): resolve the pinned runtime mo..."

Comment on lines +50 to +52
if (remoteRuntime === 'pinned-node') {
normalized.remoteRuntime = remoteRuntime
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Explicit legacy setting is lost
When ORCA_SSH_REMOTE_RUNTIME=pinned-node is set, normalization removes a host's explicit remoteRuntime: 'legacy' setting. Runtime selection then sees no host setting and uses pinned Node, despite that host being configured to stay on the legacy path.

Suggested change
if (remoteRuntime === 'pinned-node') {
normalized.remoteRuntime = remoteRuntime
}
if (remoteRuntime === 'pinned-node' || remoteRuntime === 'legacy') {
normalized.remoteRuntime = remoteRuntime
}

@greptile-apps

greptile-apps Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Comments Outside Diff

These findings could not be posted inline.

  • P2 Linux integration test always skips src/main/ssh/ssh-relay-pinned-node.integration.test.ts:1493 ▶

    hostTarget() returns null on Linux, which makes the test's ready check false even when Linux artifacts are available. The new local-host test therefore cannot cover the Linux install and launch path, including the glibc-related behavior.

  • P2 Unknown glibc version skips probe src/main/ssh/orcad-deployment-target.ts:211 ▶

    If ldd identifies glibc but prints no parseable version, this returns glibc: null without trying getconf. The pinned-node plan then skips its 2.28 check, so an older host needlessly stages and uploads the runtime before the execution test rejects 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 critical issues — one test-coverage suggestion inline.

Reviewed changes

This run reviewed the full stacked feature: the per-host opt-in that runs the SSH relay on Orca's pinned Node with prebuilt addons, plus the relay-side runtime self-test and handshake field it depends on.

  • Per-host runtime setting — SshTarget.remoteRuntime (legacy default, pinned-node opt-in) with the ORCA_SSH_REMOTE_RUNTIME dev override; only the opt-in value survives normalization so an unknown newer value can't change the runtime.
  • Target facts — resolveOrcadDeploymentTargetFacts now returns the host's glibc major.minor beside the server target, parsed by parseGlibcVersion from either probe.
  • Pinned plan — stages this target's prebuilt node-pty / @parcel/watcher from the verified orcad slot, folds the runtime sha and addon digest into the relay version (so pinned and host-Node builds never share a dir or socket), and points the launch at the shared runtimes/node-<sha> store.
  • Pinned install + self-test — ensurePinnedRelayRuntime (cheap .verified warm path, full verify cold) and verifyPinnedRelayInstall run node --version then relay.js --orca-runtime-selftest <nonce>, with passed / refused / unverifiable / failed verdicts: classified refusals fall back, timeouts and lost channels never do, and the promote command now preserves the loader's exit status/output for classification.
  • Fallback + handshake — PinnedRelayFallbackError retries on the host-Node path, staged addons are disposed in finally, and handshake-ok gains an optional informational runtime: {kind, version}.

I verified the fallback lifecycle and version/socket differentiation against the source: a refusal thrown inside the install lock is caught by the existing handler (abandonInstall + ownsInstallLock = false), so the legacy retry cannot land in the pinned dir or leave a finalized-but-broken one. The wire change is an optional field, so it stays compatible under the remote wire rules.

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

).toBe(false)
})

it('falls back to the host-Node relay on a classified refusal', async () => {

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.

This is the only fallback case, and it fires before any lock is taken (ensurePinnedRelayRuntime runs at ssh-relay-deploy.ts:530). The refusal that is thrown while the install lock is held — verifyPinnedRelayInstall at ssh-relay-deploy.ts:647 — and the lock-release/abandon ordering that follows are therefore reasoned but not asserted. Consider a second case here with isRelayAlreadyInstalled mocked false and verifyPinnedRelayInstall rejecting a PinnedRelayFallbackError.

Technical details
# In-lock fallback path is untested

## Affected sites
- `src/main/ssh/ssh-relay-deploy-pinned-node.test.ts:220` — mocks `ensurePinnedRelayRuntime` (pre-lock) and leaves `isRelayAlreadyInstalled` mocked `true`, so the locked branch never runs.
- `src/main/ssh/ssh-relay-deploy.ts:645-677` — `verifyPinnedRelayInstall` refusal is caught by the lock `catch` (`abandonInstall`, `ownsInstallLock = false`, rethrow), which the suite does not exercise.

## Required outcome
A case where the pinned dir is not yet installed and the pre-`finalize` self-test refuses, asserting the deploy retries on the host-Node relay and the partial pinned dir is abandoned rather than finalized.

@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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

🧰 Additional context used
📚 Code guidelines (1)
AGENTS.md — auto-discovered

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: bc8a4931-8093-4bb4-b984-a1ee3f36fda9

📥 Commits

Reviewing files that changed from the base of the PR and between 876e54114f4e9c593435e49b9a1ce42a5d899ccb and 3074229.

📒 Files selected for processing (4)
  • src/main/ssh/orcad-remote-node-runtime.test.ts
  • src/main/ssh/orcad-remote-node-runtime.ts
  • src/main/ssh/ssh-relay-deploy.ts
  • src/main/ssh/ssh-relay-pinned-node-install.test.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 change adds an opt-in pinned Node runtime for SSH relays. It selects supported hosts, stages required addons, installs and verifies the runtime, and falls back to host Node for classified refusals. Relay self-tests report runtime identity and check native binding loading and PTY execution. Successful handshakes can include the runtime kind and version. SSH target persistence retains pinned-node and omits unrecognized runtime values.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 30742

No actionable merge-blocking issue is established. The pinned runtime remains opt-in and legacy remains the default. Real Linux SSH end-to-end validation is still outstanding, but that alone does not demonstrate a failure.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 30742

The opt-in rollout preserves existing connection credentials and does not switch runtimes after uncertain verification. No privilege expansion was established, but cached executable integrity and the shared runtime’s lifecycle remain only partially verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The evidenced execution scope is the connected remote account and its relay state. Multiple relay versions resolving the same runtime digest share executable state, so mutation can affect more than one relay directory. Cross-account, tenant, or environment authority expansion was not established.

Security Findings and Attack Paths

  • inferred — Substitution on the warm path would require write access to the runtime or its directory while preserving the marker and executable bit. That authority was not shown to be available to a newly reachable attacker. Legacy deployment already trusts remote relay files, so the missing recheck is an integrity-assurance limitation rather than an established introduced exploit.

Trust Boundaries and Controls

  • observed — Runtime installation uses the existing SSH connection for commands and uploads. Handshake runtime metadata does not replace version matching or endpoint-credential refusal, which also exist in the available main revision.

Resilience and Maintainability Implications

  • observed — Unconfirmed transfers keep their remote stages, uncertain self-tests preserve their termination cause, and launch fences remain held until liveness is observable. These controls avoid treating lost contact as permission to clean up or launch an alternate runtime.

Hardening Proposals

  • proposed — Make the warm-path trust assumption explicit: either establish protected runtime ownership or reuse the existing digest-checking probe before launch. Treat handshake runtime identity as descriptive, not proof of unchanged executable bytes.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.99% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 71 functions across 24 files. 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 identifies the primary change: an opt-in SSH relay using pinned Node and prebuilt addons.
Description check ✅ Passed The description is detailed and covers the user impact, implementation, rationale, testing, limitations, and visual proof. Some template sections, such as Review, Notes, and the full checklist, are ab…
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

m4air added 4 commits October 1, 2026 01:11
…shake-ok

relay.js --orca-runtime-selftest <nonce> dlopens pty.node, opens and closes a
PTY, and prints one JSON line (nonce, node, napi, glibcVersionRuntime) for the
client to classify before it launches a daemon on a runtime (design D5).

handshake-ok gains an optional runtime {kind, version}; bridge and daemon
already match exactly on version, so it is informational only (D8.1).
… A, D8.1)

SshTarget.remoteRuntime (legacy | pinned-node, default legacy; env
ORCA_SSH_REMOTE_RUNTIME for development) selects the runtime. On POSIX hosts
the pinned path resolves the target with its glibc major.minor, ensures
~/.orca-remote/runtimes/node-<sha>/bin/node, uploads the relay bundle plus
the target's node-pty slot and @parcel/watcher from the orcad artifact
(no npm or node-gyp on the host), writes .runtime-ref-node-<sha>, and folds
the runtime and addon digests into the relay version so pinned and host-Node
builds never share a dir or socket.

A 30 s self-test (node --version, then the relay self-test) gates
.install-complete. Timeouts and lost channels are unverifiable and never step
down; noexec, missing_lib, libc_floor, illegal_instruction and wrong_libc
refusals fall back to the untouched host-Node path with a logged reason,
remembered for the session.
A lost channel during target detection says nothing about the host; descending
would launch a host-Node daemon beside a running pinned one and strand its sessions.
@OrcaWin
OrcaWin force-pushed the OrcaWin/node-rt-p2-relay branch from 876e541 to b111d20 Compare October 1, 2026 08:11
@OrcaWin
OrcaWin merged commit a560137 into main Oct 1, 2026
46 of 49 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