Repository navigation
fix: reject incompatible Gateway Node before package update staging - #180769
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesThis PR checks registry targets against the selected Gateway Node before package staging and reports incompatibility with recovery guidance. Example: Update to OpenClaw 2026.10.6 with Gateway Node 26.10.0.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-approved PR addresses confirmed update failures, and current main still lacks its early engine check; no actionable correctness or security defect was found. Priority: P0 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe update CLI resolves package metadata and the managed-service runtime, passes them to the existing runtime planner, and either reports refusal or continues into candidate staging and activation. flowchart TD
A[CLI or Gateway update request] --> B[Resolve target and service runtime]
B --> C[Existing runtime planner]
C --> D[Refusal and recovery guidance]
C --> E[Candidate staging and admission]
E --> F[Activation capability checks]
Technical reviewBest possible solution: Retain the shared pre-staging refusal and make its recovery guidance accessible through a visible Doctor or Fix action in Updates. Do we have a high-confidence way to reproduce the issue? Current-main ordering permits staging before installed runtime admission, and three linked release reports show lifecycle failures with the exact incompatible engine range; no target code was executed during this review. Is this the best way to solve the issue? The patch uses the existing runtime and engine-evaluation owners, preserves exact target selection, and leaves artifact admission, Bun handling, and later capability checks in their established paths. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b8fda397d5c9. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +45, Tests +77, Docs +5. Total +127 across 10 files. Added test files: 1. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 22, 2026, 12:33 PM ET / 16:33 UTC. |
…taging (#180769) 2026.10.6 raised engines.node to >=24.22.1 <25 || >=26.12.1 (#179992). Package-mode updates (npm/pnpm global, Control UI update.run) staged and installed the target before checking its Node requirement, so users on older Node got an opaque global-install-failed. Target resolution now runs the existing runtime-compat owner first against the Gateway's selected Node and refuses with preflight-node-runtime-incompatible, leaving the Gateway untouched and naming the current version, the required range and the next step. Unknown engines metadata never blocks. Fixes #180636 (@sglion777), Fixes #180701 (@Almost-Certified-ops), Fixes #180707 (@billpang1-sketch); Refs #180688 (@rayluo88). (cherry picked from commit 3755040) Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
Package updates could stage a release or run its install scripts before discovering that the Gateway's configured Node executable cannot run its
engines.noderequirement. This surfaced as opaque installation failures after the 2026.10.6 Node floor increase.Fixes #180636, Fixes #180701, Fixes #180707, Refs #180688, Refs #180667.
User Impact
Registry updates now refuse before staging with
preflight-node-runtime-incompatible, naming the detected Node version, required range, and recovery steps. A pinned service executable is checked even when the invoking shell uses a compatible Node; the message names the service path and asks the operator to update that definition. Dry-run reports the same refusal. The requested release remains selected, andupdate.runpreserves its serving observation and full recovery message without parking the Gateway.Why This Change Was Made
Target resolution reuses the existing package runtime preflight and the engine evaluator already shared with Git updates. Its early phase cannot replace or provision a runtime; activation still owns executable identity and SQLite capability checks. Explicit package artifacts retain their staged-metadata workflow, and Bun retains its own runtime contract.
Thanks to @sglion777, @Almost-Certified-ops, @billpang1-sketch, @rayluo88, and @jcheng510 for the reports.
Evidence
bf28212f2c4fby reaching staging, and pass with the fix. They check the pinned service Node, exact target range, recovery guidance, no staging/provisioning, and unchanged package/state. The final combined Bun run passes all 31 runtime admission, preview, and recovery-selector tests across three files in 44.72 s. The package regression also passed under Node. An earlier three-case Bun run used 289 ms test time out of 35.25 s wall time, mostly transformation.git diff --check, and madge pass (0 import cycles). Fullcheck:changed/SQLite inventory was skipped under the campaign's local gate budget; PR CI remains the broad proof.Live proof
All processes used private HOME/state directories and a private npm prefix. A real 2026.10.5 Gateway ran on a free port under Node 26.12.0;
/healthzreturned{"ok":true,"status":"live"}before and after the refused update. The real registry metadata for 2026.10.6 was checked against that old Node executable throughresolvePackageRuntimePreflight({engineOnly:true,...}): it refused the range>=24.22.1 <25 || >=26.12.1and recommended Node 24.22.1.The production update CLI registration was also exercised against the private installed package and a local synthetic registry target requiring Node >=99.0.0. It returned
preflight-node-runtime-incompatible; the registry received only/openclaw, with no package download/install. The installed package stayed at 2026.10.5. Both task-owned processes were stopped; Gateway shutdown completed in 353 ms.Native LaunchAgent bootstrap returned error 5, and source service inspection correctly refused the relocated HOME/state. That route was not bypassed. Thus this is full CLI refusal plus a running isolated Gateway and an actual old-binary probe, not full native-service-pinned live proof.
Baseline failures and report attribution
Seven candidate-admission fixture failures reproduce with the production files restored to the untouched base: fresh bootstrap
refuse-artifactandadmit-artifact; candidate database-schema refusal; fallback node-runtime refusal; work-deadline casesundefinedand17; and fresh-profile runtime provisioning. The first group stages a package but never observes the candidate admission subprocess (contexts=[]); the provisioning case fails its existingruntime-provisionevent assertion. The deeper candidate-fixture cause remains unresolved. Assertions were retained; these are not passing proof. The full candidate/related infra run took 101.24 s wall time, 81% tests; no individual test exceeded 30 s. Gateway suite: 58.56 s, 91% tests. Build preparation took 75.6 s separately.Six additional failures in
update-command-fresh-preview.test.tsreproduce on the untouched base: all five original-state capture cases and the Doctor completed-history case. The snapshot owner refuses the writable ancestor of this worktree volume (SQLite staging ancestor must not allow another user to replace its child), so capture-dependent expectations fail. No volume permission or safety-check changes were made. The filtered baseline replay failed the same six cases in 56.30 s (48% tests, 50% transformation). The broader four-file Node group took 153.34 s, 87% tests; no individual test exceeded 30 s.The npm errors in #180636, #180701, and #180707 explicitly name the new engine range. #180688's pnpm
ENOENTis not proven to have the same cause. #180667 explicitly targets 2026.10.5; its Node 26.12.0 satisfies that release's engine range, so its startup failure remains a separate diagnosis.Compatible older-release suggestions are not added: target resolution has the selected release's metadata, not a compatible-release inventory. No release is silently substituted.
Production delta: +64/-19 lines; tests/support: +110/-33; docs: +8/-3. The added production logic is the early admission call and its restricted phase in the existing runtime owner; no new runtime owner, persisted state, option, or dependency.
Focused commands
Every runtime/test invocation used isolated
HOMEandOPENCLAW_STATE_DIRdirectories. Local checks used Node 26.12.1.OPENCLAW_VITEST_RUNTIME=bun node scripts/run-vitest.mjs src/cli/update-cli/update-command-node-engine-preflight.test.ts --maxWorkers=1 OPENCLAW_VITEST_RUNTIME=bun node scripts/run-vitest.mjs src/cli/update-cli/update-command-node-engine-preflight.test.ts src/cli/update-cli/update-command-runtime-destination.test.ts src/cli/update-cli/update-command-runtime-preview.test.ts --maxWorkers=1 OPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs \ src/infra/update-run-report.test.ts \ src/cli/update-cli/update-command-metadata-diagnostics.test.ts \ src/cli/update-cli/update-command-target.n1-prefix.test.ts \ src/cli/update-cli/update-command-target-settlement.test.ts \ src/cli/update-cli/update-command-noop.test.ts \ src/cli/update-cli/update-command-source.test.ts \ src/cli/update-cli/update-command-freebsd-pkg.test.ts \ src/cli/update-cli/update-command-timeouts.test.ts \ src/cli/update-cli/update-command-runtime-destination.test.ts \ src/cli/update-cli/update-command-package.test.ts \ src/cli/update-cli/update-command-contention.test.ts \ src/cli/update-cli/update-command-executor-settlement.test.ts \ src/cli/update-cli/update-command-fresh-inspection.test.ts \ src/cli/update-cli/update-command-fresh-preview.test.ts \ src/cli/update-cli/update-command-post-update-repair.test.ts \ src/cli/update-cli/update-command-service-maintenance-identity.test.ts \ src/cli/update-cli/update-command-service-plan.test.ts \ src/cli/update-cli/update-command-fresh-runtime.test.ts \ src/cli/update-cli/update-command-install-layout.test.ts \ src/cli/update-cli/update-command-fresh-overrides.test.ts \ src/cli/update-cli/update-command-node-engine-preflight.test.ts \ src/cli/update-cli/update-command-runtime-preview.test.ts \ src/cli/update-cli.candidate-admission.test.ts \ src/infra/update-runner-git-node-preflight.test.ts \ src/gateway/server-methods/update-handoff-failure.test.ts \ --maxWorkers=1 OPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs src/cli/update-cli/update-command-foreground.test.ts src/cli/update-cli/update-command-schema-cleanup.test.ts --maxWorkers=1 OPENCLAW_VITEST_RUNTIME=bun node scripts/run-vitest.mjs src/cli/update-cli.candidate-admission.test.ts -t 'keeps dry-run on installed checks without staging' --maxWorkers=1 node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.cli-update.json --incremental node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.gateway-methods.json --incremental node --import ./scripts/tsx.mjs scripts/check-madge-import-cycles.tsTouched TypeScript files were passed explicitly to
node scripts/run-oxlint.mjs --tsconfig tsconfig.json; all ten changed files were passed tonode_modules/.bin/oxfmt --check. Final isolated Codex autoreview: no actionable P0/P1 findings.