Skip to content

fix(update): keep npm updates on their resolved installation - #158285

Merged
steipete merged 4 commits into
mainfrom
upd/closed-report-classes-research
Sep 26, 2026
Merged

steipete merged 4 commits into
mainfrom
upd/closed-report-classes-research

Conversation

@steipete

Copy link
Copy Markdown
Contributor

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. Measured pnpm test src/cli/update-cli/update-command-runtime-destination.test.ts --maxWorkers=1 wall 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.mjs passed, 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.

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.
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes size: M labels Sep 25, 2026
@steipete
steipete marked this pull request as ready for review September 25, 2026 19:25
@clawsweeper

clawsweeper Bot commented Sep 25, 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.

@clawsweeper clawsweeper Bot added P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. 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. labels Sep 25, 2026
@clawsweeper

clawsweeper Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 26, 2026, 12:54 AM ET / 04:54 UTC (Revision 3).

ClawSweeper review

What this changes

The 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
Reviewed head: 38b0cab77b8e8e1f01a063dbb6aa5d4eb76aa749

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) The focused repair and regression coverage are strong; a separate published-updater recovery gate remains open.
Proof confidence 🌊 off-meta tidepool Not applicable: The Repository State identifies a MEMBER author, so the general external-contributor proof gate does not apply. The synthetic updateCommand dry-run supports the target-selection repair, but the separate repository-required published-driver × candidate recovery cell has not been shown.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The Repository State identifies a MEMBER author, so the general external-contributor proof gate does not apply. The synthetic updateCommand dry-run supports the target-selection repair, but the separate repository-required published-driver × candidate recovery cell has not been shown.
Evidence reviewed 8 items Introduced repair: The PR passes the resolved package-install target to the existing destination inspector, replacing its separate shell-prefix probe.
Shared target and retained guard: The resolver preserves the invoking npm installation's global root; the inspector still checks the canonical package path and launcher before admitting that resolved target.
Current main still has the false-refusal mechanism: Current main independently probes npm's shell prefix inside the ownership guard.
Findings None None.
Security None None.

How this fits together

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

Before merge

  • Resolve merge risk (P1) - A published v2026.9.6 updater can refuse before candidate code runs. The PR has not shown the required published-driver × candidate refusal, recovery, and successful-update path.
  • Complete next step (P2) - Add a redacted published v2026.9.6 updater × candidate trace showing the refusal, the recovery path, and a successful update after recovery.
Agent review details

Security

None.

PR surface

Source +1, Tests -9, Docs +8. Total 0 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 2 15 14 +1
Tests 5 98 107 -9
Docs 1 13 5 +8
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 126 126 0

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #158179
Summary: This PR is the candidate repair for the two-prefix foreign-destination refusal in the closed v2026.9.6 report.

Members:

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

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    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.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

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

Labels

Label changes:

No label changes.

Label justifications:

  • P0: The reported published-release update is blocked, and recovery currently requires technical intervention outside the update flow.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The Repository State identifies a MEMBER author, so the general external-contributor proof gate does not apply. The synthetic updateCommand dry-run supports the target-selection repair, but the separate repository-required published-driver × candidate recovery cell has not been shown.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Jason (Json): Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-25T19:32:51.396Z sha 74412e6 :: needs changes before merge. :: none
  • reviewed 2026-09-26T01:21:41.987Z sha 3c63f43 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 26, 2026
Merge main to include the existing task-content projection correction from 5be36d3 (#158520), which fixes the missing helper reported by the PR merge-ref typechecks.
@steipete
steipete merged commit 564947e into main Sep 26, 2026
193 checks passed
@steipete
steipete deleted the upd/closed-report-classes-research branch September 26, 2026 05:05
roboclaw-bot added a commit that referenced this pull request Sep 27, 2026
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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 27, 2026
…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
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 P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant