Skip to content

refactor(plugins): centralize admission preparation - #138768

Merged
steipete merged 1 commit into
mainfrom
codex/plugin-admission-preparation-20260904
Sep 6, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/plugin-admission-preparation-20260904

Conversation

@steipete

@steipete steipete commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Runtime plugin loading and CLI metadata loading separately prepared the same admission facts, leaving two places to keep activation, enablement, duplicate diagnostics and manifest details aligned. This continues the maintainer-requested cleanup already proposed in this PR, not a newly reproduced user defect or a new feature request.

Why This Change Was Made

Centralize scoped admission preparation in the shared loader while keeping runtime and CLI import/registration policy distinct. Remove the dormant private required-setup option now that read-only channel discovery owns direct setup loading. Preserve independent activation provenance and enablement, manifest trust and control UI metadata, capability catalog behavior, and source-root channel policy during normalized config reuse.

The refreshed candidate also preserves main's consolidated recordPluginError owner: validation errors retain their existing classification, while load errors can carry SDK seam/version/build diagnostics. The two actual rebase conflicts were import blocks; obsolete validation helpers were not restored.

Production code decreases by 65 lines (+122/-187); tests change by +293/-44 across four files. No configuration, dependency, persistence, public CLI or plugin SDK contract change is intended by this refactor.

User Impact

No intentional user-visible behavior change. Plugin loading and inspection retain their policy boundaries, with one shared owner for common preparation. No upgrade or operator action is required.

Current Candidate Evidence

Candidate 1e15198412e4cb25e473624c1a7a77e6270307ef has raw parent 5650fe2abc1ae54143aad2e41735396ae1f55331 and tree 4bd3dd5fdd13c08879a354bb559d217a25bbc670. The normal frozen dependency installation completed against that parent graph. One normal six-file focused run passed 123 tests, including the four changed tests and current error-recording/SDK-diagnostic sibling cases. The normal configured Linux changed-file gate passed all 30 checks with source/receiver identity and lease cleanup verified.

The normal full build on the clean signed candidate completed all 16 phases: 15 ran and CLI startup metadata was restored through its normal cache path and refreshed. Build information and both stamps identify 1e15198412e4.

Three serial built CLI observations passed in a new isolated profile: snapshot inspection remained metadata-only, runtime inspection imported and registered memory-core without diagnostics, and memory help printed the current build and command tree. Snapshot and runtime schema, UI hints, contracts, trust and activation metadata matched. Registration is not execution: no Gateway, provider or memory operation was invoked. Real profile initialization was recorded and retained, rather than described as having no filesystem effects.

The resolved composition and the separate exact signed commit each received canonical P2 static review with no actionable findings in two partitioned passes. The exact-commit passes returned confidence 0.82 and 0.86, with aggregate scoped-clean confidence 0.82. The first pass explicitly limits its assessment to its supplied batch; this is not a claim that either pass saw the entire packet together. Reviewers treated the tests/builds as author evidence and did not independently execute project code.

Historical Evidence and Review Context

The earlier 04ea328f900 candidate on the older base passed 200 nonoverlapping tests, a full build, three operator observations, changed checks, and precommit/exact-commit P2 reviews. Those executions remain historical; the current 123-test run is not presented as a replay of all 200. The original b8a208ede254 candidate's comparison/replay evidence also remains historical. The original loader timeout's cause remains unknown; recovered runs used different canonical cache routes.

The earlier review's data-model compatibility item concerned the removed setup-option cache-key dimension in loader-load-context.ts. Its owner is the process-local PluginLoaderCacheState LRU and in-flight sets, not a persisted schema. The option had no remaining caller. Removing its constant default key component changes transient cache identities, not a database, stored record, migration or upgrade reader; no data migration is applicable.

ClawSweeper's September 6 review of 04ea328f900 withdrew the migration concern and reported no patch findings. Its remaining integration item is addressed by the pinned rebase composition, current validation and separate exact-commit review described above. The ready transition still requires a fresh positive GitHub mergeability check. Hosted exact-head CI and repo-native landing remain separate gates; neither is claimed complete by the local proof.

@clawsweeper

clawsweeper Bot commented Sep 5, 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: L maintainer Maintainer-authored PR labels Sep 5, 2026
@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 5, 2026
@clawsweeper

clawsweeper Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 5:25 AM ET / 09:25 UTC.

ClawSweeper review

What this changes

Centralizes common plugin loading preparation for runtime and CLI inspection, removes an unused internal setup option, and expands coverage for preserved loading policies.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-requested cleanup remains distinct from current main, and no introduced correctness or security defect was found. The prior migration concern does not apply to the process-local cache.

Priority: P3
Reviewed head: 1e15198412e4cb25e473624c1a7a77e6270307ef

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused simplification with meaningful boundary coverage, reported build validation, and no actionable introduced defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored refactor is exempt from the external-contributor gate and introduces no material authority change. Its body reports isolated built-CLI snapshot and runtime inspections exercising loader preparation and memory-core registration; help output is supplemental, and no Gateway or memory operation is claimed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored refactor is exempt from the external-contributor gate and introduces no material authority change. Its body reports isolated built-CLI snapshot and runtime inspections exercising loader preparation and memory-core registration; help output is supplemental, and no Gateway or memory operation is claimed.
Evidence reviewed 9 items Introduced preparation preserves existing decisions: The complete introduced diff moves scope filtering, activation provenance, duplicate handling, independent enablement, and manifest record details into one helper without changing their inputs or ordering.
Removed option has no calling surface: The parent-tree search finds the required-setup option only in its declaration, context plumbing, cache identity, and implementation branches; no caller enables it. Read-only channel discovery independently requires setupSource before importing an external setup entry.
Cache removal has no persisted-format impact: PluginLoaderCacheState owns process-local LRU registries and in-flight sets; PluginLruCache stores entries in a Map. Removing the dormant cache-key dimension does not change stored user data or require migration.
Findings None None.
Security None None.

How this fits together

OpenClaw's plugin loader combines discovered manifests with configuration to decide which plugins may load. Runtime and CLI loaders consume those decisions to produce capability registries, command metadata, and diagnostics.

flowchart TD
  A[Plugin manifests] --> C[Shared loading preparation]
  B[Configuration and requested scope] --> C
  C --> D[Scope and enablement decisions]
  D --> E[Runtime loader]
  D --> F[CLI metadata loader]
  E --> G[Capabilities and diagnostics]
  F --> H[Commands and diagnostics]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -65, Tests +249. Total +184 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 6 122 187 -65
Tests 4 293 44 +249
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 415 231 +184

Review metrics

Metric Value Why it matters
Production simplification versus coverage Production net -65 lines; tests net +249 lines Shared preparation reduces production duplication while added coverage checks policy decisions through the two loader entrypoints.

Technical review

Best possible solution:

Keep one shared preparation owner while preserving each loader's existing import, trust, validation, and registration policy.

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

Not applicable: this is a behavior-preserving refactor, not a reported user defect; no introduced failure was established by source review.

Is this the best way to solve the issue?

Yes: extracting the identical preparation logic removes competing maintenance points while leaving runtime and CLI registration policies with their existing owners.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is bounded internal cleanup with no intended user-visible behavior change.
  • 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 MEMBER-authored refactor is exempt from the external-contributor gate and introduces no material authority change. Its body reports isolated built-CLI snapshot and runtime inspections exercising loader preparation and memory-core registration; help output is supplemental, and no Gateway or memory operation is claimed.

Evidence

What I checked:

  • Introduced preparation preserves existing decisions: The complete introduced diff moves scope filtering, activation provenance, duplicate handling, independent enablement, and manifest record details into one helper without changing their inputs or ordering. (src/plugins/loader-shared.ts:324, 1e15198412e4)
  • Removed option has no calling surface: The parent-tree search finds the required-setup option only in its declaration, context plumbing, cache identity, and implementation branches; no caller enables it. Read-only channel discovery independently requires setupSource before importing an external setup entry. (src/channels/plugins/read-only.ts:737, 5650fe2abc1a)
  • Cache removal has no persisted-format impact: PluginLoaderCacheState owns process-local LRU registries and in-flight sets; PluginLruCache stores entries in a Map. Removing the dormant cache-key dimension does not change stored user data or require migration. (src/plugins/plugin-cache-primitives.ts:7, 1e15198412e4)
  • Current main still contains separate preparation: The fetched main CLI loader still prepares activation, duplicates, enablement, and manifest details inline. The branch's central cleanup is therefore not already implemented there; no verified replacement PR was supplied. (src/plugins/loader-cli-registry.ts:106, d1c77cb7d892)
  • Verified merge composition: Raw test-merge parents are the pinned base followed by the exact PR head. All ten changed files are byte-identical between that merge result and the reviewed head, supporting the resolution of the previous integration concern. (7a7c015d5d10)
  • Behavioral contract coverage: Added cases exercise both loader entrypoints, command registration and invocation, rejected imports, activation-versus-enablement separation, and setup-entry selection. The workspace test also covers trusted, untrusted, denied, and unconfigured discovery. (src/plugins/loader.cli-metadata.test.ts:32, 1e15198412e4)

Likely related people:

  • Peter Steinberger: 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 (3 earlier review cycles)
  • reviewed 2026-09-05T02:54:54.468Z sha b8a208e :: blocked before merge. :: none
  • reviewed 2026-09-06T06:07:33.371Z sha 04ea328 :: blocked before merge. :: none
  • reviewed 2026-09-06T09:16:10.448Z sha 1e15198 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/plugin-admission-preparation-20260904 branch from b8a208e to 04ea328 Compare September 6, 2026 06:00
Share scoped activation, enablement, registration planning and manifest-record preparation between runtime and CLI metadata loading while retaining their distinct entrypoint policies.

Retire the private required-setup option left behind when read-only channel loading moved to per-manifest setupSource guards. Keep manifest-record construction private and cover build-version normalization through the preparation owner.

Preserve activation reasons independently of enablement, scope-before-import behavior, setup trust boundaries, manifest trust and control UI metadata, and source-root channel policy during normalized config reuse. No public CLI, plugin SDK, configuration, dependency or persistence contract changes.
@steipete
steipete force-pushed the codex/plugin-admission-preparation-20260904 branch from 04ea328 to 1e15198 Compare September 6, 2026 09:07
@steipete
steipete marked this pull request as ready for review September 6, 2026 09:09
@steipete steipete closed this Sep 6, 2026
@steipete steipete reopened this Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: applying reviewed decision.

I am applying the reviewed decision for this pull request: refactor(plugins): centralize admission preparation This is item 1/1 in the current shard. Shard 1/1.

This transient lease prevents a newer review from overlapping label, comment, or close mutations.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete
steipete merged commit f66dc27 into main Sep 6, 2026
257 checks passed
@steipete
steipete deleted the codex/plugin-admission-preparation-20260904 branch September 6, 2026 09:36
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 7, 2026
Share scoped activation, enablement, registration planning and manifest-record preparation between runtime and CLI metadata loading while retaining their distinct entrypoint policies.

Retire the private required-setup option left behind when read-only channel loading moved to per-manifest setupSource guards. Keep manifest-record construction private and cover build-version normalization through the preparation owner.

Preserve activation reasons independently of enablement, scope-before-import behavior, setup trust boundaries, manifest trust and control UI metadata, and source-root channel policy during normalized config reuse. No public CLI, plugin SDK, configuration, dependency or persistence contract changes.
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: L 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