Repository navigation
fix(update): keep npm updates on their resolved installation - #158285
Conversation
Use the package transaction target for npm destination ownership checks so a different Node prefix cannot block an in-place update. Preserve foreign package and launcher refusals at the actual write target. Refs #158179.
|
🦞👀 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 26, 2026, 12:54 AM ET / 04:54 UTC (Revision 3). ClawSweeper reviewWhat this changesThe update CLI now checks npm destination ownership at the installation selected for the package update, with revised regression tests and troubleshooting guidance. Merge readiness⛔ Blocked before merge - 2 items remain The false refusal remains on current main and in v2026.9.6. This PR makes a focused repair, but the required recovery proof for users running the published updater is still outstanding. Priority: P0 Review scores
Verification
How this fits togetherThe update CLI resolves the installation that invoked it, checks its package and launcher, then stages and swaps the update. An ownership refusal stops installation and returns recovery guidance. flowchart LR
A[Installed updater] --> B[Resolve npm installation]
B --> C[Inspect package and launcher]
C --> D{Owned or empty?}
D -->|Yes| E[Stage and swap update]
D -->|No| F[Refusal and recovery guidance]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +1, Tests -9, Docs +8. Total 0 across 8 files. View PR surface stats
Review metricsNone. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Use the resolved installation as the single destination for admission and replacement, with a verified, discoverable recovery path for users whose installed updater refuses before staging. Do we have a high-confidence way to reproduce the issue? Yes. Current main contains the separate-prefix guard, and the PR reports a failing pre-fix two-prefix regression; this read-only review did not execute it. Is this the best way to solve the issue? Yes for the code repair: passing the transaction's resolved target to the existing guard removes the competing destination decision while retaining ownership checks. Published-updater recovery still needs proof. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ac9b848d2f0b. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
Use the resolved npm transaction destination for admission rather than probing an unrelated ambient prefix. Coalesce superseded maintenance after a quiet write window, cap repeated replans, and distinguish typed supersession from real or slow Worker failures. Preserve frozen-target ownership and guards. Backports, in dependency order: - #158285 / 564947e - #156583 / 2044520 - #157834 / f583397 Source credit: Peter Steinberger and Ayaan Zaidi. Thanks to abuegab1-spec for the maintenance generation-loop diagnosis and warn-mode guard. Original-production regressions reproduced all three defects. Scoped owner, maintenance/updater sibling, and one real npm fixture passed (715 unique cases after overlap deduplication). Core/owner types, lint, formatting, and frozen eb377ac line-cap/suppression/assertion ratchets pass. Independent autoreview is scoped-clean through P2 on exact tree 4a2c853. No published-driver x packed-candidate qualification claimed. An older installed updater refusing before staging cannot acquire this correction from candidate code. Canonical release and public publication remain held. Implementation and verification: https://team.openclaw.ai/chat/roboclaw/subagent/2580a771-00db-4b52-b995-d05c3bd7a89c Original discussion and integration: https://team.openclaw.ai/chat/roboclaw/dashboard/db4d78ac-b19b-4f64-adfb-0ca7973a62e4 Co-authored-by: Ayaan Zaidi <[email protected]> Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> Co-authored-by: steipete <[email protected]> Co-authored-by: jalehman <[email protected]>
…w#158285) * fix(update): keep npm updates on their resolved installation Use the package transaction target for npm destination ownership checks so a different Node prefix cannot block an in-place update. Preserve foreign package and launcher refusals at the actual write target. Refs openclaw#158179. * test(update): align npm root and prefix fixture metadata * test(update): align fixtures with resolved destination ownership
What Problem This Solves
Fixes npm-global updates being refused after switching Node or npm prefixes when an unrelated OpenClaw installation occupies the shell's current npm prefix.
Refs #158179.
User Impact
Updates inspect and update the original installation's resolved destination. A different installation under nvm, fnm, Homebrew, or a changed npm prefix no longer blocks an update that would never write there. Foreign packages, foreign launchers, and unreadable destinations at the actual write target still refuse safely.
Why This Change Was Made
The package target resolver already preserves the invoking npm installation's prefix, and the package transaction uses that target. The admission guard independently probed the shell's npm prefix and could veto a different path. Pass the resolved target to the existing guard and remove the competing prefix probe. The ownership and launcher checks remain with that guard.
This corrects the installed updater; a previously installed driver that refuses before staging cannot acquire the correction from candidate code. No configuration, schema, dependency, or command-line option changes.
Evidence
On a Blacksmith Testbox, the real CLI regression failed against the original implementation with
global-install-foreign-destination, then all 15 destination tests passed three times. Measuredpnpm test src/cli/update-cli/update-command-runtime-destination.test.ts --maxWorkers=1wall times were 19.29, 19.39, and 19.70 seconds; test time was under one second per run, with shared transform preparation dominating wall time.All 16 directly/shared-fixture importing and requested diagnostic sibling files passed (161 tests; four routed shards, 144.01 seconds).
node scripts/check-changed.mjspassed, including all 25 selected test type graphs, core typecheck, lint, and guards. No individual test exceeded 30 seconds. Full remote proof command including negative control, repeats, siblings, and changed checks completed successfully in 34m24.623s. CI timing is pending the PR run.Proof ran in isolated Linux fixtures, not the reporters' installations. The same conflicting resolver/guard behavior is present in the published 2026.9.6 source; previously installed drivers need the corrected updater installed before this behavior changes.
Production +15/-14 lines; tests +81/-92; documentation +13/-5. Obsolete cancellation cases for the removed prefix subprocess were removed; target-settlement coverage remains at its owner. Independent Codex autoreview reported no actionable P0–P2 findings.