Repository navigation
ci(daemon): runtime-launcher protocol ratchet and Node slot marker - #24108
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.
|
There was a problem hiding this comment.
Important
The R3 ratchet omits src/main/ssh/orcad-artifact-materializer.ts from RUNTIME_LAUNCHER_PATHS. That file is where a packaged slot's runtime file is actually chosen and placed, so it is squarely in the group the comment calls "orcad slot layout: which runtime file a packaged slot carries" — and it is the file the Node migration will change. Its sibling orcad-bun-runtime-materializer.ts is listed, which makes the omission look accidental.
Reviewed changes
- R3 ratchet — new
check-runtime-launcher-protocol-ratchet.mjsfails a PR that both edits a path inRUNTIME_LAUNCHER_PATHSand changesPROTOCOL_VERSION, with an env/label override that still reports the violation. Wired into thecross-version-wirejob, with the checker routed there viapr-code-change-scope.mjs. - R5 slot marker —
selectOrcadSlotRuntimeCommandnow prefers.runtime-node(validated as exactly 64 lowercase hex →runtimes/node-<sha>/bin/node,exit 78on a malformed marker or missing runtime), then Bun, then legacy host Node. - Refactor —
nodeDistArchiveName/NODE_DIST_PLATFORMSextracted intonode-dist-archive-name.mjsso the offline pin check no longer loads the build graph; the pin's.tsis loaded viacreateRequireto drop the typeless-package warning. - Tests — POSIX selector coverage including a frozen copy of the shipped Bun-era selector run against a Node slot, malformed-marker cases, and the
$(...)stop-path embedding; plus git-history tests for the ratchet.
ℹ️ The Node slot marker has no producer in this branch
ORCAD_NODE_RUNTIME_MARKER_FILENAME is read by the selector and written only by the test fixture. Nothing in the branch (or its base) assembles a Node slot: orcad-artifact-materializer.ts still emits bun-runtime + .build-target, and the preflight/install probe still expects Bun. The new selector branch is therefore unreachable in production until the writer lands, so this PR cannot exercise R5 end to end. That is expected for a stacked compatibility-rules PR, but worth confirming the writer is tracked and matches the reader's exact contract.
Technical details
# Node slot marker contract is asserted only by the reader
## Affected sites
- `src/shared/orcad-artifacts.ts:34` — `ORCAD_NODE_RUNTIME_MARKER_FILENAME` defined.
- `src/main/ssh/orcad-remote-runtime.ts:38-45` — reader; requires the marker to be exactly 64 lowercase hex characters after command-substitution strips trailing newlines (so the file must be `<sha256>\n`, no spaces, no CR).
- `src/main/ssh/orcad-artifact-materializer.ts` + `orcad-bun-runtime-materializer.ts` — still build Bun slots; no `.runtime-node` writer.
## Required outcome
- Confirm the marker's producer (sha of the executable, LF-terminated) is implemented in a later stacked PR and that both the sha source and line ending agree with the strict 64-hex validation.
- If the producer is expected in this PR series, add a test that a materialized Node slot is accepted by `selectOrcadSlotRuntimeCommand`.
## Open questions for the human
- Is the `.runtime-node` writer deliberately scoped to a follow-up PR, and does it use `NODE_RUNTIME_ASSETS[target].executableSha256`?DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| 'src/shared/node-runtime-pin.ts', | ||
| 'src/main/ssh/orcad-bun-runtime-materializer.ts', | ||
| // orcad slot layout: which runtime file a packaged slot carries. | ||
| 'src/shared/orcad-artifacts.ts', |
There was a problem hiding this comment.
orcad-artifact-materializer.ts is where a packaged slot's runtime file is chosen and copied into the slot (artifactSources → orcadArtifactFilenames/orcadBunRuntimeFilename, then assembleOrcadArtifact). A future PR that swaps a slot to the Node runtime would change this file, so leaving it out of RUNTIME_LAUNCHER_PATHS gives the R3 gate a hole exactly where the runtime swap happens. Its sibling orcad-bun-runtime-materializer.ts is already listed.
| 'src/shared/orcad-artifacts.ts', | |
| 'src/shared/orcad-artifacts.ts', | |
| 'src/main/ssh/orcad-artifact-materializer.ts', |
# Conflicts: # config/scripts/check-node-runtime-pin.mjs # config/scripts/update-node-runtime-pin.mjs # config/scripts/update-node-runtime-pin.test.mjs # package.json # src/shared/orcad-bun-runtime.ts
# Conflicts: # .github/workflows/pr.yml # config/scripts/pr-code-change-scope.mjs # package.json
Comments Outside DiffThese findings could not be posted inline.
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (1)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (12)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe PR adds a CI check that rejects daemon protocol changes when runtime-launcher files also change, unless the override is enabled. It updates remote slot selection to recognize Node runtime markers and select the matching pinned executable. It also centralizes Node distribution archive naming and updates the pin scripts to use the shared function. Priority: ➖ Normal Merge Risk: 🔵 Low · up to The runtime-selection changes have no established blocking defect. The compatibility guard has a bounded coverage gap: include the artifact materializer so future runtime changes cannot bypass the protocol check. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to Marked Node slots fail closed rather than silently switching runtimes, and process stopping retains its identity checks. No newly exposed security vulnerability was established. Trusted installation and lifecycle management for shared runtimes remain unproven, and the new compatibility gate covers only a fixed subset of runtime-producing paths. Retained concerns Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 31.58% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 10 files. (2 skipped: 2 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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 |

ELI5
This adds two safety rules for the move from Bun to Node. First, a PR can't change the process that runs the terminal daemon and the daemon's protocol version at the same time. Second, a server install built for Node is labelled so that older Orca clients never mistake it for a broken Bun install.
What Changed
config/scripts/check-runtime-launcher-protocol-ratchet.mjs, run in thecross-version-wirejob):RUNTIME_LAUNCHER_PATHS(the orcad handoff, slot layout, slot runtime selection and daemon host launch) and also changesPROTOCOL_VERSION.allow-runtime-launcher-protocol-bumpoverrides it; the violation is still reported. A new push is needed after adding the label..runtime-nodecontaining the runtime's sha256, never.build-target.selectOrcadSlotRuntimeCommandchecks for a Node slot first, then Bun (unchanged), then a legacy host-Node install.runtimes/node-<sha>/bin/node. A Node slot never falls back to host Node: it exits 78 if the marker is malformed or the runtime is missing.check-node-runtime-pin.mjsloads the TypeScript pin file without theMODULE_TYPELESS_PACKAGE_JSONwarning.Why
Swapping the runtime (Electron, Bun or Node) isn't a protocol change, so it shouldn't happen in the same PR as one: that is how live terminals get stranded during an upgrade. Old clients already use
.build-targetto mean "Bun slot, exit 78 if Bun is missing", so Node slots need a marker old clients don't act on.Linked Issue
Part of the Node runtime plan (compatibility rules R3 and R5). Stacked on
OrcaWin/node-rt-phase1, which merges #24087, #24088 and #24089.Visual Proof
N/A. These are CI checks and remote-host slot selection, with no UI.
Testing
106 tests pass across the ratchet, orcad-remote-runtime, process control, pin checks, PR routing and artifacts. That includes real-git scenarios for the ratchet, and shell-parse coverage for the selector when it is embedded in
$(...).pnpm tcand the changed-code gate pass.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.