Skip to content

refactor(plugins): centralize managed npm install planning - #139788

Merged
steipete merged 1 commit into
mainfrom
codex/plugin-install-owner-refactor
Sep 6, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/plugin-install-owner-refactor

Conversation

@steipete

@steipete steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Registry installs, npm-pack archives, and managed npm installation repeated the same generation and policy decisions. An update into a new directory or reinstallation of a retained artifact needs consistent policy across those paths.

Why This Change Was Made

One managed npm install planner now returns the artifact roots, filesystem operation mode, and policy mode for all three callers. The generation owner also reuses its existing decision instead of calculating it twice.

User Impact

Install/update behavior, retained-file protection, rollback, corruption quarantine, and Gateway restart behavior remain unchanged. This independent preparation for #135599 removes 43 production lines across four files.

Evidence

All 210 existing installer tests passed, including generated policy scripts, npm-pack installation, retained lazy imports, rollback, and quarantine. The 11 generation/mode cases passed again after the final simplification. Production and test typechecks, formatting, boundary/ratchet/dead-export guards, final typed lint, and independent P2 review passed. No tests were weakened or added to mirror the implementation.

@clawsweeper

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

@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Sep 6, 2026
@steipete
steipete marked this pull request as ready for review September 6, 2026 05:24
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 2:18 AM ET / 06:18 UTC.

ClawSweeper review

What this changes

Centralizes npm plugin installation planning so registry installs, packed archives, and managed installation share directory selection and install/update policy decisions.

Merge readiness

✅ Ready for maintainer review

Keep open: this is a useful, bounded consolidation that remains absent from the reviewed main branch. No introduced correctness defect was found, and the maintainer-authored contribution is protected from cleanup closure.

Priority: P3
Reviewed head: bd55b149f0c110d1fee600187ff2a1268c0725c8

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused consolidation with existing behavioral coverage and no supported blocking finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied MEMBER author classification exempts this internal refactor from the external-contributor proof gate; reported installer tests are supplemental validation, and no material authority change triggers additional proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied MEMBER author classification exempts this internal refactor from the external-contributor proof gate; reported installer tests are supplemental validation, and no material authority change triggers additional proof.
Evidence reviewed 7 items Planner preserves mode distinctions: The planner retains update policy for new update generations and install policy for retained-artifact reactivation. Returning generationUse replaces an equivalent final conditional.
Installation and policy consumers: Managed installation consumes targetMode for target availability and policyMode for preflight and artifact checks. Registry and archive callers consume the same policy calculation; retained-root redirection remains in the existing root owner.
Existing behavioral coverage: Existing tests cover update requests without installed targets, unrelated similarly named projects, updates into new generations, and retained-generation reactivation subject to fresh-install policy. These were inspected, not executed; the PR body separately reports 210 passing installer tests.
Findings None None.
Security None None.

How this fits together

The plugin installer takes an npm package or packed archive and selects where its files should live. Its plan feeds policy checks and installation while preserving retained files that running processes may still need.

flowchart TD
  A[Registry package] --> C[Shared installation planner]
  B[Packed archive] --> C
  D[Existing and retained plugin files] --> C
  C --> E[Directory and operation mode]
  C --> F[Install or update policy]
  F --> G[Policy checks and managed installation]
  E --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -43. Total -43 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 4 49 92 -43
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 49 92 -43

Review metrics

None.

Technical review

Best possible solution:

Keep one internal planner for directory and policy decisions while preserving retained-artifact isolation and existing installation contracts.

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

Not applicable: this is a refactor rather than a reported runtime defect; source and existing behavioral tests were inspected without executing tests.

Is this the best way to solve the issue?

Yes: consolidating the existing decisions at their shared owner removes duplication without adding a public plugin API or changing the preserved mode rules.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is internal consolidation with preserved user-facing installation behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied MEMBER author classification exempts this internal refactor from the external-contributor proof gate; reported installer tests are supplemental validation, and no material authority change triggers additional proof.

Evidence

What I checked:

  • Planner preserves mode distinctions: The planner retains update policy for new update generations and install policy for retained-artifact reactivation. Returning generationUse replaces an equivalent final conditional. (src/plugins/install-managed-npm-state.ts:623, bd55b149f0c1)
  • Installation and policy consumers: Managed installation consumes targetMode for target availability and policyMode for preflight and artifact checks. Registry and archive callers consume the same policy calculation; retained-root redirection remains in the existing root owner. (src/plugins/install-managed-npm.ts:110, bd55b149f0c1)
  • Existing behavioral coverage: Existing tests cover update requests without installed targets, unrelated similarly named projects, updates into new generations, and retained-generation reactivation subject to fresh-install policy. These were inspected, not executed; the PR body separately reports 210 passing installer tests. (src/plugins/install.test.ts:2560, bd55b149f0c1)
  • Current-main necessity and merge scope: The pinned main still contains duplicated planning in the registry caller. No changes to the four touched files occurred between merge base and pinned main. The verified test merge has the pinned main and head parents and changes only those four files. (src/plugins/install-npm.ts:186, e19a7694cef6)
  • Release comparison: The latest supplied release still exposes the older generation-selection helper; this consolidation is not established as shipped. (src/plugins/install-managed-npm-state.ts:623, 3928bad9badf)
  • Related work and review continuity: The supplied discussion identifies this as independent preparation for feat: manage and reload plugins without restarting the Gateway #135599, whose body explicitly describes splitting the broader feature. The previous completed review retained no findings. Its earlier head could not be loaded locally, so no patch-equivalence claim is made. (bd55b149f0c1)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • wangyan2026: 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 (1 earlier review cycle)
  • reviewed 2026-09-06T05:51:19.982Z sha 836d628273cb10f7c2b0e2d6c0371eccfbdfce61 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/plugin-install-owner-refactor branch from 836d628 to bd55b14 Compare September 6, 2026 06:12
@steipete
steipete merged commit f2ba793 into main Sep 6, 2026
173 checks passed
@steipete
steipete deleted the codex/plugin-install-owner-refactor branch September 6, 2026 07:01
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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.

1 participant