Skip to content

fix: reject incompatible Gateway Node before package update staging - #180769

Merged
steipete merged 1 commit into
mainfrom
upd/upd-l1827
Oct 22, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/upd-l1827

Conversation

@steipete

Copy link
Copy Markdown
Contributor

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.node requirement. 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, and update.run preserves 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

  • Three package-entry regressions (npm, pnpm, Bun package manager with a Node Gateway) fail on base bf28212f2c4f by 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.
  • The Gateway handoff suite passes 24 tests, including refusal text, recorded serving status, and no restart/ownership transfer. This is transport compatibility coverage: the new Gateway case also passes on the base. It is not a red-to-green reproduction of the full native-service update.
  • All 22 direct/barrel consumer test files were exercised locally. Recovery-command tests retain the saved/requested channel in the retry command; stale refusal-reason expectations were updated. The local consumer run is not wholly green: the 13 inherited failures below remain.
  • Scoped CLI-update and Gateway-methods typechecks, touched-file oxlint and oxfmt, git diff --check, and madge pass (0 import cycles). Full check: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; /healthz returned {"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 through resolvePackageRuntimePreflight({engineOnly:true,...}): it refused the range >=24.22.1 <25 || >=26.12.1 and 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-artifact and admit-artifact; candidate database-schema refusal; fallback node-runtime refusal; work-deadline cases undefined and 17; and fresh-profile runtime provisioning. The first group stages a package but never observes the candidate admission subprocess (contexts=[]); the provisioning case fails its existing runtime-provision event 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.ts reproduce 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 ENOENT is 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 HOME and OPENCLAW_STATE_DIR directories. 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.ts

Touched TypeScript files were passed explicitly to node scripts/run-oxlint.mjs --tsconfig tsconfig.json; all ten changed files were passed to node_modules/.bin/oxfmt --check. Final isolated Codex autoreview: no actionable P0/P1 findings.

Reuse runtime admission before registry candidate staging, preserve pinned service and channel recovery guidance, and keep update.run refusal diagnostics intact. Covers #180636, #180701, and #180707; references #180688 and #180667.
@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime cli CLI command changes size: M labels Oct 22, 2026
@steipete
steipete marked this pull request as ready for review October 22, 2026 16:16
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T16:19:09.997864Z 7ced2e6 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

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

  • Before: Package installation runs and fails because the release requires >=24.22.1 <25 || >=26.12.1.
  • After: The updater returns preflight-node-runtime-incompatible before staging, identifies the service runtime, and recommends Node 24.22.1.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, source-supported fix with useful regression evidence and reported live CLI behavior, limited by the unexercised native-service route and one redundant transport test.
Proof confidence 🦐 gold shrimp (3/6) The ordinary contributor proof gate is exempt for this maintainer-authored PR; supplied evidence exercises production CLI registration and a real old-Node probe, while expressly leaving native service-pinned behavior unproven.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Users receive opaque package-install failures after requesting a release their Gateway Node cannot run.
Reason: Confirmed reports and written maintainer direction support earlier refusal with actionable runtime guidance, without silently substituting another release.

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
Reviewed head: 7ced2e615a03cc946574c40b9f2370181c1a49a4

Before merge

None.

Findings

None.

Tests

  • Low-value test src/gateway/server-methods/update-handoff-failure.test.ts: Remove or consolidate the added reason-specific mock case: it injects the complete refusal into an unchanged transport path already covered by typed handoff-refusal tests and passes on the base.
  • Missing end-to-end proof: The supplied proof does not demonstrate a live native service-pinned update.run refusal; the body expressly records the failed native-service setup.
Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Raw commit 931de9e adds src/cli/update-cli/update-command-target.ts:425 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 931de9e55a35; files: src/cli/update-cli/update-command-target.ts)

PR surface

Source +45, Tests +77, Docs +5. Total +127 across 10 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 4 64 19 +45
Tests 5 110 33 +77
Docs 1 8 3 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 182 55 +127

Review metrics

Metric Value Why it matters
Production versus test growth Production +64/-19; tests/support +110/-33 The production growth adds early admission within the existing owner; regression coverage protects package-manager entry paths and unchanged installation/state.

Root-cause cluster

Relationship: canonical
Canonical: #180769
Summary: This PR owns early engine admission for three confirmed package-install failures; the other referenced reports do not establish that same cause.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add P0: The linked community Control UI report establishes an update blocked by the runtime floor, with recovery requiring terminal and service-definition work outside the product.
  • add merge-risk: 🚨 compatibility: Early registry admission deliberately stops incompatible runtimes before the existing fallback/provisioning path; this operator-impact tradeoff is explicitly accepted in the maintainer-authored direction.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P0: The linked community Control UI report establishes an update blocked by the runtime floor, with recovery requiring terminal and service-definition work outside the product.
  • merge-risk: 🚨 compatibility: Early registry admission deliberately stops incompatible runtimes before the existing fallback/provisioning path; this operator-impact tradeoff is explicitly accepted in the maintainer-authored direction.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 22, 2026, 12:33 PM ET / 16:33 UTC.

@steipete
steipete merged commit 3755040 into main Oct 22, 2026
215 of 218 checks passed
@steipete
steipete deleted the upd/upd-l1827 branch October 22, 2026 16:48
RomneyDa added a commit that referenced this pull request Oct 22, 2026
…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]>
This was referenced Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

1 participant