Repository navigation
fix(update): hand the private Node runtime to npm lifecycle children - #164677
Conversation
Propagate the selected runtime through child PATH while retaining explicit executable invocation and npm_config_node. Include the helper in runtime and wrapper packaging inventories and cover real npm preinstall execution with an unsupported PATH node. Closes #164525.
|
🦞👀 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: needs maintainer review before merge. Reviewed October 3, 2026, 9:44 PM ET / October 4, 2026, 01:44 UTC. ClawSweeper reviewWhat this changesThe PR carries the selected Node runtime into package-manager lifecycle children and includes the shared environment helper in shipped runtime inventories. Merge readiness✅ Ready for maintainer review The PR remains useful: current main covers managed-update PATH selection but lacks the startup-recovery and explicit package-manager handoffs added here. No actionable introduced defect was found. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw selects a compatible Node runtime for startup recovery and package updates. Its process runner launches package managers, whose lifecycle scripts resolve their own Node executable through PATH. flowchart TD
A[Startup recovery or package update] --> B[Selected Node runtime]
B --> C[Child environment]
D[Inherited PATH and npm settings] --> C
C --> E[Package manager]
E --> F[Lifecycle scripts]
F --> G[Compatible Node execution]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +10, Tests +110, Docs +2, Config +1, Other +30. Total +153 across 21 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep runtime selection and lifecycle-child PATH aligned through the shared startup-safe helper while preserving caller npm configuration. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the missing handoff when an absolute compatible Node launches npm while an unsupported Node remains first in PATH; the supplied before/after npm run exercises that mechanism. Current main was inspected, not executed. Is this the best way to solve the issue? Yes, the startup-safe helper centralizes this handoff without importing application dependencies into recovery, and the patch preserves plain package-manager selection and npm settings. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 91e9b93bcebd. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
…penclaw#164677) When the updater or recovery selected the compatible private Node runtime and ran npm's JavaScript CLI with it, npm lifecycle children (preinstall and friends) resolved plain node from PATH and picked the unsupported system Node, so the install rejected itself. One shared PATH handoff now prepends the selected runtime's bin directory for every package-manager spawn in recovery, update environments, and explicit npm/pnpm execution, preserving npm_config_node and the explicit executable, scoped to the child only. Real-npm regression: lifecycle child reported v22.22.3 before, the private runtime after. Closes openclaw#164525.
…164677) When the updater or recovery selected the compatible private Node runtime and ran npm's JavaScript CLI with it, npm lifecycle children (preinstall and friends) resolved plain node from PATH and picked the unsupported system Node, so the install rejected itself. One shared PATH handoff now prepends the selected runtime's bin directory for every package-manager spawn in recovery, update environments, and explicit npm/pnpm execution, preserving npm_config_node and the explicit executable, scoped to the child only. Real-npm regression: lifecycle child reported v22.22.3 before, the private runtime after. Closes #164525. (cherry picked from commit 070b747)
Closes #164525
What Problem This Solves
Fixes npm installs during update or recovery selecting an unsupported system Node for lifecycle scripts even though npm itself runs with a compatible private Node. Reported by @jarvisnextgeneration20-lang.
Why This Change Was Made
A dependency-free helper prepends the selected Node directory to the child PATH during startup recovery, explicit Node-driven npm/pnpm execution, and update runtime selection. Explicit executable invocation remains in place, and
npm_config_nodeis preserved. Plain npm, pnpm, and bun commands retain the caller's runtime selection.The helper is included in npm, Docker, worker-bootstrap, and PR-wrapper source inventories. The PR-wrapper inventory change contains only
node-runtime-env.mjs.User Impact
Recovery and package-manager updates can keep lifecycle children on the compatible runtime while the system Node remains unsupported. This changes child environments only; no new options, dependency versions, state schemas, or shell settings are introduced.
Evidence
Runtime and regression proof
preinstall: node -p "process.version", and a fake system Node first in PATH: before the fix, stdout containedv22.22.3; afterward it reported the selected private runtime (v26.10.0locally andv24.19.0on Linux).node scripts/check-changed.mjscompleted: all preceding checks, all typecheck lanes, and all three dead-export scans passed; lint failed only on the inherited findings listed below. The remainingpnpm check:import-cycleswas run separately and passed with zero runtime value cycles.Main-side wrapper failure (waived; FIX1)
The lead explicitly waived the existing macOS cold/warm provisioning failure in
test/scripts/pr-worktree-provision.test.ts. Its failing guard is:The missing-runtime diagnostic below is quoted with only the temporary fixture prefix normalized:
The known APFS variant reports
Error: Test timed out in 120000ms.(134.53 s wall time). FIX1 owns this worker-dispatch gap; this PR does not add those inventory entries or change the timeout/assertions.Slow pre-existing suites (waived)
src/cli/update-cli/update-command-original-service.test.ts: 188.537 s across 54 cases.src/cli/update-cli.npm-runtime.test.ts:preserves split-root package updates when the service definition is writable-overridden, 30.190 s.preserves a symlinked parent through native Git with acceleration enabled: 31.999 s on the loaded Mac.These are covered by the lead's standing slow-suite waiver; no timeout, retry, assertion, or baseline changes were made for them.
Importer coverage and waiver
The direct and single-barrel search selected 395 importer files. Completed importer groups reported 112 files passed and one skipped before Testbox cancellation interrupted infrastructure coverage. The remaining 282 files are waived under the final L1421 ruling; no new remote lease was requested on resume. The repeated focused and packaging proof above is retained.
Inherited lint findings outside this diff
None of these files is modified by this PR. The relevant existing lint limits remain unchanged; the two extension files match both the base and current main.
No lint suppression or baseline was changed. This is qualified validation, not a claim that the whole-repository lint gate is green.
Change size
Production/tooling +49/-8; tests/support +115/-5; docs +5/-3. Total: 21 files, +169/-16.