Repository navigation
fix(update): prevent runtime recovery from replacing another install - #150526
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: blocked before merge. Reviewed September 17, 2026, 2:44 PM ET / 18:44 UTC (Revision 16). ClawSweeper reviewWhat this changesThe updater adds actionable runtime and permission diagnostics and resumes runtime recovery through the original launcher with fresh installation-ownership checks. Merge readiness⛔ Blocked before merge - 5 items remain This PR remains useful and has convincing destination-refusal proof, but both prior P2 findings remain unresolved in the pinned head. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s updater combines the selected release, Node runtime, package-manager destination, and managed Gateway configuration before installing a candidate. Its recovery instructions and recorded outcomes guide operators and Doctor after a failed attempt. flowchart TD
A[Selected release and saved channel] --> C[Update preflight]
B[Node runtime and service configuration] --> C
C --> D[Inspect installation destination]
D --> E[Owned or empty destination]
D --> F[Foreign or unknown destination]
E --> G[Normal installation and verification]
F --> H[Retained launcher recovery and Doctor report]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +662, Tests +1121, Docs +76, Other +3. Total +1862 across 54 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep recovery within the ordinary updater, preserving channel intent and service selectors while retaining destination ownership checks and platform-correct instructions. Do we have a high-confidence way to reproduce the issue? Yes, source establishes both remaining failures: generated --tag recovery meets the extended-stable rejection, and Windows production output disagrees with unconditional POSIX test expectations. No target code or tests were executed during this read-only review. Is this the best way to solve the issue? Yes, resuming through the retained launcher and existing updater is the appropriate ownership boundary; channel propagation and platform-specific expectations still need correction. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ecc4c992fb1b. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (15 earlier review cycles; latest 8 shown)
|
b5b3102 to
0427ca3
Compare
0427ca3 to
999d2a8
Compare
Carry the package owner's failedStep through the result adapter instead of selecting a failure from attempt history. Admission, settlement, and retention owners record their selected outcomes directly. Preserve EACCES remediation and facts after an unrelated npm failure and retry. Thanks to @arrobapontocom-ui for the report in #150452; follow-up to #150526.
999d2a8 to
d4e4788
Compare
Carry the package owner's failedStep through the result adapter instead of selecting a failure from attempt history. Admission, settlement, and retention owners record their selected outcomes directly. Preserve EACCES remediation and facts after an unrelated npm failure and retry. Thanks to @arrobapontocom-ui for the report in #150452; follow-up to #150526.
48d487a to
44d0e3d
Compare
Carry the package owner's failedStep through the result adapter instead of selecting a failure from attempt history. Admission, settlement, and retention owners record their selected outcomes directly. Preserve EACCES remediation and facts after an unrelated npm failure and retry. Thanks to @arrobapontocom-ui for the report in #150452; follow-up to #150526.
44d0e3d to
07db59d
Compare
Continue through the retained absolute launcher instead of recommending an uninspected global install. Recheck prefix and service ownership, preserve typed refusal guidance in reports, and keep the selected runtime during fresh-profile admission. Thanks to @arrobapontocom-ui for the original report (#150452, item 1).
48f6112 to
8a31544
Compare
|
Landing at
|
Preserve saved extended-stable subscriptions and explicit channel switches when a Node runtime refusal prints recovery instructions. Reuse the resolved target and existing service inspection verdict so recovery returns through the retained launcher and normal ownership checks. Direct protected or pinned service-runtime repairs to the deployment owner, and avoid force-install advice for a service definition that cannot be refreshed. The extended-stable tag refusal and installation ownership protections remain unchanged. Follow-up to the deferred recovery-command P2 in #150526; related to #150452. Thanks to @arrobapontocom-ui for the original field report. Validation: exact-head CI run 35275739173 is green with zero pending checks. Recorded update CLI proof passed 2,097 tests with 6 skipped, followed by all 7 channel replay cases; targeted checks passed. The exact-head Codex review is scoped-clean through P2 and ClawSweeper reports no findings. Native runtime switching and managed-service activation were not exercised.
|
The deferred P2 is closed: #151150 (merged as |
CI setup could fail before lint or tests when Matrix crypto native-library downloads hit a transient release-CDN error. Hosted store-only readers used a different cache path from the publisher, and hybrid mode seeded only the Blacksmith Linux backend. Align the existing setup action and warmer on the workspace-local pnpm store, publish completed native installation outputs before unrelated build work, and add one install-only hosted warmer row in hybrid mode. Bound installed-Node discovery to four levels to avoid traversing bundled npm dependencies. The existing warmer remains the sole publisher and PR consumers remain restore-only. Current-head hosted warm setup completed in 22 seconds with 1,436 packages reused, zero downloads, and Matrix postinstall skipped, compared with the recorded ten-job 45-second baseline median. This is an observed sample, not a measured fleet-wide median change. Cold caches and changed native inputs still require upstream assets. No application runtime, configuration, dependency, or permission changes. Validation: exact-head PR CI run 35197161825 returned GREEN; the accepted Codex review and exact-head ClawSweeper review found no actionable issues. The PR also records passing targeted Node/cache guards, workflow checks, and cold/warm native reuse proof. Related: openclaw#150637, openclaw#150526.
…penclaw#150526) * fix(update): explain runtime and global install permission failures Report the affected directory, owner, and next action for npm permission failures. Preserve typed outcomes in dry-run previews, update reports, and Doctor history, and give candidate-specific Node upgrade guidance. Thanks to @arrobapontocom-ui for reporting the upgrade diagnostics in openclaw#150452. * fix(update): keep the final retry error in staging and guidance Carry the package owner's failedStep through the result adapter instead of selecting a failure from attempt history. Admission, settlement, and retention owners record their selected outcomes directly. Preserve EACCES remediation and facts after an unrelated npm failure and retry. Thanks to @arrobapontocom-ui for the report in openclaw#150452; follow-up to openclaw#150526. * fix(update): preserve deployment advice in permission recovery * test(update): assert candidate runtime guidance at the CLI boundary * fix(update): recommend a runtime the updater itself can run * fix(update): keep the CLI reachable through a runtime switch in recovery guidance * fix(update): recheck ownership after runtime switches Continue through the retained absolute launcher instead of recommending an uninspected global install. Recheck prefix and service ownership, preserve typed refusal guidance in reports, and keep the selected runtime during fresh-profile admission. Thanks to @arrobapontocom-ui for the original report (openclaw#150452, item 1). * fix(update): isolate the global command runner contract * test(update): match resolved npm prefix probes * fix(update): refuse uninspectable npm destinations
) Preserve saved extended-stable subscriptions and explicit channel switches when a Node runtime refusal prints recovery instructions. Reuse the resolved target and existing service inspection verdict so recovery returns through the retained launcher and normal ownership checks. Direct protected or pinned service-runtime repairs to the deployment owner, and avoid force-install advice for a service definition that cannot be refreshed. The extended-stable tag refusal and installation ownership protections remain unchanged. Follow-up to the deferred recovery-command P2 in openclaw#150526; related to openclaw#150452. Thanks to @arrobapontocom-ui for the original field report. Validation: exact-head CI run 35275739173 is green with zero pending checks. Recorded update CLI proof passed 2,097 tests with 6 skipped, followed by all 7 channel replay cases; targeted checks passed. The exact-head Codex review is scoped-clean through P2 and ClawSweeper reports no findings. Native runtime switching and managed-service activation were not exercised.
CI setup could fail before lint or tests when Matrix crypto native-library downloads hit a transient release-CDN error. Hosted store-only readers used a different cache path from the publisher, and hybrid mode seeded only the Blacksmith Linux backend. Align the existing setup action and warmer on the workspace-local pnpm store, publish completed native installation outputs before unrelated build work, and add one install-only hosted warmer row in hybrid mode. Bound installed-Node discovery to four levels to avoid traversing bundled npm dependencies. The existing warmer remains the sole publisher and PR consumers remain restore-only. Current-head hosted warm setup completed in 22 seconds with 1,436 packages reused, zero downloads, and Matrix postinstall skipped, compared with the recorded ten-job 45-second baseline median. This is an observed sample, not a measured fleet-wide median change. Cold caches and changed native inputs still require upstream assets. No application runtime, configuration, dependency, or permission changes. Validation: exact-head PR CI run 35197161825 returned GREEN; the accepted Codex review and exact-head ClawSweeper review found no actionable issues. The PR also records passing targeted Node/cache guards, workflow checks, and cold/warm native reuse proof. Related: #150637, #150526. Co-authored-by: Peter Steinberger <[email protected]>
Related: #150452 (item 1)
What Problem This Solves
Fixes unclear update failures and recovery instructions that can lose the CLI or overwrite another deployment after switching Node runtimes.
User Impact
Operators receive a typed permission failure with the affected directory, owner when available, and remediation. Container redeployment advice and pending-recovery constraints remain composed with those facts. Runtime guidance selects a Node release satisfying both the candidate and updater requirements.
After selecting Node, recovery now continues with
node <retained-absolute-install>/openclaw.mjs update --tag <candidate>. It preserves the recorded service/state selectors and does not depend on the switched prefix having anopenclawcommand. The ordinary updater rechecks the selected npm prefix and service ownership before installation. Only a positively inspected empty or owned destination may continue. A foreign or uninspectable destination yieldsglobal-install-foreign-destinationbefore staging; the retained installation and destination are preserved. An unknown result names the permission, prefix-probe, or layout cause, and marks the prefix unresolved when npm could not identify it. The updater retains its original installation owner.For a known foreign destination, the refusal names the occupied prefix, package, launcher, and selected service entrypoint when available. For an unknown destination, it directs the operator to restore inspection access or npm prefix discovery, or ask the deployment owner to verify and explicitly select the intended installation. It offers switching the runtime back and retrying through the retained launcher, or explicitly selecting the other installation with its owner's agreement. An explicit service-selection command is printed only for an observed destination launcher and supported service-management context; wrappers and unresolved launchers remain with the deployment owner. This is not automatic takeover authority.
Why This Change Was Made
The original updater could present raw npm errors and lose a final retry's permission outcome because consumers selected the first failed step. The package owner now records the authoritative outcome, and staging, recovery guidance, reports, and Doctor consume it. Existing reason, failure-fact, and next-action fields carry the diagnostics; no config, CLI/environment option, dependency, or database schema was added.
The runtime-switch follow-up removes preprinted package-install, service-rewrite, restart, and verification commands. Those operations remain with the ordinary updater after fresh admission. The npm prefix query and Windows launcher reader remain shared in
update-npm-prefix.ts. Complete filesystem inspection and service/root ownership classification now live together inupdate-command-package-destination.ts, returning a closedowned | empty | foreign | unknownresult. The nullable inspection and its admitting branch were removed without compatibility re-exports. Onlyownedandemptypass;unknowncarries a cause and uses the existing refusal/report path. Service comparison reuses the existing native ownership verdict and launcher/root comparison.Against
b57f4bd588d5ef6e4be1e64b01adbbf17461c12e, cumulative production is +390/-256 (+134), tests/support +501/-158 (+343), and docs +29/-21 (+8). The production growth provides typed permission/destination diagnostics and usable runtime recovery, including fresh-profile runtime selection while preserving service selectors, credentials, and other PATH entries. The unknown-admission repair itself is production-net-zero against3b5925cab1533cac0e974b9293539a52f6144238(+98/-98): it combines the former filesystem projection and ownership decision instead of adding another mechanism. Its tests/support are +150/-46 (+104), and docs +8/-3 (+5). Extracting the existing command-transport fixture shrinks the capped CLI test file without removing coverage. All line-cap checks pass without suppression or baseline edits.Thanks to @arrobapontocom-ui for the field report.
Evidence
npm install -g [email protected]after nvm selection. Real offline npm then replaced a synthetic foreign deployment at the selected prefix while leaving the original prefix unchanged.continue-updatestep through the retained absolute launcher. The real npm-prefix probe returnsglobal-install-foreign-destinationand preserves both synthetic packages. Regression coverage exercises this order, dry-run and mutable refusal, empty and owned destinations, a destination claimed by the selected service, and a dangling foreign launcher.Isolated foreign-prefix proof
The fixture uses real npm, existing trusted Node executables, isolated prefixes/HOME/state/config/cache, empty npmrc files, and local bin-only package tarballs with lifecycle scripts disabled. It substitutes the local candidate tarball for the registry spec. It exercises prefix switching and the real preflight owner; it does not execute nvm itself, install a real OpenClaw release, or activate a managed service. Fixtures were removed afterward.
Published-driver compatibility and limitations
Current main already checks known candidate engine mismatches before staging. The 2026.7.1-2 driver's silent metadata skip and dry-run bypass are shipped-driver behavior; candidate code cannot retroactively change them. The new guidance and prefix refusal require the fixed updater to be installed.
Prior proof ran untouched published
[email protected](3a9d69d) under Node 24.21.0 in a disposable container with isolated HOME/state and a root-owned prefix. Its dry-run exited 0 without permission failures because it returns before candidate execution. This is an installed-driver limitation.A synthetic terminal row using the existing schema-17 reason, step, and
origin.nextActionfields was then read successfully by that published driver's JSON and human update-status paths. They preserved the new permission reason, directory, owner, and full remediation; unknown structured facts did not remove stored data. This proves existing report-record compatibility, not old-driver production of new outcomes or a full activation. No schema change is introduced by this follow-up. No Gateway or real operator state was changed.ClawSweeper follow-up: the foreign-prefix finding is addressed by the retained-launcher continuation and fresh destination admission. The PowerShell 5.1 rank-up move is applied: nvm/fnm selection uses an explicit
LASTEXITCODEcondition on Windows, and the old&&verification chain is removed. Native PowerShell 5.1, nvm, and managed-service activation were not available/executed on this host; the PR makes no live proof claim for them. Doctor's added reason handling is advisory use of existing history fields, not a data-model migration.Rebased validation on
8a31544611cd37b0eab5f3264ebb2158a52ab62c(base5ac1b2e17ebfac7d7326959b695a6d4edf1b0207):src/cli/update-cli.test.ts: preserved main's before/after exit-code cleanup and the isolated npm-prefix fixture, while retaining main's comment removal. No production hunk conflicted or changed. Nine range-diff entries are=; the final!is context-only. Its zero-context added/deleted patch content is identical before and after rebase.pnpm install --frozen-lockfile: passed.OPENCLAW_VITEST_MAX_WORKERS=1 pnpm test src/cli/update-cli src/cli/update-cli.test.ts: 2,085 passed, 6 skipped, including all 504 top-level CLI integration cases. Full runtime build prerequisite passed. No focused fallback needed.node scripts/check-changed.mjs: all steps before lint passed, including every typecheck lane. Lint hit only the documented ancestor-node_modules declaration artifact. The approved direct extension lint passed after a fresh canary; independent core/script lint and stylesheet lint passed. Both runtime and Madge checks report 0 cycles.--mode branch --base origin/main --max-priority P1): scoped-clean, exit 0. Artifact:pr-150526-r10-autoreview.md.Prior accepted-head validation on
48f6112a3fb2de2c4d7e4720bcf6540078c6085f:OPENCLAW_VITEST_MAX_WORKERS=1 pnpm test src/cli/update-cli: 1,576 passed, 6 skipped across three projects. Its full build prerequisite also completed.node scripts/check-changed.mjs --base 3b5925cab1533cac0e974b9293539a52f6144238: exit 0, covering production/test types, targeted lint, formatting, boundaries, ratchets, schema/storage guards, and dead-export checks. Runtime import cycles and Madge both report 0 cycles.--mode branch --base origin/main --max-priority P1, scoped-clean, exit 0. Artifact:pr-150526-r9-autoreview.md.node_modulesreturnedunknown / permission; restoring permissions confirmed both original and destination marker files unchanged. The fixture was removed. This complements the CLI no-staging regression; it does not claim live Gateway activation or a real package installation.The earlier full production changed checks passed all type and pre-lint gates; native extension lint reached only the documented nested-checkout declaration-input artifact. The approved direct extension lint, independent core/script lint, stylesheet lint, and runtime-cycle check passed. No baseline or suppression was changed.
Approved extension-lint substitute
CI's extension-lint job remains authoritative.