Skip to content

fix(plugins): prevent bundled discovery loss and out-of-scope activation - #114547

Merged
steipete merged 8 commits into
mainfrom
codex/ambitious-canonical-plugin-graph-87b76d0c
Jul 27, 2026
Merged

steipete merged 8 commits into
mainfrom
codex/ambitious-canonical-plugin-graph-87b76d0c

Conversation

@steipete

@steipete steipete commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where fresh or newly repaired OpenClaw installs could lose their bundled plugins during registry bootstrap, while explicitly scoped plugin requests could rediscover or activate unrelated installed plugins. Repeated control-plane lookups also retained multiple historical plugin registry graphs instead of one process-stable snapshot.

Why This Change Was Made

Derive bootstrap metadata from the same manifest-backed installed-plugin index used by persisted registries, make resolved empty indexes authoritative, preserve requested plugin scopes before activation, and publish only complete unscoped metadata to the process-wide registry. Replace the historical registry LRU with one lifecycle-owned immutable graph without changing plugin manifests, SDK exports, database schemas, configuration, protocol versions, dependencies, or plugin ownership.

User Impact

Fresh installs continue to discover their bundled plugins; registry refresh keeps the same installed plugin inventory; disabled or empty plugin scopes stay empty; single-plugin requests do not load unrelated plugin owners or corrupt process-wide model/provider metadata. Production code decreases by 22 lines.

Evidence

  • Blacksmith Testbox tbx_01kyhmqhparwmrc2jpe84hekta: 326 passing focused tests across 12 plugin, index, manifest, discovery, runtime, activation, loader, and Plugin SDK test files.
  • Full Plugin SDK public surface gate: 316 total SDK entrypoints, 143 public package entrypoints, zero forbidden package-exported subpaths.
  • Changed-files gate passed, including production/test type checks, formatting, plugin ownership boundaries, runtime import cycles, and database/schema guards.
  • Production pnpm build and canonical self-contained package tarball integrity check passed.
  • Installed the actual package with npm into an isolated prefix and state directory. The installed OpenClaw CLI discovered 75 bundled plugins on first run, refreshed its persisted plugin registry, and rediscovered the same 75 plugin IDs afterward.
  • Regression coverage separately proves absent-registry bootstrap, authoritative persisted empty indexes, owner and empty activation scopes, current-graph isolation, and lifecycle cache replacement.
  • Independent Codex gpt-5.6-sol review at xhigh reasoning: no accepted or actionable findings after fixing the two confirmed scoped/bootstrap defects.

AI-assisted: implementation and verification performed with Codex; no agent prompts, private logs, or transcripts are included.

@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels Jul 27, 2026
@steipete
steipete marked this pull request as ready for review July 27, 2026 11:44
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels Jul 27, 2026
@clawsweeper

clawsweeper Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 27, 2026, 9:42 AM ET / 13:42 UTC.

ClawSweeper review

What this changes

The PR makes plugin metadata bootstrap use the installed-plugin index, preserves explicit plugin activation scopes, and replaces a multi-entry registry cache with one current process-wide metadata graph.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep this PR open for explicit maintainer review. The supplied branch evidence shows a focused repair for plugin discovery, scoped activation, and process-current metadata, but the protected maintainer label and the compatibility-sensitive shared registry change require an owner to confirm the intended lifecycle contract before merge.

Priority: P2
Reviewed head: e2e92548ebcdd3e1a166a25eab602197d8ee2f92
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The PR has strong claimed installed-package proof and focused regression coverage, with the remaining merge gate being owner confirmation of the shared metadata publication contract.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body reports an after-fix isolated installation of the actual package and CLI, including first-run discovery and post-refresh rediscovery of the same 75 bundled plugin IDs.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body reports an after-fix isolated installation of the actual package and CLI, including first-run discovery and post-refresh rediscovery of the same 75 bundled plugin IDs.
Evidence reviewed 5 items Protected maintainer review gate: The PR carries the maintainer label. Repository policy requires maintainer-authored handling rather than automated cleanup or closure for protected-label items.
Scoped activation propagation: The supplied diff adds onlyPluginIds to the runtime load context and forwards it into current-snapshot lookup and metadata loading, addressing explicit empty and owner-only scopes rather than re-discovering unrelated plugins.
Lifecycle cache invalidation: The supplied diff makes registry invalidation clear the published current metadata snapshot, preventing a retired registry graph from remaining available to provider/model normalization consumers.
Findings None None.
Security None None.

How this fits together

OpenClaw builds plugin metadata from installed plugin manifests, then passes that metadata to plugin activation, provider/model discovery, and authentication resolution. This PR changes how that metadata is bootstrapped, scoped, cached, invalidated, and published to later control-plane consumers.

flowchart LR
  A[Installed plugin manifests] --> B[Installed plugin index]
  B --> C[Plugin metadata snapshot]
  D[Requested plugin scope] --> E[Plugin activation context]
  C --> E
  C --> F[Current process metadata graph]
  F --> G[Provider and auth discovery]
  E --> H[Loaded plugin runtime]
Loading

Decision needed

Question Recommendation
Does the intended plugin control-plane contract permit only complete unscoped metadata to become the process-current graph, while explicit empty and owner-only loads remain private to their activation request? Confirm and merge after rebase: Confirm the single current-graph contract, refresh the branch against current main, and merge once the resulting checks remain green.

Why: This is a compatibility-sensitive lifecycle decision spanning plugin discovery, runtime activation, provider selection, and authentication metadata; the protected maintainer label requires an owner decision rather than automated approval.

Before merge

  • Resolve merge risk (P1) - The PR changes a process-wide metadata handoff used by provider and authentication discovery; maintainers should confirm that partial, explicit-empty, and owner-only activation paths never publish incomplete metadata as the global graph.
  • Resolve merge risk (P1) - The branch is behind main; although GitHub reports it mergeable, the final merge result should be refreshed against the current plugin-control-plane code before landing.
  • Complete next step (P2) - A protected-label PR with a compatibility-sensitive global metadata contract needs owner confirmation and a rebase refresh, not an automated repair attempt.
Agent review details

Security

None.

PR surface

Source -4, Tests +196. Total +192 across 13 files.

View PR surface stats
Area Files Added Removed Net
Source 6 90 94 -4
Tests 7 217 21 +196
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 13 307 115 +192

Review metrics

Metric Value Why it matters
Registry lifecycle policy 8-entry cache replaced by 1 current graph The change deliberately narrows retained registry state, so lifecycle and publication boundaries matter more than ordinary cache-hit behavior.

Stored data model

Persistent data-model change detected: unknown-data-model-change: src/plugins/current-plugin-metadata-snapshot.ts, unknown-data-model-change: src/plugins/current-plugin-metadata-state.ts, unknown-data-model-change: src/plugins/plugin-metadata-snapshot.test.ts, unknown-data-model-change: src/plugins/plugin-metadata-snapshot.ts, vector/embedding metadata: src/agents/model-selection.plugin-runtime.test.ts, vector/embedding metadata: src/auto-reply/reply/commands-models.test.ts, and 8 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Prove the global-graph boundary after rebase (recommended)
    Rebase, then add or retain focused proof that empty and owner-only loads cannot replace the complete unscoped graph used by provider and authentication discovery.
  2. Accept the lifecycle contract explicitly
    Maintainers may accept the change if they confirm the global graph is intentionally unscoped and complete at every publication point.
  3. Pause for a narrower owner design
    Pause this PR if the repository needs a durable scope-aware metadata contract rather than a single process-current graph.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
After rebasing, verify scoped runtime loads leave the published provider/auth metadata graph unchanged and include the focused regression results.

Technical review

Best possible solution:

Rebase onto current main, then land only after the plugin/control-plane owner confirms that unscoped metadata is the sole publishable global graph and that scoped loads remain isolated from provider and authentication discovery.

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

Unclear for a current-main failing path: the supplied source diff and regression tests define the bootstrap, scope, and lifecycle paths, but this review could not independently execute or inspect the checkout after the read-only command environment failed before even pwd.

Is this the best way to solve the issue?

Unclear: the patch follows the repository's stated preference for lifecycle-owned, process-stable metadata, but an owner must still confirm that only complete unscoped metadata may be published to provider and authentication consumers.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This repairs a bounded plugin discovery and activation correctness problem with potential provider/auth knock-on effects but no demonstrated urgent user outage.
  • merge-risk: 🚨 compatibility: Replacing historical registry reuse with one published process-current graph can affect existing plugin discovery and refresh behavior across workspaces or scopes.
  • merge-risk: 🚨 auth-provider: The current metadata snapshot feeds provider/model normalization and auth resolution, so an incomplete published graph could hide available plugin-owned providers or auth metadata.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body reports an after-fix isolated installation of the actual package and CLI, including first-run discovery and post-refresh rediscovery of the same 75 bundled plugin IDs.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body reports an after-fix isolated installation of the actual package and CLI, including first-run discovery and post-refresh rediscovery of the same 75 bundled plugin IDs.

Evidence

What I checked:

  • Protected maintainer review gate: The PR carries the maintainer label. Repository policy requires maintainer-authored handling rather than automated cleanup or closure for protected-label items. (e2e92548ebcd)
  • Scoped activation propagation: The supplied diff adds onlyPluginIds to the runtime load context and forwards it into current-snapshot lookup and metadata loading, addressing explicit empty and owner-only scopes rather than re-discovering unrelated plugins. (src/plugins/runtime/load-context.ts:139, e2e92548ebcd)
  • Lifecycle cache invalidation: The supplied diff makes registry invalidation clear the published current metadata snapshot, preventing a retired registry graph from remaining available to provider/model normalization consumers. (src/plugins/plugin-registry-snapshot.ts:83, e2e92548ebcd)
  • Real installed-package evidence: The PR body reports installing the built package into an isolated prefix and state directory, discovering 75 bundled plugins on first run, refreshing the persisted registry, and rediscovering the same 75 IDs afterward. (e2e92548ebcd)
  • Review continuity: The preceding completed ClawSweeper cycle reported no line-level findings and asked maintainers to confirm that explicit empty or owner-only loads cannot publish incomplete metadata to provider and authentication discovery; the current two commits are test-fixture adjustments in the provided commit list. (6abe5a11cccc)

Likely related people:

  • steipete: The provided PR history attributes all eight commits affecting the plugin registry, metadata lifecycle, runtime load context, and their regression tests to this contributor; current-main ownership history could not be independently inspected in this read-only execution environment. (role: recent feature-change contributor; confidence: low; commits: fec3fbc20572, 6056d3288142, a608b24fbe97; files: src/plugins/plugin-registry-snapshot.ts, src/plugins/plugin-metadata-snapshot.ts, src/plugins/runtime/load-context.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Rebase onto current main and refresh the focused plugin-control-plane checks.
  • Have the relevant owner confirm that scoped metadata cannot become the process-wide provider/auth graph.

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 (7 earlier review cycles)
  • reviewed 2026-07-27T11:49:36.604Z sha b591bbe383025cca9df750322c24bf881a94a1bd :: needs maintainer review before merge. :: none
  • reviewed 2026-07-27T12:02:31.027Z sha 108b30821cd784984c3cefa2a47ff7ddc6a19689 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-27T12:27:36.116Z sha a608b24 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-27T12:36:59.824Z sha 1dac4ff :: needs maintainer review before merge. :: none
  • reviewed 2026-07-27T12:51:08.665Z sha 69d2269 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-27T13:21:02.708Z sha 971bcf0 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-27T13:34:20.397Z sha 6abe5a1 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jul 27, 2026
@steipete
steipete force-pushed the codex/ambitious-canonical-plugin-graph-87b76d0c branch from 662a73f to a608b24 Compare July 27, 2026 12:22
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Jul 27, 2026
@steipete
steipete requested a review from a team as a code owner July 27, 2026 12:46
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Jul 27, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jul 27, 2026
@steipete
steipete merged commit 6ac11fb into main Jul 27, 2026
188 of 190 checks passed
@steipete
steipete deleted the codex/ambitious-canonical-plugin-graph-87b76d0c branch July 27, 2026 14:00
@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 28, 2026
…ion (openclaw#114547)

* fix(plugins): prevent missing and out-of-scope plugin activation

* fix(plugins): clear complete metadata on lifecycle invalidation

* fix(plugins): clear metadata without lifecycle import cycles

* test(agents): preserve plugin metadata lifecycle in model mock

* test(agents): align Ollama auth with the installed plugin index

* test(auto-reply): preserve plugin metadata lifecycle in model mock

* test(auto-reply): keep plugin metadata mock within lint limit

* test(auto-reply): align plugin metadata fixture with lint and format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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