Repository navigation
fix: prevent EALLOWSCRIPTS failures during plugin repair - #200786
Conversation
Co-authored-by: steipete <[email protected]>
|
🦞👀 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: needs maintainer review before merge. What this changesClear 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.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete 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 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherManaged 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]
Technical reviewBest 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
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +1, Tests +36. Total +37 across 3 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 17, 2026, 3:33 PM ET / 20:33 UTC. |
|
Merged via squash.
|
…openclaw#200786) Co-authored-by: steipete <[email protected]>
…#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]>
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)
* 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)
…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)
…#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)
…#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)
Fixes #200773
What Problem This Solves
After a global npm update,
openclaw doctor --fixcan fail to reinstall managed plugins withEALLOWSCRIPTS. An inheritednpm_config_allow_scripts=openclawreaches 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
createSafeNpmInstallEnvand its realcreateNpmProjectInstallEnvowner. 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=openclawfor both supported flagged policies.ea94eb3bd38e29d17df08a957a08fa2866355110before editing production: 142 passed, 3 failed; all three failures were the new real-npmEALLOWSCRIPTScases.git diff --check: passed.pr-simplify: existing owner retained; +1 production line and +36 net test lines.344f190ea0beda463bc6ca942fd28852bd25651f.Source audit and focused commands
The main/base reset set at
npm-install-env.ts:19omits allow-scripts; its case-insensitive deletion at line 337 therefore preserves the inherited value.safe-package-install.ts:29composes 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 atsrc/infra/npm-managed-root.ts:644,808, package-directory installation atsrc/infra/install-package-dir.ts:529, and Git plugin installation atsrc/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.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.