Skip to content

fix(plugins): normalize managed npm overrides before peer planning - #124532

Merged
steipete merged 3 commits into
openclaw:mainfrom
wangyan2026:fix/filter-pnpm-overrides-managed-npm-124426
Aug 27, 2026
Merged

steipete merged 3 commits into
openclaw:mainfrom
wangyan2026:fix/filter-pnpm-overrides-managed-npm-124426

Conversation

@wangyan2026

@wangyan2026 wangyan2026 commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Closes #124426.

Summary

Keep the original producer-side repair from @wangyan2026 and complete the same managed-npm ownership boundary: normalize pnpm-only parent-child selectors before npm sees a manifest, and plan managed peers against the incoming normalized override set.

There were two connected problems. The shared override producer passed pnpm-only selectors into npm. Separately, peer planning read the old on-disk overrides before synchronization applied the incoming set. A retired invalid selector could therefore make planning fail and silently preserve stale managed peer pins. The earlier PR description overstated this as an unconditional install abort: current code can instead fall back to existing pins. The new regression and real-npm proof cover that actual behavior.

The canonical producer now recursively removes pnpm parent-child selectors while retaining npm-compatible range keys, nested rules, dependency references, and aliases. Install and uninstall consume that result before planning. The change deletes the selector error classifier, two-kind omission state, retry loops, and compensating second synchronization. One bounded npm-alias retry remains for the distinct npm compatibility error.

Production LOC: +52/-113 (net -61). Tests: +122/-159 (net -37). Documentation: +1/-1. No new dependency, config key, schema, or operator action.

Verification

  • Real npm 11.17.0 and 12.0.2, using local package fixtures, an unreachable registry, and lifecycle scripts disabled: the pre-fix selector produces EINVALIDTAGNAME and stale-peer retention; the candidate completes planning/install/pruning with exit 0 and removes the stale peer.

  • Independent first-sync/second-sync proof discovers the required peer once and converges without a redundant update.

  • All 187 focused producer/install/uninstall tests passed, including a fresh rerun after merging current main into this contributor branch (31 infra + 156 plugin tests; 13.45 seconds):

    node scripts/run-vitest.mjs src/infra/npm-managed-root.test.ts src/plugins/install.npm-spec.test.ts src/plugins/uninstall.test.ts
  • The complete local check:changed gate passed on the byte-identical candidate repair. The refreshed branch's eight repaired file blobs match that candidate exactly; the focused rerun and git diff --check passed on the refreshed branch.

  • Structured Codex autoreview completed for both the full repair and the contributor fixup, with no findings at its default P0 threshold. Independent review checked owner/caller paths, npm contracts, and current-main applicability.

Compatibility and remaining scope

The npm-managed project omits pnpm-only selectors because npm cannot represent them. Other npm-compatible overrides remain. The host pnpm installation is unchanged. Documentation now states this boundary instead of promising that every host override applies to managed npm dependencies.

The broader fallback from an unrelated peer-planning failure to existing pins, and legacy shared-root uninstall recovery, are unchanged follow-ups. This does not claim to fix the separate startup convergence report #122321 or reproduce the entire historical beta installation/provider flow.

Review follow-through

The latest completed ClawSweeper review asked for a clean current-main result and refreshed producer/install/uninstall tests. Both are complete. The branch was updated by merging main, preserving the original contributor ancestry, then appending the reviewed correction. The correction retains Co-authored-by: WangYan <[email protected]>. Hosted checks on the final published head remain required before landing.

…producer

readOpenClawManagedNpmRootOverrides returned host pnpm-workspace overrides
without filtering pnpm-only parent-child selectors (parent>child). Those
selectors are invalid npm override keys and trigger EINVALIDTAGNAME before
the retry-based compatibility path can recover, breaking managed npm plugin
installs and the pre-install peer-sync that runs before the retry loop.

Filter pnpm parent-child selectors once at the shared producer so every
managed npm install/uninstall consumer receives a npm-compatible manifest
up front. The existing retry path stays as a fallback for npm alias
compatibility, which is npm-version-dependent.

Fixes openclaw#124426
@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 16, 2026
@clawsweeper

clawsweeper Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 11:16 PM ET / August 27, 2026, 03:16 UTC.

ClawSweeper review

What this changes

The PR filters pnpm-only override selectors before generating managed npm manifests, plans peers using the normalized incoming overrides, and retains a bounded retry for npm alias incompatibility.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

This focused repair remains necessary: current main still passes raw workspace overrides into the managed npm path and plans peers from the persisted manifest, while the PR normalizes that producer input and plans against the resulting manifest. No blocking patch defect was found.

Priority: P2
Reviewed head: 13614a9e072f46bc07f2fe91c8dd7f172053cb2e

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, net-negative owner-boundary repair with credible real npm proof and no actionable correctness finding.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR body contains after-fix real npm 11/12 evidence for the invalid-selector and stale-peer path, with lifecycle scripts disabled and an observed successful result.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body contains after-fix real npm 11/12 evidence for the invalid-selector and stale-peer path, with lifecycle scripts disabled and an observed successful result.
Evidence reviewed 7 items Current-main gap: Current main reads workspace overrides directly, so pnpm-only selector keys reach the managed npm manifest; its peer planner separately begins from the existing manifest.
Producer-side repair: The PR normalizes selectors at the shared override reader, so install and uninstall consumers receive npm-compatible input before manifest generation.
Planner uses incoming state: Peer planning now receives a manifest with managed overrides applied, preventing a retired stored selector from forcing fallback peer pins.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw plugins --help

Result: PASS (completed)

$ node scripts/run-node.mjs plugins --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 109.66 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.7s
node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

[tsdown-build] invocation 2/2 finished in 14.9s
[plugin-control-plane-loads] verified 36 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 4418ms (slowest: built plugin control-plane loads 3663ms)
│
◇

OpenClaw 2026.8.1 (13614a9) — All your chats, one OpenClaw.

Usage: openclaw plugins [options] [command]

Manage OpenClaw plugins and extensions

Options:
  -h, --help   Display help for command

Commands:
  build        Generate simple tool plugin metadata
  disable      Disable a plugin in config
  doctor       Report plugin load issues
  enable       Enable a plugin in config
  init         Create a plugin project
  inspect      Inspect plugin details
  install      Install a plugin or hook pack (path, archive, npm spec, git repo, clawhub:package, or marketplace entry)
  list         List discovered
… output truncated …

Assertions:

  • PASS expect_output: Usage: openclaw plugins

How this fits together

Managed npm plugin installation copies compatible host dependency overrides into a private npm project, plans peer dependencies, then installs or cleans packages. The changed boundary turns workspace override syntax into npm-safe manifest input before either planner or installer consumes it.

flowchart LR
  A[Host workspace overrides] --> B[Managed npm override reader]
  B --> C[Normalize npm-compatible rules]
  C --> D[Peer dependency planner]
  D --> E[Managed npm manifest]
  E --> F[npm install or cleanup]
Loading

Before merge

  • Resolve merge risk (P1) - Managed npm manifests persist override metadata, so this compatibility-sensitive rewrite should land only after the queued exact-head checks confirm fresh-install and existing-root behavior.
  • Resolve merge risk (P1) - The npm parser contract could not be independently reopened locally because no npm source tree is installed and GitHub was unreachable; retain the PR’s recorded real npm 11/12 proof as the dependency evidence.
  • Complete next step (P2) - No repair routing is needed: this PR already owns the focused fix and has no actionable review finding; exact-head validation and normal maintainer landing remain.
Agent review details

Security

None.

PR surface

Source -61, Tests -37, Docs 0. Total -98 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 4 52 113 -61
Tests 3 122 159 -37
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 175 273 -98

Review metrics

Metric Value Why it matters
Owner-boundary LOC runtime +52/-113 (net -61); tests +122/-159 (net -37); docs +1/-1 The repair removes duplicate selector retries and synchronization paths while adding focused coverage for the producer, planner, and uninstall boundary.

Stored data model

Persistent data-model change detected: serialized state: src/infra/npm-managed-root.test.ts, serialized state: src/plugins/uninstall.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #124426
Summary: This PR is the active candidate repair for the managed npm override-selector bug; an earlier merged retry-based mitigation partially overlaps but does not supersede this producer-side fix.

Members:

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

Merge-risk options

Maintainer options:

  1. Complete exact-head compatibility validation (recommended)
    Require the queued checks for the refreshed head to confirm both a fresh managed npm project and an existing project with stored managed override metadata.

Technical review

Best possible solution:

Land the shared producer normalization and incoming-manifest peer planning once exact-head validation is green, preserving npm alias fallback only for npm versions that reject aliases.

Do we have a high-confidence way to reproduce the issue?

Yes—source-reproducible: current main forwards raw workspace overrides and plans peers from the stored manifest, while the supplied before/after npm 11/12 evidence exercises the resulting invalid-selector path.

Is this the best way to solve the issue?

Yes—the shared override producer is the correct boundary, and supplying its normalized result to the peer planner removes the error-text-driven selector retry without dropping the separate alias fallback.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 064b0ddf59d2.

Labels

Label justifications:

  • P2: This is a bounded plugin-install compatibility repair without demonstrated emergency impact on the current stable release.
  • merge-risk: 🚨 compatibility: The change alters persisted managed npm override handling and upgrade behavior for existing plugin projects.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body contains after-fix real npm 11/12 evidence for the invalid-selector and stale-peer path, with lifecycle scripts disabled and an observed successful result.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body contains after-fix real npm 11/12 evidence for the invalid-selector and stale-peer path, with lifecycle scripts disabled and an observed successful result.

Evidence

What I checked:

  • Current-main gap: Current main reads workspace overrides directly, so pnpm-only selector keys reach the managed npm manifest; its peer planner separately begins from the existing manifest. (src/infra/npm-managed-root.ts:321, 064b0ddf59d2)
  • Producer-side repair: The PR normalizes selectors at the shared override reader, so install and uninstall consumers receive npm-compatible input before manifest generation. (src/infra/npm-managed-root.ts:315, 13614a9e072f)
  • Planner uses incoming state: Peer planning now receives a manifest with managed overrides applied, preventing a retired stored selector from forcing fallback peer pins. (src/infra/npm-managed-root.ts:975, 13614a9e072f)
  • Caller and sibling coverage: Install obtains the shared overrides before its initial peer synchronization; uninstall uses the same synchronizer and the tests cover selector normalization, alias retry, and stale-peer pruning. (src/plugins/install-managed-npm.ts:217, 13614a9e072f)
  • History and ownership: The prior merged managed-override retry work is commit ea42a46; current blame attributes the replacement producer and planner lines to the refreshed PR head. (src/infra/npm-managed-root.ts:315, ea42a4612ab3)
  • Release position: The latest stable release commit predates this PR head, and current main does not contain the repair; this is an open, unreleased repair rather than an implemented-on-main close candidate. (0790d9f593ad)

Likely related people:

  • steipete: Authored the prior merged selector-retry work and the refreshed owner-boundary correction. (role: recent area contributor; confidence: high; commits: ea42a4612ab3, 13614a9e072f; files: src/infra/npm-managed-root.ts, src/plugins/install-managed-npm.ts)
  • Vincent Koc: Recent history shows ownership of managed override and peer-removal behavior in this subsystem. (role: adjacent managed-plugin contributor; confidence: medium; commits: 392af654db65, ed0dae17bc9c; files: src/infra/npm-managed-root.ts, src/plugins/uninstall-managed-npm.ts)
  • Alex Knight: Introduced the earlier managed-root override and peer-pin reconciliation layer this repair extends. (role: reconciliation contributor; confidence: medium; commits: 2cafbd07746d; files: src/infra/npm-managed-root.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Let the queued exact-head compatibility checks complete before merge.

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-08-16T10:49:14.905Z sha c043041 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-23T11:05:12.496Z sha c043041 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Aug 23, 2026
@steipete steipete self-assigned this Aug 27, 2026
steipete and others added 2 commits August 26, 2026 20:01
Plan peers against the incoming compatible override set so retired selectors cannot silently retain stale pins. Remove duplicate selector retry and synchronization paths while preserving npm alias compatibility.

Co-authored-by: WangYan <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: M and removed size: S labels Aug 27, 2026
@steipete steipete changed the title fix(plugins): filter pnpm parent-child overrides at managed npm producer fix(plugins): normalize managed npm overrides before peer planning Aug 27, 2026
@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

Preserved the contributor history, merged current main, and appended the reviewed owner-boundary correction at 13614a9e072f46bc07f2fe91c8dd7f172053cb2e. The earlier rank-up request is addressed: clean merged result verified, and all 187 producer/install/uninstall tests passed again. The PR body now includes real npm 11/12 before/after proof, the retained alias contract, production/test LOC, and the corrected explanation of silent stale-peer fallback. No claim is made that an unrelated planner failure always aborts installation. WangYan's coauthor credit is retained.

The change also removes the obsolete selector retry and duplicate synchronization paths. Hosted checks on this final head are still pending.

@clawsweeper

clawsweeper Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Aug 27, 2026
@steipete

Copy link
Copy Markdown
Contributor

Latest ClawSweeper review and rank-up follow-through for 13614a9e072f46bc07f2fe91c8dd7f172053cb2e: the requested exact-head compatibility CI is now green (CI run 33035412926). The final contributor-preserving tree also passed the 187 focused owner/install/uninstall tests locally; it is byte-identical to the tested fixup tree.

Existing-root compatibility is explicitly exercised: a persisted pnpm-only selector is replaced by normalized incoming overrides before peer planning, and the stale managed peer is removed from both manifest metadata and installed packages. Fresh-root normalization, unmanaged overrides, aliases, rollback, and conflict cases remain covered. No SQLite schema or public configuration surface changed. Real offline npm 11.17.0 and 12.0.2 subprocess proof is recorded above; this is not a claim of every historical upgrade path.

I also directly inspected installed npm's @npmcli/arborist/lib/override-set.js (key parsing and alias handling) and npm-package-arg/lib/npa.js (registry/tag parsing), plus pnpm 11.23.0's parent-child selector parser. The pnpm parser uses the same selector delimiter as this repair. No additional dependency-contract defect was found. The latest review contains no actionable patch finding; native preparation and merge verification remain the final landing gates. Original contribution and co-author credit are retained.

@steipete
steipete merged commit e00d46b into openclaw:main Aug 27, 2026
265 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
…penclaw#124532)

* [AI] fix(plugins): filter pnpm parent-child overrides at managed npm producer

readOpenClawManagedNpmRootOverrides returned host pnpm-workspace overrides
without filtering pnpm-only parent-child selectors (parent>child). Those
selectors are invalid npm override keys and trigger EINVALIDTAGNAME before
the retry-based compatibility path can recover, breaking managed npm plugin
installs and the pre-install peer-sync that runs before the retry loop.

Filter pnpm parent-child selectors once at the shared producer so every
managed npm install/uninstall consumer receives a npm-compatible manifest
up front. The existing retry path stays as a fallback for npm alias
compatibility, which is npm-version-dependent.

Fixes openclaw#124426

* fix(plugins): normalize overrides before managed peer planning

Plan peers against the incoming compatible override set so retired selectors cannot silently retain stale pins. Remove duplicate selector retry and synchronization paths while preserving npm alias compatibility.

Co-authored-by: WangYan <[email protected]>

---------

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Managed npm plugin installs ingest pnpm-only parent-child overrides and can fail with EINVALIDTAGNAME

2 participants