Repository navigation
fix(plugins): Windows plugin updates fail when a scanner holds a plugin file - #189451
Conversation
Plugin installs and updates moved the live plugin, the staged install and the rollback backup with fs-safe's copy fallback. On Windows a scanner holding one plugin file turned the rename EPERM into a copy that then failed deleting the held file, so plugin installs and update plugin convergence failed. Plugin install moves now go through movePackageRoot, which on Windows uses the bounded identity-checked rename retries the package swap already uses and reports a publication receipt; other platforms keep the copy fallback.
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: blocked before merge. What this changesThis PR routes plugin installation, backup, and restoration through bounded Windows rename retries. Example: A Windows scanner holds an installed plugin’s dist/index.js open for 4 seconds.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 3 items remain Keep this PR open: the Windows repair is useful, but its new publication path bypasses the existing hardlink rejection policy. Priority: P1 Before merge
Findings
Provenance
Tests
Agent review detailsHow this fits togetherThe package-directory installer prepares plugin and hook packages, publishes them into canonical installation roots, and retains receipts for rollback through the shared filesystem owner. flowchart TD
A[Plugin and hook installers] --> B[Package directory transaction]
B --> C[Shared package filesystem owner]
C --> D[Windows rename retries]
C --> E[Guarded copy fallback]
D --> F[Installed package and backup]
E --> F
Technical reviewBest possible solution: Reuse the existing retry owner while preserving guarded hardlink rejection and inode isolation for generic plugin and hook publication. Do we have a high-confidence way to reproduce the issue? Current-main source and the dependency contract establish the held-file copy-and-unlink failure, corroborated by the author’s native Windows experiment. Is this the best way to solve the issue? Sharing the existing retry owner is appropriate, but its package-manager assumptions must not replace generic installation safety contracts. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e6aa04477b30. Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: Windows publication no longer enforces the caller’s hardlink boundary. EvidenceSecurity concerns:
What I checked:
Likely related people:
PR surfaceSource +12, Tests +42. Total +54 across 4 files. Added test files: 0. View PR surface stats
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 October 31, 2026, 10:39 AM ET / 14:39 UTC. |
|
Merged via squash.
|
…in file (openclaw#189451) * fix(plugins): retry Windows plugin install renames instead of copying Plugin installs and updates moved the live plugin, the staged install and the rollback backup with fs-safe's copy fallback. On Windows a scanner holding one plugin file turned the rename EPERM into a copy that then failed deleting the held file, so plugin installs and update plugin convergence failed. Plugin install moves now go through movePackageRoot, which on Windows uses the bounded identity-checked rename retries the package swap already uses and reports a publication receipt; other platforms keep the copy fallback. * fix(plugins): keep rejected hardlinks on fs-safe's fresh-copy publication Co-authored-by: Peter Steinberger <[email protected]>
Backport #188498 and its explicitly selected #189451 companion from 3140acb and 4f9c852. Preserve retained lifecycle authority, publication receipts, and fresh-copy handling for rejected hardlinks. Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: RomneyDa <[email protected]>
Related: #188498
What Problem This Solves
Fixes: on Windows, updating an npm-installed plugin (including plugin convergence during
openclaw update) fails when an antivirus scanner or indexer briefly holds one file in the installed plugin.User Impact
User impact: Windows updates of npm-installed plugins now wait out a briefly held file instead of failing, and a file that stays held fails cleanly with the old plugin intact and a message naming the next step.
Why This Change Was Made
Plugin installs moved the live plugin, the staged install and the rollback backup with fs-safe's
movePathWithCopyFallback. For the package-manager policy (sourceHardlinks: "allow"), a Windows EPERM on rename makes fs-safe copy the tree and then delete the source, and deleting the held file fails, so the install aborts. #188498 already gave package updates a single owner for these moves (movePackageRoot) with bounded, identity-checked Windows rename retries. Plugin installs now use that helper; it gains an optional rename precondition, the publication receipt, and the caller's hardlink policy.Scope boundary: plugins installed with
sourceHardlinks: "reject"(no runtime dependencies) keep fs-safe's fresh-copy publication on every platform. That policy deliberately never renames, so a hardlink created after a preflight cannot become the published tree; an independent review caught that the first revision of this PR bypassed it. Those installs still fail on a held file, as on main.Production: +46/-32. Tests: +45.
Evidence
Native Windows (Crabbox AWS
cbx_db2ca9c1807f, Windows NT 10.0.26100, Node 24.19.0, secretless, lease released).installPackageDirupdate of a plugin whosedist/index.jswas held open by a PowerShell child with read access and read-only sharing, bundled from main and from this branch:EBUSY ... unlink dist\index.js; old plugin restoredWindows package plugin backup rename failed after 16 attempts ... Close processes holding this installation; old plugin intact, no backup leftAn earlier run on
cbx_39725346b02d(first revision, default policy) showed the same retry timing: 4 s held → updated in 7.8 s, 75 s → clean failure in 58.7 s.Focused tests:
install-package-dir.rollback.test.tsretries a Windows plugin backup rename held by a scanner: transient (installs after 2 denied renames) and persistent (fails after 16 attempts, old plugin intact) fail with main's install code;rejected hardlinkspins that the reject policy never takes the rename path.tsgo:core,tsgo:core:test, type-aware core oxlint and oxfmt clean; test-lines ratchet passes.Reviews on head
7d0176bcd83: Codex autoreview scoped-clean. The independent read-only Codex review of the first revision found the hardlink-policy bypass, fixed here.Gap: installed updaters run the first hop, so users get this on the update after it ships.