Skip to content

refactor: remove dead plugin loader exports - #105937

Merged
steipete merged 32 commits into
mainfrom
codex/delete-dead-plugin-exports
Jul 13, 2026
Merged

steipete merged 32 commits into
mainfrom
codex/delete-dead-plugin-exports

Conversation

@steipete

@steipete steipete commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Related: #105595

What Problem This Solves

The enforced unused-export ratchet still carried roughly 570 src/plugins/ entries, leaving a large amount of dead internal surface and weakening the baseline as an actionable cleanup signal.

Why This Change Was Made

Remove unused plugin-loader exports in coherent ownership groups, keeping implementations local when still used internally and deleting tests that only covered deleted code. Preserve plugin SDK barrels, manifest contracts, dynamic loader/report entry points, and other shipped surfaces; keep the few remaining test-only controls in Knip-ignored core test fixtures.

User Impact

No user-visible behavior change. Maintainers get a substantially smaller dead-export baseline and less accidental internal API surface around plugin loading.

This PR is AI-assisted; the resulting code and contracts were reviewed and validated.

Evidence

  • Production Knip baseline: src/plugins/ entries reduced from 574 to 7 intentional shipped/dynamic contracts; the latest-main-integrated baseline matches 3,540 entries.
  • Immediately before the final push, pnpm deadcode:exports:update (via its pinned Node wrapper) was byte-stable at SHA-256 2dc0d7882ac183644208684b3c9e44eddadeac26b6cbd505c62d30466c91f562; pnpm deadcode:exports matched all 3,540 entries. The same update/check had already passed remotely on AWS Crabbox run run_bc6c3b73ae61 before the final unrelated main-baseline shrink.
  • pnpm check:changed passed all selected format, SDK, type, lint, policy, cycle, database, and Docker scheduler lanes in 13m52s on an earlier exact integrated head.
  • Focused catalog/envelope/index tests: 55/55 passed. The exact-pinned npm integrity-drift regression remains covered through the supported update entry point with a test-local callback fixture; src/plugins/update.test.ts passes 116/116, targeted format passes, and targeted lint reports zero warnings and errors.
  • Isolated real lifecycle proof on the same Testbox: pinned npm install of @openclaw/[email protected]; plugins inspect irc --runtime --json reported activated: true, status: loaded, and the IRC channel capability; update reported the pinned version current; a second runtime inspection remained loaded; uninstall removed the config entry, install record, and installed directory, then inspection confirmed only the bundled disabled fallback with no install record.
  • On the preceding integrated head, pnpm tsgo:core, pnpm tsgo:ui, pnpm tsgo:extensions, the complete pnpm tsgo:test sequence, and pnpm plugin-sdk:surface:check passed on the same Testbox. pnpm build passed on the preceding exact integrated head; hosted CI is the exact final-head gate.
  • Structured autoreview covered the large refactor in coherent chunks; accepted invariant/security findings were fixed. The restored integrity regression received a fresh clean review with 0.96 confidence and no actionable findings.

@steipete
steipete requested a review from a team as a code owner July 13, 2026 03:30
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime cli CLI command changes scripts Repository scripts commands Command implementations agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Jul 13, 2026
@steipete
steipete force-pushed the codex/delete-dead-plugin-exports branch from 21d2317 to 71fd146 Compare July 13, 2026 04:21
@clawsweeper

clawsweeper Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 13, 2026, 3:17 AM ET / 07:17 UTC.

Summary
Removes unused internal plugin-loader exports, moves test-only controls into fixture modules, deletes tests tied to removed exports, and refreshes the enforced dead-export baseline.

Reproducibility: not applicable. This PR is an internal cleanup rather than a reported runtime bug; the actionable concern is directly visible in the current-head deletion of the integrity-drift regression case.

Review metrics: 1 noteworthy metric.

  • Unused plugin export baseline: 574 reduced to 7 intentional entries. This is the core maintenance benefit, but its breadth makes preservation of runtime and security invariants important before merge.

Stored data model
Persistent data-model change detected: durable storage schema: src/plugins/worker-provider-registry.test.ts, durable storage schema: src/plugins/worker-provider-registry.ts, migration/backfill/repair: src/plugins/status.test-fixtures.ts, migration/backfill/repair: src/plugins/status.test-helpers.ts, persistent cache schema: src/plugins/setup-registry.ts, persistent cache schema: src/plugins/tools.test-fixtures.ts, and 10 more. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🦐 gold shrimp
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Restore exact-pinned integrity-drift regression coverage without reviving dead production exports.
  • [P1] Add redacted real plugin install, update, and load proof to the PR body.
  • Resolve or explain the failing production and test type-check jobs.

Proof guidance:

  • [P1] Needs real behavior proof before merge: Only tests, static checks, CI, and build output are supplied; add a redacted terminal or log transcript showing a real plugin install, update, and load cycle after the cleanup. Updating the PR body should trigger review; otherwise ask a maintainer to comment @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] Merging removes the dedicated regression guard for exact-pinned npm artifact integrity drift, allowing later changes to weaken that fail-closed boundary without focused detection.
  • [P1] The broad loader cleanup lacks inspectable real install, update, load, and uninstall proof, leaving packaged-plugin compatibility less certain than the static and mocked validation suggests.
  • [P1] The two failing type-check jobs need log review or a clean rerun before merge, although their status alone does not prove a patch defect.

Maintainer options:

  1. Restore the integrity boundary test (recommended)
    Reintroduce exact-pinned integrity-drift coverage without restoring dead production exports, then provide a real plugin lifecycle transcript before merge.
  2. Accept reduced regression assurance
    A maintainer may intentionally accept the cleanup as submitted, while owning the weaker automated guard around npm artifact integrity drift.

Next step before merge

  • [P1] The protected maintainer label, missing contributor proof, and security-boundary review concern require direct maintainer and contributor handling rather than automated repair intake.

Security
Needs attention: The runtime changes are presented as behavior-preserving, but deleting the exact-pin integrity-drift regression test weakens assurance around a plugin supply-chain boundary.

Review findings

  • [P2] Restore exact-pinned integrity-drift regression coverage — src/plugins/update.test.ts:2985
Review details

Best possible solution:

Retain the internal export cleanup while restoring focused exact-pinned integrity-drift coverage through supported update entry points or test fixtures, then demonstrate an unchanged plugin lifecycle with a redacted real-setup transcript.

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

Not applicable: this PR is an internal cleanup rather than a reported runtime bug; the actionable concern is directly visible in the current-head deletion of the integrity-drift regression case.

Is this the best way to solve the issue?

No, not as currently submitted: removing dead internal exports is appropriate, but the narrowest maintainable solution preserves focused coverage of the integrity-drift invariant and demonstrates unchanged plugin lifecycle behavior.

Full review comments:

  • [P2] Restore exact-pinned integrity-drift regression coverage — src/plugins/update.test.ts:2985
    This deletion removes the focused test proving that an exact-pinned npm plugin update warns and aborts when the fetched artifact integrity changes. Preserve that fail-closed regression coverage through the supported update entry point or a test fixture without re-exporting dead production internals.
    Confidence: 0.94

Overall correctness: patch is incorrect
Overall confidence: 0.84

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P2: This is valuable but non-urgent internal cleanup with a focused regression-coverage blocker and broad plugin-loader blast radius.
  • merge-risk: 🚨 security-boundary: The diff deletes dedicated coverage for fail-closed npm artifact integrity-drift handling during plugin updates.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: Only tests, static checks, CI, and build output are supplied; add a redacted terminal or log transcript showing a real plugin install, update, and load cycle after the cleanup. Updating the PR body should trigger review; otherwise ask a maintainer to comment @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

Security concerns:

  • [medium] Integrity-drift boundary loses focused coverage — src/plugins/update.test.ts:2985
    Exact-pinned plugin updates use stored artifact integrity to detect registry drift and fail closed; removing the dedicated regression case makes accidental weakening of that boundary easier to miss.
    Confidence: 0.93

What I checked:

  • Prior blocker remains on current head: The current-head diff still deletes the focused exact-pinned npm plugin update test that verifies integrity drift warns and aborts by default, so the previous ClawSweeper finding remains unresolved. (src/plugins/update.test.ts:2985, 4166b5ec3458)
  • Security contract represented by deleted test: The removed case exercises updateNpmInstalledPlugins with changed stored package integrity and expects the update to remain unchanged after the continuation callback rejects the drift. (src/plugins/update.test.ts:2985, 4166b5ec3458)
  • Real behavior proof absent: The PR body lists Testbox tests, static checks, type checks, and a build, but provides no inspectable after-fix plugin installation, update, loading, or removal transcript from a real setup. (4166b5ec3458)
  • Dead-export ratchet provenance: Merged pull request ci(deadcode): replace broken export report lanes with enforced knip exports ratchet #105595 introduced the enforced Knip export baseline that motivated this distinct cleanup. (scripts/deadcode-exports.baseline.mjs:1, a425807c31d3)
  • Current check state: The supplied check context shows broad boundary, security, build, lint, and QA jobs passing, while the production and test type-check jobs currently fail without logs establishing whether those failures are branch-caused. (4166b5ec3458)

Likely related people:

  • steipete: Authored the merged dead-export ratchet and has the strongest provided merged history around the enforcement mechanism and affected plugin export cleanup. (role: introduced enforcement and recent area contributor; confidence: high; commits: a425807c31d3; files: scripts/deadcode-exports.baseline.mjs, src/plugins/update.ts, src/plugins/update.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.
Review history (2 earlier review cycles)
  • reviewed 2026-07-13T04:29:23.249Z sha 71fd146 :: needs real behavior proof before merge. :: [P2] Restore exact-pinned plugin integrity-drift coverage
  • reviewed 2026-07-13T05:22:36.936Z sha fc7dfe0 :: needs real behavior proof before merge. :: [P2] Restore exact-pinned plugin integrity-drift coverage

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Jul 13, 2026
@steipete
steipete force-pushed the codex/delete-dead-plugin-exports branch from 71fd146 to fc7dfe0 Compare July 13, 2026 04:48
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jul 13, 2026
@steipete
steipete force-pushed the codex/delete-dead-plugin-exports branch from fc7dfe0 to 475bf7b Compare July 13, 2026 06:32
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 13, 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 repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 13, 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 repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready on eee402cdc9554f5c5752ddee21828233c4d24cf4.

Proof:

  • Immediately pre-push, node scripts/check-deadcode-exports.mjs --update was byte-stable at 3,540 total entries / 7 src/plugins/ entries, SHA-256 2dc0d7882ac183644208684b3c9e44eddadeac26b6cbd505c62d30466c91f562; node scripts/check-deadcode-exports.mjs matched all 3,540 entries. The same production Knip update/check passed remotely on AWS Crabbox run run_bc6c3b73ae61 before the final unrelated seven-entry main shrink.
  • Focused plugin catalog/envelope/index tests passed 55/55. src/plugins/update.test.ts passed 116/116, including restored exact-pinned npm integrity-drift coverage through the supported update entry point.
  • Blacksmith Testbox tbx_01kxd5bw76r3pg69gz5f3ef1es: pnpm check:changed, core/UI/extensions/full-test type lanes, pnpm plugin-sdk:surface:check, and build proof passed on integrated heads.
  • Real isolated lifecycle proof passed for pinned @openclaw/[email protected]: install, runtime activation/inspection, no-op update, second inspection, uninstall, and post-uninstall config/install-record/directory verification.
  • Structured autoreview covered coherent refactor chunks; accepted invariant/security findings were fixed and retested. The restored integrity regression received a fresh clean review (0.96 confidence, no actionable findings).
  • Exact-head hosted CI completed with 86 successes, 28 skips, one neutral, zero failures; the sole cancellation was the non-gating label job.
  • OPENCLAW_TESTBOX=1 scripts/pr prepare-run 105937 passed with prep and PR heads both at eee402cdc9554f5c5752ddee21828233c4d24cf4 (gates_mode=hosted_exact_or_recent_rebase).

Known proof gaps: none.

@steipete
steipete merged commit 98e3f72 into main Jul 13, 2026
115 of 116 checks passed
@steipete
steipete deleted the codex/delete-dead-plugin-exports branch July 13, 2026 08:29
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 14, 2026
* refactor(plugins): trim activation and contract exports

* test(plugins): restore fixture cleanup

* refactor(plugins): trim install and loader exports

* test(plugins): fully reset loader caches

* refactor(plugins): trim metadata and catalog exports

* test(plugins): preserve catalog trust coverage

* refactor(plugins): trim provider and plugin exports

* refactor(plugins): trim runtime and tool exports

* test(plugins): update dead-export consumers

* test(plugins): remove empty dead-export suites

* refactor(plugins): align exports with split registry

* refactor(plugins): trim drifted loader exports

* style(plugins): format test fixtures

* refactor(scripts): use supported plugin APIs

* refactor(plugins): finish dead export cleanup

* chore(deadcode): refresh export baseline

* test(cli): mock production memory state

* chore(deadcode): sync latest export baseline

* fix(tests): keep plugin fixtures inside core

* chore(deadcode): refresh rebased export baseline

* chore(deadcode): sync current ratchets

* fix(plugins): retain reserved slot invariant

* fix(plugins): preserve dead-export invariants

* test(plugins): use neutral catalog query fixture

* test(plugins): satisfy catalog lint

* test(plugins): preserve integrity drift coverage

* fix(ci): register skill experience live proof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling cli CLI command changes commands Command implementations gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant