Skip to content

fix: prevent EALLOWSCRIPTS failures during plugin repair - #200786

Merged
roboclaw-bot merged 1 commit into
mainfrom
roboclaw/ur-200773
Nov 17, 2026
Merged

roboclaw-bot merged 1 commit into
mainfrom
roboclaw/ur-200773

Conversation

@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Fixes #200773

What Problem This Solves

After a global npm update, openclaw doctor --fix can fail to reinstall managed plugins with EALLOWSCRIPTS. An inherited npm_config_allow_scripts=openclaw reaches the project-scoped install, where npm rejects it even with --ignore-scripts.

User Impact

Managed plugin installs and Doctor repairs can complete when this global-install setting is inherited. Lifecycle scripts remain disabled, and global core installs retain their existing allow-scripts behavior. No migration or operator configuration change is required.

Why This Change Was Made

Add the inherited setting to the shared project-install environment reset set. Its existing case-insensitive reset covers lowercase, uppercase, and mixed-case keys for every safe-install caller. The fix adds one production line, without npm-version detection or another policy owner.

The candidate performing plugin installation or Doctor repair must contain this fix; it does not change an already-running older installer. Existing managed plugin projects are preserved.

Evidence

Real npm reproduces the reported error through createSafeNpmInstallEnv and its real createNpmProjectInstallEnv owner. With the fix, each casing installs successfully, writes its lockfile, and leaves the preinstall/install/postinstall marker absent. The sibling global-install test retains --allow-scripts=openclaw for both supported flagged policies.

  • Verified on main/base ea94eb3bd38e29d17df08a957a08fa2866355110 before editing production: 142 passed, 3 failed; all three failures were the new real-npm EALLOWSCRIPTS cases.
  • Same six named files with the fix: 145 passed, 0 failed, 6 files. Every case passing on the base remained green.
  • Touched-file type-aware oxlint, oxfmt check, and git diff --check: passed.
  • pr-simplify: existing owner retained; +1 production line and +36 net test lines.
  • Independent Codex autoreview, local candidate against the base above, P0–P3, complete env-owner and fixture context: scoped-clean, no findings. The reviewed candidate is committed as 344f190ea0beda463bc6ca942fd28852bd25651f.
  • Named-run wall time: 70.91s including worker preparation; Vitest duration 29.67s. Changed test files: safe-package-install 2.150s and update-global-lifecycle 0.134s. CI timings pending.
Source audit and focused commands

The main/base reset set at npm-install-env.ts:19 omits allow-scripts; its case-insensitive deletion at line 337 therefore preserves the inherited value. safe-package-install.ts:29 composes that owner with script-disabled installation.

Inherited environments reach managed plugin installation at src/plugins/install-managed-npm.ts:294, peer planning and host-peer repair at src/infra/npm-managed-root.ts:644,808, package-directory installation at src/infra/install-package-dir.ts:529, and Git plugin installation at src/plugins/git-install.ts:355. Plugin uninstalls also consume the same safe environment. No project-install allow-scripts CLI flag or OpenClaw-written allow-scripts npmrc entry was found. Managed npmrc inputs are copied unchanged (src/plugins/install-managed-npm-state.ts:34, src/infra/npm-managed-root.ts:615); package-directory installation temporarily hides its staged npmrc. The separate native prebuild repair already strips this inherited setting (scripts/lib/fs-safe-prebuild.mjs:206).

Explicit allow-scripts flags belong to the global core path (src/infra/update-global.ts:214,1144, scripts/install-policy.sh:279, scripts/install.ps1:1822). Those paths are unchanged.

OPENCLAW_VITEST_RUNTIME=node OPENCLAW_TEST_PROJECTS_SERIAL=1 \
OPENCLAW_NODE_TEST_PLAN_CONTINUE_ON_FAILURE=1 timeout 240s pnpm test \
  src/infra/npm-install-env.test.ts src/infra/safe-package-install.test.ts \
  src/infra/npm-managed-root.test.ts src/infra/install-package-dir.test.ts \
  src/plugins/install.npm-spec.test.ts src/infra/update-global-lifecycle.test.ts \
  --maxWorkers=1 --reporter=default

timeout 120s pnpm exec oxlint --type-aware --type-check --threads=1 \
  --tsconfig config/tsconfig/oxlint.core.json \
  src/infra/npm-install-env.ts src/infra/safe-package-install.test.ts \
  src/infra/update-global-lifecycle.test.ts

timeout 30s pnpm exec oxfmt --check src/infra/npm-install-env.ts \
  src/infra/safe-package-install.test.ts src/infra/update-global-lifecycle.test.ts

Limits: real-npm proof uses the repository-pinned npm 12.2.1 on Linux with Node 26.12.1. The reporter's parent environment, exact macOS/npm 11.17 combination, and a full Doctor upgrade flow remain unverified. The named install.npm-spec suite mocks npm execution; the regression above executes real npm at the shared environment boundary. No Gateway e2e, upgrade matrix, or check:changed run was performed; broader proof is left to PR CI as requested.

Reported by @cbhawthorne84

Work sessions

Linked for team reference; these sessions aren’t public.

@clawsweeper

clawsweeper Bot commented Nov 17, 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 clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 17, 2026
@clawsweeper

clawsweeper Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Clear inherited npm allow-scripts settings from project-install environments while preserving script-disabled plugin installation.

Example: Doctor installs a managed plugin while inheriting npm_config_allow_scripts=openclaw.

  • Before: npm rejects the project-scoped install with EALLOWSCRIPTS.
  • After: The incompatible environment setting is removed and installation proceeds with lifecycle scripts disabled.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The patch is narrow and source-correct, with useful real-npm regression coverage, but required shipped-entry-point proof remains absent.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Managed plugin installation and Doctor repair fail when a global npm lifecycle policy leaks into project-scoped installation.
Reason: The maintainer-authored change restores the documented script-disabled installation contract without adding configuration or disturbing managed projects.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR makes a focused, correct repair for a current plugin-install failure; no introduced code defect was found.

Priority: P1
Reviewed head: 344f190ea0beda463bc6ca942fd28852bd25651f

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Supply redacted terminal output or logs of candidate Doctor repairing managed plugins after a latest-stable upgrade with inherited allow-scripts, confirming plugin usability and preserved settings and managed projects.
Agent review details

How this fits together

Managed plugin operations pass their inherited environment through the shared npm environment owner before invoking npm in a project directory.

flowchart TD
 A[Doctor or plugin command] --> B[Managed plugin installer]
 B --> C[Safe npm environment]
 C --> D[Project environment reset]
 D --> E[npm project install]
 E --> F[Managed plugin project]
Loading

Technical review

Best possible solution:

Retain the one-line repair in the shared environment owner, keeping plugin scripts disabled and global core-install policy unchanged.

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

The inherited variable survives current-main environment preparation and reaches npm's deterministic project-scope rejection; the PR additionally reports a red-base/green-head real-npm regression, which this read-only review did not execute.

Is this the best way to solve the issue?

This is the smallest complete fix: extend the existing case-insensitive reset rather than adding version detection, caller-specific policy, or another installation path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0b1c20f3acc0.

Provenance checked

  • Shared project-install environment keeps the original intent (cbe5515: The original owner forced dependency installation into local project scope and removed inherited global-install settings.)
  • Global installation lifecycle policy keeps the original intent (fix(install): npm 12 local archives and unpublished plugin validation #136316: Global installs retain the correct npm lifecycle identity for package archives; this PR changes only coverage for the two flagged policies.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit cbe5515 adds src/infra/npm-install-env.ts:17 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: cbe5515b70ab; files: src/infra/npm-install-env.ts)

PR surface

Source +1, Tests +36. Total +37 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 1 0 +1
Tests 2 43 7 +36
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 44 7 +37

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P1: The linked official-release report establishes broken managed plugin installation and Doctor repair in an existing operator workflow.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P1: The linked official-release report establishes broken managed plugin installation and Doctor repair in an existing operator workflow.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 17, 2026, 3:33 PM ET / 20:33 UTC.

@roboclaw-bot
roboclaw-bot merged commit 9107009 into main Nov 17, 2026
132 checks passed
@roboclaw-bot
roboclaw-bot deleted the roboclaw/ur-200773 branch November 17, 2026 20:37
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 18, 2026
RomneyDa added a commit that referenced this pull request Nov 18, 2026
…#200786)

Backport the project-local script policy fix while retaining explicit global-install policy. Real npm regressions fail with EALLOWSCRIPTS before the fix and pass without running lifecycle scripts afterward.

(cherry picked from commit 9107009)

Co-authored-by: steipete <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 19, 2026
Co-authored-by: Peter Steinberger <[email protected]>
(cherry picked from commit 350c9f1)

Release adaptation: none. Companion disposition: #200659 projects cold archive payloads and #200733 preserves missing payload warnings; #200662 retains the stable 11.5 upgrade bridge; #200786 keeps controlled npm install environment.

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 67c71dddf43d6e4ebd6e45d438706ece0742bba6)
RomneyDa added a commit that referenced this pull request Nov 19, 2026
* fix(update): include cold archives in candidate snapshots

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

* fix(update): preserve file archives in rehearsal snapshots

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

* fix(update): preserve source WAL state during archive inventory

Classify cold archive SQL under its existing candidate-state subprocess owner. Preserve incomplete WAL source families so header inspection retains private cleanup custody.

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

---------

Co-authored-by: steipete <[email protected]>
(cherry picked from commit 802e3f7)

Release adaptation: none. Companion disposition: #200659 projects cold archive payloads and #200733 preserves missing payload warnings; #200662 retains the stable 11.5 upgrade bridge; #200786 keeps controlled npm install environment.

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 7384191252d0eb5c3add0e64ff9402d4afa55886)
RomneyDa added a commit that referenced this pull request Nov 19, 2026
…200733)

One archived (cold) transcript file that was already missing from live state no longer blocks every update: the rehearsal snapshot keeps it missing, reports a warning, and only a Doctor repair that reads that archive fails, as it would on live state. Dangling or unreachable links count as missing. On Windows the rehearsal always copies archives instead of hard-linking them, because removing a hard link on a filesystem without POSIX delete (for example an SMB share) clears the live file's read-only attribute.

Follow-up to #200659. Refs #200594.

Proof: 11.4 -> main with one missing archive refused at snapshot inventory (ENOENT); 11.4 -> fix succeeded over CLI and managed update.run with the warning. Native Windows Server 2025 probe confirmed the SMB read-only attribute loss through a hard link and none with a copy.
Co-authored-by: Peter Steinberger <[email protected]>
(cherry picked from commit 427c857)

Release adaptation: none. Companion disposition: #200659 projects cold archive payloads and #200733 preserves missing payload warnings; #200662 retains the stable 11.5 upgrade bridge; #200786 keeps controlled npm install environment.

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit badc5c39bc62a5573ab1f8d73a5233cd0b85a3a4)
RomneyDa added a commit that referenced this pull request Nov 19, 2026
…#200786)

Co-authored-by: steipete <[email protected]>
(cherry picked from commit 9107009)

Release adaptation: none. Companion disposition: #200659 projects cold archive payloads and #200733 preserves missing payload warnings; #200662 retains the stable 11.5 upgrade bridge; #200786 keeps controlled npm install environment.

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit fc54a13ecebe318ca0126947193bb66700018d2f)
tideclaw-bot added a commit that referenced this pull request Nov 24, 2026
…#200786)

Baseline adaptation: Keep the shared project-local environment reset; exercise the installed npm against a synthetic local manifest under .33 test helpers. No lifecycle scripts execute.

(cherry picked from commit 9107009)

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit bd7880c33d27aaa7998163a571894ae23fff0283)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S 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.

[Bug]: Plugin installs fail with npm EALLOWSCRIPTS "--allow-scripts is not allowed in project-scoped installs" (2026.11.5, macOS)

1 participant