Repository navigation
feat(orcad): run orcad on the pinned Node instead of Bun - #24110
Conversation
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
# Conflicts: # package.json
… 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.
|
| function exec(conn: SshConnection, command: string, signal?: AbortSignal): Promise<string> { | ||
| return execCommand(conn, command, { signal }) | ||
| } |
There was a problem hiding this comment.
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.
| } finally { | ||
| await rm(localStage, { recursive: true, force: true }).catch(() => {}) | ||
| await exec(conn, `rm -rf ${shellEscape(stageDir)}`).catch(() => {}) | ||
| } |
There was a problem hiding this comment.
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.
| function hostTarget(): ServerTarget | null { | ||
| if (process.platform === 'darwin') { | ||
| return process.arch === 'arm64' ? 'darwin-arm64' : 'darwin-x64' | ||
| } | ||
| return null |
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
ℹ️ Minor suggestions only — one small cleanup.
Reviewed changes
- Runtime slots: orcad packages now carry
.server-target(target id) and.runtime-node(the pinned Node'sexecutableSha256) plus the target's node-pty slot and its own ripgrep, instead of a bundled Bun executable..build-target/bun-runtimeare retained only so Bun-era slots stay launchable (D7.1 R5) and are absent fromorcadArtifactFilenames; 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;mergeManifestrefuses mixed napi/version andfindSlotProblemsverifies before use. musl strips the glibc-only ldflag/.symverpins, and a smoke loads and spawns the staged node-pty under the pinned Node. - Handoff and launch:
handoffToBundledOrcadand the remote selector resolve.runtime-nodeto../runtimes/node-<sha>/bin/nodeand checkprocess.versions.node; slot resolution is symlink-aware.selectOrcadSlotRuntimeCommandprefers 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-materializeris replaced bypinned-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 underruntimes/. - Bun PTY removal:
canUseBunPty/spawnBunPty, the Windows Bun-PTY gate/launch/job/native code and everycanUseBunPtybranch 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.ymlbecomesnode-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_VERSIONstays 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.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| type MaterializeOptions = PinnedRuntimeMaterializeOptions & { | ||
| templateDir?: string | ||
| cacheRoot?: string | ||
| } |
There was a problem hiding this comment.
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.
| 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.
There was a problem hiding this comment.
✅ 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.tswrites 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_PTYand the newconfig/vitest.node-server.config.tsaliasesnode-ptyto the packaged slot, so real-PTY tests exercise the addon orcad actually ships. - Improved lane failure diagnostics: a shared
describeProcessFailurehelper reports exit code, signal, timeout/truncation, and both stream tails.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ 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-ptyvitest alias with an explicit loader: deletedconfig/vitest.node-server.config.tsand the lane runner'sORCA_NODE_SERVER_NODE_PTYwiring, 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.tsresolves node-pty inbeforeAll, 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.
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
| 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) | ||
| } |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
✅ 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..5eab43bis empty for each). Those versions already carried main's#24088/#24089content, so nothing was dropped:orcad-profile-preflight.tsstill calls main'spreflightOrcadNativeRuntimeunder the branch'sORCAD_NODE_RUNTIME_IDENTITY,profile-state-worker-smoke.mjspinsNODE_RUNTIME_PIN, andpr.ymlkeeps both the R1 daemon-crossing gate and the R3 launcher ratchet. - Retired main's
run-bun-profile-tests.mjsin favor ofrun-node-server-tests.mjs; no dangling references remain, andci-shard-timings.jsoncarries both renamed preflight entries. - Verification in this run:
pnpm run typecheck:nodepasses.
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
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 📝 WalkthroughWalkthroughThe 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)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation 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 💡
🛠️ Fix failing CI checks 💡
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: cb7e1a1d-44b9-43dd-82c8-92c19248bf2a
📒 Files selected for processing (141)
.github/workflows/node-server-tests.ymlconfig/electron-builder.config.cjsconfig/relay-assets/node-pty-1.1.0-windows-pty-teardown-patch.cjsconfig/scripts/build-orcad-bun.mjsconfig/scripts/build-orcad-bun.test.mjsconfig/scripts/build-orcad-node.mjsconfig/scripts/build-orcad-prebuilds.mjsconfig/scripts/build-orcad-prebuilds.test.mjsconfig/scripts/build-orcad-template.mjsconfig/scripts/build-orcad.mjsconfig/scripts/bun-profile-test-paths.mjsconfig/scripts/check-node-runtime-pin.mjsconfig/scripts/check-node-runtime-pin.test.mjsconfig/scripts/check-runtime-launcher-protocol-ratchet.mjsconfig/scripts/ci-cache-warmup-workflow.test.mjsconfig/scripts/ci-shard-timings.jsonconfig/scripts/node-dist-archive-name.mjsconfig/scripts/node-server-change-scope.mjsconfig/scripts/node-server-change-scope.test.mjsconfig/scripts/node-server-qualification.mjsconfig/scripts/node-server-qualification.test.mjsconfig/scripts/node-server-test-paths.mjsconfig/scripts/orcad-artifact-version.mjsconfig/scripts/orcad-artifact-version.test.mjsconfig/scripts/orcad-entry-build.mjsconfig/scripts/orcad-prebuild-slot-contents.mjsconfig/scripts/orcad-prebuild-slot-contents.test.mjsconfig/scripts/orcad-prebuild-smoke-child.cjsconfig/scripts/orcad-prebuild-smoke.mjsconfig/scripts/orcad-template-test-fixture.mjsconfig/scripts/orcad-terminal-smoke-change-scope.mjsconfig/scripts/orcad-terminal-smoke-change-scope.test.mjsconfig/scripts/pinned-node-downloads.mjsconfig/scripts/profile-state-worker-smoke.mjsconfig/scripts/run-bun-profile-tests.mjsconfig/scripts/run-node-server-tests.mjsconfig/scripts/script-child-process.mjsconfig/scripts/script-child-process.test.mjsconfig/scripts/server-build-target.mjsconfig/scripts/update-node-runtime-pin.mjsconfig/scripts/update-node-runtime-pin.test.mjsconfig/scripts/verify-packaged-orcad-template.cjsconfig/scripts/verify-packaged-orcad-template.test.mjsconfig/scripts/windows-cmd-shim-spawn-boundary.test.mjsconfig/vitest.config.tsdocs/reference/ci-demand-rollout.mddocs/reference/ci-runner-efficiency.mddocs/reference/linux-glibc-compatibility.mdpackage.jsonsrc/main/ai-vault/opencode-wsl-runtime-preparation.test.tssrc/main/ai-vault/opencode-wsl-runtime-preparation.tssrc/main/ai-vault/session-scanner-opencode-sqlite-process.test.tssrc/main/daemon/pty-subprocess-io-failure-native.test.tssrc/main/daemon/pty-subprocess/bun-pty-job-control.integration.test.tssrc/main/daemon/pty-subprocess/bun-pty-process-capabilities.tssrc/main/daemon/pty-subprocess/bun-pty-process-contract.tssrc/main/daemon/pty-subprocess/bun-pty-process-flow-control.test.tssrc/main/daemon/pty-subprocess/bun-pty-process-flow-control.tssrc/main/daemon/pty-subprocess/bun-pty-process-pause-retry.test.tssrc/main/daemon/pty-subprocess/bun-pty-process-runtime.tssrc/main/daemon/pty-subprocess/bun-pty-process-suspension.test.tssrc/main/daemon/pty-subprocess/bun-pty-process-suspension.tssrc/main/daemon/pty-subprocess/bun-pty-process.integration.test.tssrc/main/daemon/pty-subprocess/bun-pty-process.test.tssrc/main/daemon/pty-subprocess/bun-pty-process.tssrc/main/daemon/pty-subprocess/native-pty-spawn-bun.test.tssrc/main/daemon/pty-subprocess/native-pty-spawn-windows.test.tssrc/main/daemon/pty-subprocess/native-pty-spawn.tssrc/main/daemon/pty-subprocess/spawn-preflight-bun.test.tssrc/main/daemon/pty-subprocess/spawn-preflight-health-probe.test.tssrc/main/daemon/pty-subprocess/spawn-preflight.tssrc/main/daemon/pty-subprocess/windows-bun-pty-gate-entry.tssrc/main/daemon/pty-subprocess/windows-bun-pty-gate.integration.test.tssrc/main/daemon/pty-subprocess/windows-bun-pty-gate.test.tssrc/main/daemon/pty-subprocess/windows-bun-pty-gate.tssrc/main/daemon/pty-subprocess/windows-bun-pty-job.test.tssrc/main/daemon/pty-subprocess/windows-bun-pty-job.tssrc/main/daemon/pty-subprocess/windows-bun-pty-launch.test.tssrc/main/daemon/pty-subprocess/windows-bun-pty-launch.tssrc/main/daemon/pty-subprocess/windows-bun-pty-native.test.tssrc/main/daemon/pty-subprocess/windows-bun-pty-native.tssrc/main/daemon/pty-subprocess/windows-bun-pty-spawn-receipt.test.tssrc/main/daemon/pty-subprocess/windows-bun-pty-spawn-receipt.tssrc/main/daemon/windows-conpty-warmup.tssrc/main/orcad/main-preflight-order.test.tssrc/main/orcad/main.tssrc/main/orcad/native-host-abi.test.tssrc/main/orcad/native-host-abi.tssrc/main/orcad/node-pty-prebuilt-slot.test.tssrc/main/orcad/node-pty-prebuilt-slot.tssrc/main/orcad/node-pty-precondition.test.tssrc/main/orcad/node-pty-precondition.tssrc/main/orcad/orcad-artifact-identity.tssrc/main/orcad/orcad-artifact-preflight.test.tssrc/main/orcad/orcad-bundled-runtime.integration.test.tssrc/main/orcad/orcad-bundled-runtime.test.tssrc/main/orcad/orcad-bundled-runtime.tssrc/main/orcad/orcad-cross-runtime-daemon-adoption.integration.test.tssrc/main/orcad/orcad-native-preflight.tssrc/main/orcad/orcad-node-launcher.integration.test.tssrc/main/orcad/orcad-node-slot-fixture.tssrc/main/orcad/orcad-packaged-node-pty.integration.test.tssrc/main/orcad/orcad-profile-preflight.test.tssrc/main/orcad/orcad-profile-preflight.tssrc/main/persistence/profile-state/profile-state-cross-runtime.integration.test.tssrc/main/providers/agent-foreground-process-git-bash.win32.test.tssrc/main/providers/local-pty-bun-artifact.integration.test.tssrc/main/providers/local-pty-bun-posix-inspection.test.tssrc/main/providers/local-pty-bun-windows-identity.test.tssrc/main/providers/local-pty-launch-plan.tssrc/main/providers/local-pty-provider-spawn-session.test.tssrc/main/providers/local-pty-runtime-spawn.tssrc/main/ssh/orcad-activation-record.test.tssrc/main/ssh/orcad-artifact-materializer.test.tssrc/main/ssh/orcad-artifact-materializer.tssrc/main/ssh/orcad-bun-runtime-materializer.tssrc/main/ssh/orcad-deployment-target.tssrc/main/ssh/orcad-remote-deploy.test.tssrc/main/ssh/orcad-remote-deploy.tssrc/main/ssh/orcad-remote-install-termination.test.tssrc/main/ssh/orcad-remote-install.tssrc/main/ssh/orcad-remote-node-runtime.test.tssrc/main/ssh/orcad-remote-node-runtime.tssrc/main/ssh/orcad-remote-preflight.tssrc/main/ssh/orcad-remote-runtime.tssrc/main/ssh/pinned-runtime-materializer-node.test.tssrc/main/ssh/pinned-runtime-materializer.test.tssrc/main/ssh/pinned-runtime-materializer.tssrc/main/ssh/remote-install-model.test.tssrc/main/ssh/remote-install-model.tssrc/main/ssh/runtime-archive-download.tssrc/main/ssh/ssh-relay-opencode-runtime.test.tssrc/main/ssh/ssh-relay-opencode-runtime.tssrc/main/ssh/ssh-relay-versioned-install.tssrc/main/windows/windows-pty-job.tssrc/shared/node-runtime-pin.tssrc/shared/orcad-artifacts.test.tssrc/shared/orcad-artifacts.tssrc/shared/orcad-bun-runtime.tssrc/shared/orcad-node-runtime-identity.tssrc/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.
| if (resolve(source) !== resolve(destination)) { | ||
| rmSync(destination, { force: true }) | ||
| copyFileSync(source, destination) | ||
| } |
There was a problem hiding this comment.
🩺 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,
rmSyncfails withEBUSY/EPERMwhen a local orcad is still running from thatnode.exe. The rebuild then aborts for no reason. - On POSIX, the unlink breaks hard links that test fixtures create to this file, such as
installSlotsin 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)
}
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
node/node.exeunder its real name, atruntimes/node-<sha>/bin/node, with no rename.windows-process-treeon win32, and only the target's own ripgrep..runtime-nodeand.server-targetfeed the version hash. The template is schema 3, with a per-targetfilesmap.build-orcad-node.mjsreplacesbuild-orcad-bun.mjs. The watcher and worker smoke tests run under the pinned Node.handoffToBundledOrcad()launches the pinned Node from.runtime-nodeand checksprocess.versions.node. The preflights key on bundled-runtime identity instead ofprocess.versions.bun.bun-pty-process*,windows-bun-pty-*and everycanUseBunPtybranch are removed. What remains is the node-pty path the desktop already runs. Desktop behaviour is unchanged.pinned-runtime-materializer.tsreplaces the Bun materializer. The Bun wrapper stays only for the OpenCode vault reader, which moves in Phase 2.orcad-remote-node-runtime.tsuploads the official archive only when the host lacks it, then checks it by hash on the host.bun-profile-tests.ymlbecomesnode-server-tests.yml, with the same runners. Its "Node 18 hands off" check now hands off to the pinned Node.PROTOCOL_VERSIONstays 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}andsrc/sharedunder 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 atf4092c06and this Node build, started and stopped with the client's own deploy commands.--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
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.