Skip to content

feat(orcad): run orcad on the pinned Node instead of Bun - #24110

Merged
OrcaWin merged 32 commits into
mainfrom
OrcaWin/node-rt-cutover
Oct 1, 2026
Merged

OrcaWin merged 32 commits into
mainfrom
OrcaWin/node-rt-cutover

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 60 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2121 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3602 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1481
Prod 81 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2491 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2681 $\color{#cf222e}{\Huge{\mathbf{−}}}$​190

ELI5

orcad (Orca's headless server) now runs on the pinned Node 24.21.0 with node-pty, the same terminal stack as the desktop app, instead of Bun. Bun's terminal code is removed.

Status: Headless Node server workflow green on all 11 jobs, including the Bun ↔ Node cross-runtime lane on both Linux runners.

What Changed

  • Slots:
    • Ship the upstream node/node.exe under its real name, at runtimes/node-<sha>/bin/node, with no rename.
    • Contents: node-pty's JS plus that slot's prebuild, the watcher, windows-process-tree on win32, and only the target's own ripgrep.
    • .runtime-node and .server-target feed the version hash. The template is schema 3, with a per-target files map.
  • Build: build-orcad-node.mjs replaces build-orcad-bun.mjs. The watcher and worker smoke tests run under the pinned Node.
  • Handoff: handoffToBundledOrcad() launches the pinned Node from .runtime-node and checks process.versions.node. The preflights key on bundled-runtime identity instead of process.versions.bun.
  • PTY: bun-pty-process*, windows-bun-pty-* and every canUseBunPty branch are removed. What remains is the node-pty path the desktop already runs. Desktop behaviour is unchanged.
  • SSH:
    • pinned-runtime-materializer.ts replaces the Bun materializer. The Bun wrapper stays only for the OpenCode vault reader, which moves in Phase 2.
    • orcad-remote-node-runtime.ts uploads the official archive only when the host lacks it, then checks it by hash on the host.
  • CI: bun-profile-tests.yml becomes node-server-tests.yml, with the same runners. Its "Node 18 hands off" check now hands off to the pinned Node.
  • Packaging: electron-builder leaves the runtime out of desktop packages.
  • Protocol: PROTOCOL_VERSION stays 38, and the R3 ratchet passes.

Why

The desktop and server then share one terminal stack (patched node-pty with bundled ConPTY), and Windows doesn't need a Bun fork. Design: node-runtime-plan, Phase 1.

Linked Issue

Part of the Node runtime plan (Phase 1). It targets main and also carries the node-pty prebuilds work from #24109 (closed as superseded: same changes, landed here to avoid another CI cycle). #24087–#24089 and #24108 are already merged.

Visual Proof

N/A. This changes the headless server runtime, with no UI.

Testing

  • src/main/{ssh,orcad,daemon,windows,providers} and src/shared under Node 26.6.0: 16,430 tests pass, 197 skipped.

  • Under the pinned Node 24.21.0, the packaged node-pty preflight, the orcad Node launcher, and the Bun ↔ Node profile-state round trip (with local Bun 1.4.2) all pass.

  • Upgrade and rollback with a live terminal (orcad-cross-runtime-daemon-adoption.integration.test.ts): runs two real orcad builds, Bun at f4092c06 and this Node build, started and stopped with the client's own deploy commands.

    • Bun → Node and Node → Bun: the incoming orcad keeps the running daemon (same PID, protocol 38), and the same shell reattaches with new output.
    • GC keeps the outgoing folder while its daemon is live. Removing that rule makes the test fail.
    • The incoming build backs up the profile database under its own runtime.
    • It passed locally on macOS arm64. In CI it runs on the two Linux glibc lanes (--cross-runtime, Bun 1.4.2 by SHA), and missing inputs now fail the run instead of skipping.
  • Not covered: Windows, because orcad's launch path is POSIX-only. A paired client reading the adopted session over RPC. The musl and Ubuntu 20.04 lanes for the swap test.

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

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.

m4air added 25 commits September 30, 2026 01:42
Lands daemon-protocol-facts.mjs from the Windows update diagnostic branch with a
stricter parser, and adds check-daemon-protocol-crossing.mjs (rule R1): the working
tree must attach the newest release tag's daemon. Rollback crossing is reported only.
Runs in the cross-version-wire job, which already has full tags; tag selection moves
to config/scripts/stable-release-tags.mjs so both use one rule.
The profile preflight parser now takes the expected runtime identity from the
caller (shipped callers pass the pinned Bun identity), and the native
preflight is renamed to orcad-runtime-native-preflight with neutral wording.
… check

Add src/shared/node-runtime-pin.ts (NODE_RUNTIME_PIN, SERVER_TARGETS,
NODE_RUNTIME_ASSETS for all 8 server targets plus the headers tarball),
generated by config/scripts/update-node-runtime-pin.mjs from the nodejs.org
and unofficial-builds SHASUMS. check-node-runtime-pin.mjs verifies, with no
network, that the pin tracks the locked Electron, matches engines.node's
major, and covers exactly SERVER_TARGETS; it runs in the static analysis job.

ORCAD_BUN_TARGETS consumers now read SERVER_TARGETS so there is one target
list; orcad's Bun runtime and build output are unchanged.
# Conflicts:
#	src/shared/orcad-bun-runtime.ts
… protocol

D7.1 R3: hosting orcad or the daemon on another runtime is not a protocol change,
so one PR must not do both. The launcher file list lives in the check script; the
allow-runtime-launcher-protocol-bump label overrides it.
D7.1 R5: a Node slot names its shared runtimes/node-<sha256>/node through
.runtime-node instead of .build-target, so Bun-era clients read it as a legacy
slot rather than exiting 78 on a missing bun-runtime. Nothing builds the marker yet.
check-node-runtime-pin.mjs now requires the pin and takes nodeDistArchiveName from
its own module, so it no longer loads the update script's build graph.
…s at N-API 8

- build-orcad-prebuilds.mjs adds win32-x64/arm64 (conpty.node, the vendored
  conpty.dll/OpenConsole.exe, upstream's N-API conpty_console_list.node), compiles
  in a scratch copy against the hash-verified pinned headers (node.lib pinned per
  Windows arch) with NAPI_VERSION=8, rejects post-8 node_api_* imports, and writes
  a schema 2 manifest with per-file sha256, N-API level and the glibc need.
- --require-slots [slots] verifies files against hashes; --smoke loads the slot
  under the pinned Node and spawns a PTY; --print-slot names the host slot.
- The slot installer gates on N-API, libc, arch, glibc and file hashes instead of
  the exact NODE_MODULE_VERSION, and installs nested files (conpty/).
- bun-profile-tests.yml builds, verifies and smokes each runner's slot.
…uild slots

musl's unversioned libc cannot satisfy openpty@GLIBC_* references at link
time, so the Alpine slot compile would fail. Pin the staged pty.cc guard to
__GLIBC__ and assert both musl transforms against the installed patch.
# Conflicts:
#	config/scripts/check-node-runtime-pin.mjs
#	config/scripts/update-node-runtime-pin.mjs
A packaged orcad slot now references the pinned Node 24.21.0 by its
executableSha256 (`.runtime-node`, `.server-target`) instead of carrying
bun-runtime, and ships node-pty from the slot's prebuild, only its own
ripgrep, and no Windows Bun PTY gate. The runtime lives beside the slots
at runtimes/node-<sha>/bin/node (node.exe on Windows, upstream name).

- build:orcad (build-orcad-node.mjs) builds the host slot's prebuild when
  missing and places the pinned runtime; the template is schema 3 with
  per-target files.
- handoffToBundledOrcad() resolves the slot's runtime reference and checks
  process.versions.node against the pin; a host Node >= 18 still hands off.
  Startup preflight keys on running as that runtime; callers expect 'node'.
- orcad and its daemon use node-pty (ConPTY + windows-pty-job on Windows);
  the Bun PTY sources, gate entry and canUseBunPty branches are removed.
- SSH deploy uploads the official archive once per pin, extracts and
  hash-checks it on the host, and self-tests it before publishing. Bun
  slots stay launchable for rollback; Node slots never use host Node.
- The runtime materializer is generic over pinned assets; the Bun wrapper
  remains only for the OpenCode vault reader (design Phase 2).
- Cross-runtime test: a profile DB written by Bun 1.4.2 (WAL left by
  SIGKILL) opens and backs up under the pinned Node, and the reverse.

No daemon PROTOCOL_VERSION change (design D7.1 R3).
…rd timings

Design D10: ci-demand-rollout.md and ci-runner-efficiency.md follow the
bun-profile-tests.yml -> node-server-tests.yml rename; shard timings drop the
deleted Bun PTY tests and follow the renamed ones.
The official Node headers' config.gypi sets clang: 0, so common.gypi skips its
gnu++20 xcode_settings and Apple clang 15 (macos-14 runners) compiles
node-addon-api as C++98.
…doff does

A symlinked orcad.js handed off to its real slot's pinned Node, but the
startup and profile preflights read the symlink's directory, found no
runtime marker there, and silently skipped the readiness check.
Deploys upload the verified official archive (design D5); no client path
needs an extracted Node executable cached by digest.
…th live terminals

Design D7.1 R1/R3/R4 and D7.2. The last Bun orcad and this checkout's Node
slot are installed side by side under ~/.orca-remote, launched and stopped
with the client's own deploy commands, and share one data root. Each
direction proves the incoming orcad adopts the outgoing runtime's daemon
(same PID, same shell, output continues), opens its profile database and
backs it up with its own shipped worker, and that GC keeps the slot the
live daemon was forked from.

The node-server Linux lanes provide Bun 1.4.2 and build that Bun orcad
from main, and run with --cross-runtime. --artifact and --cross-runtime
now make their tests fail on a missing input instead of skipping.
@OrcaWin
OrcaWin marked this pull request as ready for review September 30, 2026 11:00
@greptile-apps

greptile-apps Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[High risk] Switches orcad runtime from Bun to pinned Node.

The PR does not yet appear safe to merge because remote Node promotion can time out on a slow host.

Findings

  1. P1 Remote promotion can time out ▶
  2. P2 Failed uploads leave archives ▶
  3. P2 Linux promotion remains untested ▶
  4. P2 Idle menus miss command changes ▶

Summary

This PR replaces Bun with the pinned Node runtime for headless orcad, including node-pty packaging, SSH runtime installation, and server CI qualification. Changes since the previous review also add relay cell C31, revise Claude Stop and prompt-card handling, and make the worktree host badge configurable.

  • No new actionable finding was established from the changes since the previous review.
  • Earlier unresolved findings still affect remote Node installation and Claude command-menu freshness.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Build[Build target-specific orcad slot] --> Package[Package pinned Node identity and node-pty]
  Package --> Upload[Deploy slot over SSH]
  Upload --> Probe{Pinned Node present and verified?}
  Probe -- No --> Promote[Upload and promote Node archive]
  Probe -- Yes --> Launch[Launch orcad with pinned Node]
  Promote --> Launch
Loading

Reviews (6) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..."

Comment on lines +111 to +113
function exec(conn: SshConnection, command: string, signal?: AbortSignal): Promise<string> {
return execCommand(conn, command, { signal })
}

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 Remote promotion can time out If a slower host takes more than 30 seconds to extract, hash, and test the pinned Node, this call reaches the default SSH command timeout. Installation then aborts after uploading the archive but before the runtime is available. The promotion test allows 60 seconds, so it does not cover that production limit.

Comment on lines +154 to +157
} finally {
await rm(localStage, { recursive: true, force: true }).catch(() => {})
await exec(conn, `rm -rf ${shellEscape(stageDir)}`).catch(() => {})
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Failed uploads leave archives If an upload or promotion loses its SSH connection, removing the remote staging directory can fail, but this code discards the error. Each stage contains a Node archive, and nothing here removes abandoned stages, so repeated interrupted installs can consume remote disk space.

Comment on lines +33 to +37
function hostTarget(): ServerTarget | null {
if (process.platform === 'darwin') {
return process.arch === 'arm64' ? 'darwin-arm64' : 'darwin-x64'
}
return null

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Linux promotion remains untested This helper returns no target on Linux, while the extraction and publication test also requires a cached archive. As a result, the Linux lanes do not exercise the new remote promotion command, leaving a key installation path without test coverage.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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

ℹ️ Minor suggestions only — one small cleanup.

Reviewed changes

  • Runtime slots: orcad packages now carry .server-target (target id) and .runtime-node (the pinned Node's executableSha256) plus the target's node-pty slot and its own ripgrep, instead of a bundled Bun executable. .build-target/bun-runtime are retained only so Bun-era slots stay launchable (D7.1 R5) and are absent from orcadArtifactFilenames; the version hash now covers every slot file, so the runtime enters it as the digest string.
  • node-pty prebuilds: the matrix grows to 8 slots (adds win32-x64/win32-arm64), compiled in a scratch copy against hash-verified pinned-Node headers at N-API 8. A schema-2 manifest records per-slot platform/arch/libc/glibc/napi and per-file sha256; mergeManifest refuses mixed napi/version and findSlotProblems verifies before use. musl strips the glibc-only ldflag/.symver pins, and a smoke loads and spawns the staged node-pty under the pinned Node.
  • Handoff and launch: handoffToBundledOrcad and the remote selector resolve .runtime-node to ../runtimes/node-<sha>/bin/node and check process.versions.node; slot resolution is symlink-aware. selectOrcadSlotRuntimeCommand prefers the Node marker, then Bun, then legacy host Node, and the remote preflight now refuses a slot without the marker rather than falling back to host Node.
  • SSH materialization: orcad-bun-runtime-materializer is replaced by pinned-runtime-materializer (with the Bun path retained for the OpenCode vault reader); the official Node archive is cached, hash-verified, uploaded as published, extracted and self-tested on the host, then promoted under runtimes/.
  • Bun PTY removal: canUseBunPty/spawnBunPty, the Windows Bun-PTY gate/launch/job/native code and every canUseBunPty branch are gone; native-pty-spawn, spawn-preflight, the local PTY provider, ConPTY warmup and Windows job ownership all use node-pty directly.
  • CI and gates: bun-profile-tests.yml becomes node-server-tests.yml (adds Linux Bun↔Node cross-runtime lanes, pins the Alpine image by digest), and a new R3 ratchet fails a PR that both touches a runtime-launcher path and bumps the daemon protocol. PROTOCOL_VERSION stays 38.

Verification in this run: pnpm tc:node passes; the new/changed unit suites pass (88 tests across orcad-artifact-version, orcad-prebuild-slot-contents, check-runtime-launcher-protocol-ratchet, update-node-runtime-pin, orcad-artifact-materializer, orcad-remote-runtime, orcad-remote-node-runtime, orcad-artifacts, node-pty-prebuilt-slot, verify-packaged-orcad-template, remote-install-model). Two focused sub-reviews confirmed that ORCAD_NODE_PTY_JS_ARTIFACTS covers node-pty's runtime require graph and that remoteNodeRuntimeDir and orcadNodeSlotRuntimeCommand compute identical host paths.

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

Comment on lines +46 to 49
type MaterializeOptions = PinnedRuntimeMaterializeOptions & {
templateDir?: string
cacheRoot?: string
}

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.

fetcher is inherited from PinnedRuntimeMaterializeOptions but no longer consumed here: materializeOrcadArtifact only assembles the slot, and the pinned Node archive is fetched separately by the caller's nodeRuntimeArchive closure. Passing a fetcher to this function now silently does nothing, so narrowing the option type avoids a misleading API surface.

Suggested change
type MaterializeOptions = PinnedRuntimeMaterializeOptions & {
templateDir?: string
cacheRoot?: string
}
type MaterializeOptions = {
templateDir?: string
cacheRoot?: string
signal?: AbortSignal
}

The node-server lane installs dependencies without building node-pty, and
Linux has no upstream prebuild, so the real-PTY failed-I/O teardown test
(picked up by the pty-subprocess selector) could not load pty.node. In
--artifact runs, alias node-pty to out/orcad's shipped slot so the test
exercises the addon orcad actually runs under the pinned Node.
On Windows, node-pty keeps the conout worker thread and pseudoconsole alive
until kill(), even after the shell exits. The PTY health probe never killed a
cleanly exited probe, so the packaged preflight printed its readiness line
and then hung until the build's 30s timeout, reported with an empty stderr.

- The probe kills its PTY on Windows after exit and uses the bundled ConPTY
  the daemon spawns with.
- The preflight exits once stdout is flushed; its owner reads to EOF.
- Preflight failures now report code, signal, timeout, stdout and stderr.
… by alias

A vite alias redirected only ESM imports of node-pty; windows-pty-job and
local-pty-utils resolve it through require, so Windows loaded two conpty.node
copies and the Git Bash job-membership proof read an empty job. The failed-I/O
teardown test now loads node-pty through a fixture that picks the packaged slot
in artifact lanes.

The pty-subprocess selector was a prefix that also pulled in its POSIX-host
sibling unit tests, which pr.yml runs and which were never qualified on
Windows. Select the directory plus the two sibling files that belong here.

@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 in the latest commits.

Reviewed changes

This re-review covers the two commits pushed since the prior pullfrog review at 6d04e70f6f; the earlier full-PR review stands.

  • Stopped the Windows profile preflight from hanging after its PTY probe: the disposable probe now kills its ConPTY on win32 even after a clean exit, and orcad's entry forces the probe process to exit once stdout has flushed.
  • Preserved the probe's readiness output: main.ts writes an empty string and exits inside the write callback, a flush barrier that keeps the JSON response intact across the forced exit.
  • Made the node-server lane load the shipped node-pty: artifact lanes set ORCA_NODE_SERVER_NODE_PTY and the new config/vitest.node-server.config.ts aliases node-pty to the packaged slot, so real-PTY tests exercise the addon orcad actually ships.
  • Improved lane failure diagnostics: a shared describeProcessFailure helper reports exit code, signal, timeout/truncation, and both stream tails.

Pullfrog  | Fix it ➔ | 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 in the follow-up commit.

Reviewed changes

This re-review covers 0b15611f84, which supersedes the node-pty alias introduced in the previous commits.

  • Replaced the global node-pty vitest alias with an explicit loader: deleted config/vitest.node-server.config.ts and the lane runner's ORCA_NODE_SERVER_NODE_PTY wiring, so other suites in the artifact lane are no longer silently rerouted to the packaged addon.
  • Added loadNodePtyForTests(): artifact lanes resolve the packaged slot's addon and fail loudly when the expected input is missing; non-artifact lanes fall back to the dev install.
  • Switched the native PTY test to a lazy load: pty-subprocess-io-failure-native.test.ts resolves node-pty in beforeAll, so Windows no longer loads it just to skip.
  • Narrowed the node-server test selectors: the pty-subprocess/ directory plus the two real-PTY siblings, leaving the mocked unit siblings to pr.yml.

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

# Conflicts:
#	config/scripts/check-node-runtime-pin.mjs
#	config/scripts/check-node-runtime-pin.test.mjs
#	config/scripts/orcad-artifact-version.test.mjs
#	config/scripts/orcad-template-test-fixture.mjs
#	config/scripts/update-node-runtime-pin.mjs
#	config/scripts/update-node-runtime-pin.test.mjs
#	config/scripts/verify-packaged-orcad-template.cjs
#	package.json
#	src/main/orcad/orcad-artifact-identity.ts
#	src/shared/node-runtime-pin.ts
#	src/shared/orcad-bun-runtime.ts
# Conflicts:
#	.github/workflows/pr.yml
#	config/scripts/ci-shard-timings.json
#	config/scripts/pr-code-change-scope.mjs
#	config/scripts/profile-state-worker-smoke.mjs
#	config/scripts/run-bun-profile-tests.mjs
#	package.json
#	src/main/orcad/orcad-artifact-preflight.test.ts
#	src/main/orcad/orcad-profile-preflight.ts
#	src/main/ssh/orcad-remote-preflight.ts
#	src/shared/orcad-profile-preflight.test.ts
Comment on lines +62 to +69
const now = this.now()
const due =
entry.inFlight === 0
? now - entry.scannedAt >= CLAUDE_AT_REST_COMMANDS_TTL_MS
: entry.inFlight < MAX_SCANS_IN_FLIGHT && now - entry.lastStartedAt >= SCAN_OVERDUE_MS
if (due) {
this.scanInto(entry, record)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Idle menus miss command changes

The ten-second expiry starts a new scan only when something reads the command list. A scan is also what sends change notifications. If command or skill files change while a subscribed Claude chat receives no other events, its / menu stays outdated until another read occurs, leaving new commands unavailable from that menu.

@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 in the merge.

Reviewed changes

This re-review covers 5eab43b5f3, a merge of origin/main (2a83c9536f) into the branch; the earlier cutover review stands.

  • Folded main's native-chat work into the branch — the at-rest / command catalog (claude-at-rest-commands.ts, claude-command-folder-scan.ts, structured-agent-session-at-rest-commands.ts), the /clear-starts-nothing rework, and the at-rest model listing — without editing any branch-authored runtime file.
  • Resolved the 10 conflicts by keeping the branch's cutover versions verbatim (git diff b91f17e..5eab43b is empty for each). Those versions already carried main's #24088/#24089 content, so nothing was dropped: orcad-profile-preflight.ts still calls main's preflightOrcadNativeRuntime under the branch's ORCAD_NODE_RUNTIME_IDENTITY, profile-state-worker-smoke.mjs pins NODE_RUNTIME_PIN, and pr.yml keeps both the R1 daemon-crossing gate and the R3 launcher ratchet.
  • Retired main's run-bun-profile-tests.mjs in favor of run-node-server-tests.mjs; no dangling references remain, and ci-shard-timings.json carries both renamed preflight entries.
  • Verification in this run: pnpm run typecheck:node passes.

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

# Conflicts:
#	config/scripts/check-node-runtime-pin.mjs
#	config/scripts/check-runtime-launcher-protocol-ratchet.mjs
#	config/scripts/node-dist-archive-name.mjs
#	config/scripts/update-node-runtime-pin.mjs
#	src/main/ssh/orcad-remote-runtime.ts
#	src/shared/orcad-artifacts.ts
@OrcaWin
OrcaWin changed the base branch from OrcaWin/node-rt-phase1 to main October 1, 2026 07:14
@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.

📝 Walkthrough

Walkthrough

The pull request replaces Bun-based Orcad packaging and headless testing with pinned Node runtime assets. It adds target-specific node-pty prebuild manifests, compatibility checks, hashes, and smoke tests. Orcad packaging, local and remote runtime handoff, SSH deployment, and PTY spawning now use Node and node-pty. Bun-specific PTY modules are removed. CI runs Node server tests and retains explicit Bun cross-runtime coverage.

🚥 Pre-merge checks | ✅ 4 | ❓ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ❓ Inconclusive Docstring coverage is 32.97% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 91 functions across 50 files. (53 skipped… 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 identifies the primary change: running orcad on pinned Node instead of Bun.
Description check ✅ Passed The description is detailed and covers the main template sections, including ELI5, changes, rationale, linked issues, visual proof, testing, and agent-skill scope. Review, Notes, and Checklist section…
Full details: Docstring Coverage

Explanation

Docstring coverage is 32.97% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 91 functions across 50 files. (53 skipped: 6 unsupported, 47 over the file limit.)

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

@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: cb7e1a1d-44b9-43dd-82c8-92c19248bf2a

📥 Commits

Reviewing files that changed from the base of the PR and between 3e5c8d9 and 34bf406.

📒 Files selected for processing (141)
  • .github/workflows/node-server-tests.yml
  • config/electron-builder.config.cjs
  • config/relay-assets/node-pty-1.1.0-windows-pty-teardown-patch.cjs
  • config/scripts/build-orcad-bun.mjs
  • config/scripts/build-orcad-bun.test.mjs
  • config/scripts/build-orcad-node.mjs
  • config/scripts/build-orcad-prebuilds.mjs
  • config/scripts/build-orcad-prebuilds.test.mjs
  • config/scripts/build-orcad-template.mjs
  • config/scripts/build-orcad.mjs
  • config/scripts/bun-profile-test-paths.mjs
  • config/scripts/check-node-runtime-pin.mjs
  • config/scripts/check-node-runtime-pin.test.mjs
  • config/scripts/check-runtime-launcher-protocol-ratchet.mjs
  • config/scripts/ci-cache-warmup-workflow.test.mjs
  • config/scripts/ci-shard-timings.json
  • config/scripts/node-dist-archive-name.mjs
  • config/scripts/node-server-change-scope.mjs
  • config/scripts/node-server-change-scope.test.mjs
  • config/scripts/node-server-qualification.mjs
  • config/scripts/node-server-qualification.test.mjs
  • config/scripts/node-server-test-paths.mjs
  • config/scripts/orcad-artifact-version.mjs
  • config/scripts/orcad-artifact-version.test.mjs
  • config/scripts/orcad-entry-build.mjs
  • config/scripts/orcad-prebuild-slot-contents.mjs
  • config/scripts/orcad-prebuild-slot-contents.test.mjs
  • config/scripts/orcad-prebuild-smoke-child.cjs
  • config/scripts/orcad-prebuild-smoke.mjs
  • config/scripts/orcad-template-test-fixture.mjs
  • config/scripts/orcad-terminal-smoke-change-scope.mjs
  • config/scripts/orcad-terminal-smoke-change-scope.test.mjs
  • config/scripts/pinned-node-downloads.mjs
  • config/scripts/profile-state-worker-smoke.mjs
  • config/scripts/run-bun-profile-tests.mjs
  • config/scripts/run-node-server-tests.mjs
  • config/scripts/script-child-process.mjs
  • config/scripts/script-child-process.test.mjs
  • config/scripts/server-build-target.mjs
  • config/scripts/update-node-runtime-pin.mjs
  • config/scripts/update-node-runtime-pin.test.mjs
  • config/scripts/verify-packaged-orcad-template.cjs
  • config/scripts/verify-packaged-orcad-template.test.mjs
  • config/scripts/windows-cmd-shim-spawn-boundary.test.mjs
  • config/vitest.config.ts
  • docs/reference/ci-demand-rollout.md
  • docs/reference/ci-runner-efficiency.md
  • docs/reference/linux-glibc-compatibility.md
  • package.json
  • src/main/ai-vault/opencode-wsl-runtime-preparation.test.ts
  • src/main/ai-vault/opencode-wsl-runtime-preparation.ts
  • src/main/ai-vault/session-scanner-opencode-sqlite-process.test.ts
  • src/main/daemon/pty-subprocess-io-failure-native.test.ts
  • src/main/daemon/pty-subprocess/bun-pty-job-control.integration.test.ts
  • src/main/daemon/pty-subprocess/bun-pty-process-capabilities.ts
  • src/main/daemon/pty-subprocess/bun-pty-process-contract.ts
  • src/main/daemon/pty-subprocess/bun-pty-process-flow-control.test.ts
  • src/main/daemon/pty-subprocess/bun-pty-process-flow-control.ts
  • src/main/daemon/pty-subprocess/bun-pty-process-pause-retry.test.ts
  • src/main/daemon/pty-subprocess/bun-pty-process-runtime.ts
  • src/main/daemon/pty-subprocess/bun-pty-process-suspension.test.ts
  • src/main/daemon/pty-subprocess/bun-pty-process-suspension.ts
  • src/main/daemon/pty-subprocess/bun-pty-process.integration.test.ts
  • src/main/daemon/pty-subprocess/bun-pty-process.test.ts
  • src/main/daemon/pty-subprocess/bun-pty-process.ts
  • src/main/daemon/pty-subprocess/native-pty-spawn-bun.test.ts
  • src/main/daemon/pty-subprocess/native-pty-spawn-windows.test.ts
  • src/main/daemon/pty-subprocess/native-pty-spawn.ts
  • src/main/daemon/pty-subprocess/spawn-preflight-bun.test.ts
  • src/main/daemon/pty-subprocess/spawn-preflight-health-probe.test.ts
  • src/main/daemon/pty-subprocess/spawn-preflight.ts
  • src/main/daemon/pty-subprocess/windows-bun-pty-gate-entry.ts
  • src/main/daemon/pty-subprocess/windows-bun-pty-gate.integration.test.ts
  • src/main/daemon/pty-subprocess/windows-bun-pty-gate.test.ts
  • src/main/daemon/pty-subprocess/windows-bun-pty-gate.ts
  • src/main/daemon/pty-subprocess/windows-bun-pty-job.test.ts
  • src/main/daemon/pty-subprocess/windows-bun-pty-job.ts
  • src/main/daemon/pty-subprocess/windows-bun-pty-launch.test.ts
  • src/main/daemon/pty-subprocess/windows-bun-pty-launch.ts
  • src/main/daemon/pty-subprocess/windows-bun-pty-native.test.ts
  • src/main/daemon/pty-subprocess/windows-bun-pty-native.ts
  • src/main/daemon/pty-subprocess/windows-bun-pty-spawn-receipt.test.ts
  • src/main/daemon/pty-subprocess/windows-bun-pty-spawn-receipt.ts
  • src/main/daemon/windows-conpty-warmup.ts
  • src/main/orcad/main-preflight-order.test.ts
  • src/main/orcad/main.ts
  • src/main/orcad/native-host-abi.test.ts
  • src/main/orcad/native-host-abi.ts
  • src/main/orcad/node-pty-prebuilt-slot.test.ts
  • src/main/orcad/node-pty-prebuilt-slot.ts
  • src/main/orcad/node-pty-precondition.test.ts
  • src/main/orcad/node-pty-precondition.ts
  • src/main/orcad/orcad-artifact-identity.ts
  • src/main/orcad/orcad-artifact-preflight.test.ts
  • src/main/orcad/orcad-bundled-runtime.integration.test.ts
  • src/main/orcad/orcad-bundled-runtime.test.ts
  • src/main/orcad/orcad-bundled-runtime.ts
  • src/main/orcad/orcad-cross-runtime-daemon-adoption.integration.test.ts
  • src/main/orcad/orcad-native-preflight.ts
  • src/main/orcad/orcad-node-launcher.integration.test.ts
  • src/main/orcad/orcad-node-slot-fixture.ts
  • src/main/orcad/orcad-packaged-node-pty.integration.test.ts
  • src/main/orcad/orcad-profile-preflight.test.ts
  • src/main/orcad/orcad-profile-preflight.ts
  • src/main/persistence/profile-state/profile-state-cross-runtime.integration.test.ts
  • src/main/providers/agent-foreground-process-git-bash.win32.test.ts
  • src/main/providers/local-pty-bun-artifact.integration.test.ts
  • src/main/providers/local-pty-bun-posix-inspection.test.ts
  • src/main/providers/local-pty-bun-windows-identity.test.ts
  • src/main/providers/local-pty-launch-plan.ts
  • src/main/providers/local-pty-provider-spawn-session.test.ts
  • src/main/providers/local-pty-runtime-spawn.ts
  • src/main/ssh/orcad-activation-record.test.ts
  • src/main/ssh/orcad-artifact-materializer.test.ts
  • src/main/ssh/orcad-artifact-materializer.ts
  • src/main/ssh/orcad-bun-runtime-materializer.ts
  • src/main/ssh/orcad-deployment-target.ts
  • src/main/ssh/orcad-remote-deploy.test.ts
  • src/main/ssh/orcad-remote-deploy.ts
  • src/main/ssh/orcad-remote-install-termination.test.ts
  • src/main/ssh/orcad-remote-install.ts
  • src/main/ssh/orcad-remote-node-runtime.test.ts
  • src/main/ssh/orcad-remote-node-runtime.ts
  • src/main/ssh/orcad-remote-preflight.ts
  • src/main/ssh/orcad-remote-runtime.ts
  • src/main/ssh/pinned-runtime-materializer-node.test.ts
  • src/main/ssh/pinned-runtime-materializer.test.ts
  • src/main/ssh/pinned-runtime-materializer.ts
  • src/main/ssh/remote-install-model.test.ts
  • src/main/ssh/remote-install-model.ts
  • src/main/ssh/runtime-archive-download.ts
  • src/main/ssh/ssh-relay-opencode-runtime.test.ts
  • src/main/ssh/ssh-relay-opencode-runtime.ts
  • src/main/ssh/ssh-relay-versioned-install.ts
  • src/main/windows/windows-pty-job.ts
  • src/shared/node-runtime-pin.ts
  • src/shared/orcad-artifacts.test.ts
  • src/shared/orcad-artifacts.ts
  • src/shared/orcad-bun-runtime.ts
  • src/shared/orcad-node-runtime-identity.ts
  • src/shared/orcad-profile-preflight.test.ts
💤 Files with no reviewable changes (38)
  • src/main/daemon/pty-subprocess/windows-bun-pty-launch.test.ts
  • config/scripts/windows-cmd-shim-spawn-boundary.test.mjs
  • src/main/providers/local-pty-provider-spawn-session.test.ts
  • src/main/providers/local-pty-bun-artifact.integration.test.ts
  • src/main/daemon/pty-subprocess/windows-bun-pty-job.test.ts
  • src/main/daemon/pty-subprocess/windows-bun-pty-gate-entry.ts
  • src/main/providers/local-pty-bun-windows-identity.test.ts
  • src/main/daemon/pty-subprocess/bun-pty-process.integration.test.ts
  • src/main/daemon/pty-subprocess/bun-pty-process-flow-control.test.ts
  • src/main/daemon/pty-subprocess/windows-bun-pty-gate.integration.test.ts
  • src/main/daemon/pty-subprocess/bun-pty-process-suspension.test.ts
  • src/main/daemon/pty-subprocess/windows-bun-pty-job.ts
  • src/main/daemon/pty-subprocess/windows-bun-pty-spawn-receipt.test.ts
  • src/main/daemon/pty-subprocess/native-pty-spawn-bun.test.ts
  • src/main/daemon/pty-subprocess/bun-pty-process.test.ts
  • src/main/daemon/pty-subprocess/bun-pty-process.ts
  • src/main/daemon/pty-subprocess/bun-pty-process-flow-control.ts
  • src/main/daemon/pty-subprocess/bun-pty-process-pause-retry.test.ts
  • src/main/daemon/pty-subprocess/bun-pty-process-capabilities.ts
  • config/scripts/bun-profile-test-paths.mjs
  • src/main/daemon/pty-subprocess/spawn-preflight-bun.test.ts
  • src/main/daemon/pty-subprocess/bun-pty-job-control.integration.test.ts
  • src/main/providers/local-pty-bun-posix-inspection.test.ts
  • config/scripts/build-orcad-bun.test.mjs
  • src/main/daemon/pty-subprocess/bun-pty-process-contract.ts
  • config/vitest.config.ts
  • config/scripts/build-orcad-bun.mjs
  • src/main/daemon/pty-subprocess/windows-bun-pty-native.test.ts
  • src/main/orcad/orcad-native-preflight.ts
  • src/main/daemon/pty-subprocess/bun-pty-process-suspension.ts
  • src/main/daemon/pty-subprocess/windows-bun-pty-gate.test.ts
  • src/main/ssh/orcad-bun-runtime-materializer.ts
  • config/scripts/run-bun-profile-tests.mjs
  • src/main/daemon/pty-subprocess/windows-bun-pty-native.ts
  • src/main/daemon/pty-subprocess/bun-pty-process-runtime.ts
  • src/main/daemon/pty-subprocess/windows-bun-pty-launch.ts
  • src/main/daemon/pty-subprocess/windows-bun-pty-spawn-receipt.ts
  • src/main/daemon/pty-subprocess/windows-bun-pty-gate.ts

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

Comment on lines +37 to +40
if (resolve(source) !== resolve(destination)) {
rmSync(destination, { force: true })
copyFileSync(source, destination)
}

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

Skip the delete-and-copy when the content-addressed runtime already exists.

placeRuntime deletes and recopies the ~120 MB runtime on every pnpm build:orcad. The destination path is content-addressed (runtimes/node-<executableSha256>/...), so a file that already exists there with the matching hash is already correct.

The unconditional rmSync causes two problems:

  • On Windows, rmSync fails with EBUSY/EPERM when a local orcad is still running from that node.exe. The rebuild then aborts for no reason.
  • On POSIX, the unlink breaks hard links that test fixtures create to this file, such as installSlots in the cross-runtime test. Every build also rewrites 120 MB.

Before the delete, check the destination hash. Replace the file only when the hash differs.

Proposed fix
+import { createHash } from 'node:crypto'
+import { readFileSync } from 'node:fs'
 ...
   const destination = packagedNodeRuntimePath(outputDir, target)
   mkdirSync(dirname(destination), { recursive: true })
-  if (resolve(source) !== resolve(destination)) {
+  const current =
+    existsSync(destination) &&
+    createHash('sha256').update(readFileSync(destination)).digest('hex') ===
+      NODE_RUNTIME_ASSETS[target].executableSha256
+  if (!current && resolve(source) !== resolve(destination)) {
     rmSync(destination, { force: true })
     copyFileSync(source, destination)
   }

@OrcaWin
OrcaWin merged commit 6593d7d into main Oct 1, 2026
80 of 85 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