Skip to content

refactor(plugins): delete registry compat scaffolding - #117749

Merged
steipete merged 5 commits into
mainfrom
refactor/plugin-registry-scaffolding-deletion
Aug 2, 2026
Merged

steipete merged 5 commits into
mainfrom
refactor/plugin-registry-scaffolding-deletion

Conversation

@steipete

@steipete steipete commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The plugin loader carried ~2,300 production lines of defense machinery whose sole reason was that scoped loads could swap the process-wide active registry: three separately pinned surfaces with four competing selection heuristics, cache-key permutation matching (up to eight synthesized variants), 260 lines of hook-runner owner arbitration across divergent registries, a scope ratchet, a standalone activating loader, and the process-global gateway-bindings singleton. Phase 2a (#117372) moved contributions onto the registry value; Phase 2b (#117587) removed the cause by making installation root-owned. This PR deletes the defenses.

Final structural PR of the reviewed architecture series.

Why This Change Was Made

Every deletion target was verified unreachable or redundant before removal:

  • Pins + heuristics deleted: remaining getActive* accessors are direct root-registry reads. Hot reload no longer pins — it prepares the replacement root without exposing it, preserves the exact drain/stop-channels ordering and stale-generation abort/rollback semantics, and performs a plain root activation at the existing commit boundary; the old root retires only after the new generation commits.
  • Permutation matching deleted: reuse is exact-key identity or rebuild.
  • Hook arbitration deleted: getGlobalHookRunner stays byte-compatible, reading the root registry with contribution-based ALS overlays — the architectural subtlety here is overlaying by actual contribution rather than registry ownership, so a scoped handle contributing one hook family cannot hide unrelated root hooks or fail-closed policies.
  • Scope ratchet + standalone loader deleted, with their obsolete tests removed rather than ported.
  • gateway-bindings singleton deleted: session-catalog resolves through registry-bound runtime/ALS scope; gateway close now awaits plugin cleanup and clears the root registry, so SIGUSR1 in-process restart starts cold instead of relying on a manual reset list.
  • Loader caches collapsed to one exact-key memo serving root loads and CLI repeat loads.

User Impact

None intended at any external surface. Operationally: one registry, one owner, one truthful lifecycle — the classes of bug this machinery defended against (wrong-registry resolution, hook loss, cross-generation leaks) are structurally unrepresentable.

Evidence

  • LOC ledger (the series' promise, kept): this PR −1,228 production (+964/−2,192 across 49 files), tests −3,836. Combined Phase 2b + 2c: −491 production / −4,583 total — the architecture landed net-negative as committed in refactor(plugins): root-owned bundle installation with scoped registry handles #117587's review.
  • Reload suites 345/345; loader/CLI 269-292 per round; outbound 260; gateway surfaces 415; built-gateway lifecycle/close e2e 1/1; post-rebase reruns green (one semantic conflict with a parallel main workstream fixed: cli.test.ts had retained the pre-handle mock).
  • tsgo + tsgo:test 0 errors; SDK surface (321 entrypoints / 7,590 exports) and API baseline without hand edits; madge + runtime cycles 0; all three dead-code audits clean; pnpm build clean; changed-surface vi.mock sweep clean; iterative autoreview to clean.
  • Flip-proof e2e adjudication (documented honestly): the SQLite flip-proof passed 1/1 on this branch pre-final-build; exact-final-tree local reruns hit "Opening handshake has timed out" — and clean origin/main fails identically on this host under the current load (~29-32, unrelated parallel build + Spotlight indexing), while the gateway itself reaches ready in ~2s. Environmental, not the branch; remote executors were unavailable (Blacksmith CLI missing, AWS broker unauthenticated) so the documented trusted-source local fallback applies, and hosted Linux CI on this PR is the authoritative arbiter.

🤖 Generated with Claude Code

Exact-head runtime proof (added post-review)

All three artifacts at head 841dc9a: the SQLite flip-proof e2e PASSES 1/1 (108s) through the pinless activation/cleanup/close path — the earlier local timeouts reproduced identically on clean main under host load ~30 and vanished at load ~9; handle-isolation transcript on the real dist (scoped loads leak nothing into the root registry); live ephemeral gateway boot and close on the exact-head dist (3 plugins in 0.6s, readyz 200, clean 32ms shutdown). Transcripts: #117749 (comment)

@steipete
steipete marked this pull request as ready for review August 2, 2026 02:23
@openclaw-barnacle openclaw-barnacle Bot added channel: imessage Channel integration: imessage channel: mattermost Channel integration: mattermost channel: slack Channel integration: slack channel: tlon Channel integration: tlon channel: whatsapp-web Channel integration: whatsapp-web gateway Gateway runtime cli CLI command changes agents Agent runtime and tooling channel: feishu Channel integration: feishu size: XL maintainer Maintainer-authored PR labels Aug 2, 2026
@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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Aug 2, 2026
@clawsweeper

clawsweeper Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 11:59 PM ET / August 2, 2026, 03:59 UTC.

ClawSweeper review

What this changes

The PR deletes legacy multi-registry pinning, compatibility matching, standalone activating loaders, and Gateway binding state now that plugin installation is root-owned and scoped consumers receive non-activating registry handles.

Merge readiness

⚠️ Needs maintainer review before merge - 4 items remain

Keep this PR open for maintainer review. The supplied exact-head terminal transcripts and successful CI materially satisfy the prior proof request, and the branch appears to complete the already-merged root-owned registry architecture; however, this read-only checkout lacks the PR objects and cannot fetch them, so a full current-head source/diff review is not possible here. The existing maintainer label also requires explicit human handling rather than automated cleanup.

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

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The runtime proof is strong, but branch-level patch confidence remains limited because this checkout cannot retrieve the exact PR objects for a complete source review.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The exact-head contributor comment provides redacted terminal evidence for the SQLite lifecycle flip proof, scoped-handle isolation, and an ephemeral Gateway boot/ready/clean-close run; the provided check summary also marks real behavior proof successful.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The exact-head contributor comment provides redacted terminal evidence for the SQLite lifecycle flip proof, scoped-handle isolation, and an ephemeral Gateway boot/ready/clean-close run; the provided check summary also marks real behavior proof successful.
Evidence reviewed 6 items Current-main architecture being removed: Current main still maintains an active registry plus separately pinned HTTP-route, channel, and session-extension surfaces; the PR’s described deletion targets that compatibility architecture after the merged root-owned-handle series.
Gateway lifecycle owner: Current main releases a pinned plugin route registry only in Gateway shutdown, showing why the PR’s replacement must preserve teardown ordering before clearing the active registry.
Merged predecessor: Current main history includes the merged contribution-bundle predecessor, which the PR body identifies as the first phase of this registry-ownership series.
Findings None None.
Security None None.

How this fits together

OpenClaw’s plugin loader builds registries from configuration and makes one registry process-active for Gateway and CLI lifecycles. Agents and feature-specific runtime paths should use scoped registry handles so they cannot replace Gateway-owned plugins, hooks, routes, or channel metadata.

flowchart LR
  Config[Plugin configuration] --> Loader[Plugin loader]
  Loader --> Root[Process-root registry]
  Loader --> Handles[Scoped registry handles]
  Root --> Gateway[Gateway, routes, channels, hooks]
  Handles --> Consumers[Agents and feature runtimes]
  Gateway --> Shutdown[Gateway shutdown]
  Shutdown --> Cleanup[Plugin cleanup and registry clear]
Loading

Decision needed

Question Recommendation
Should this large compatibility-sensitive registry cleanup be accepted after an exact-head diff and merge-result review, given that the required runtime proof is now present? Refresh exact-head review: Review the current merge result and the remaining registry activation call sites, then accept the deletion if no scoped path can mutate process-root state.

Why: The proof gate appears satisfied, but the protected maintainer label and unavailable branch objects prevent an automated merge-quality decision for a 129-file lifecycle refactor.

Before merge

  • Resolve merge risk (P1) - The PR replaces compatibility-sensitive Gateway, channel, hook, and scoped-loader behavior across a large surface; its clean merge result and every changed call site need a human review refresh because the exact PR objects were unavailable in this checkout.
  • Resolve merge risk (P1) - Current main still relies on pinned registry surfaces, so merging changes that remove them can affect Gateway availability or plugin resolution if any non-root activation path remains outside the supplied diff/proof.
  • Complete next step (P2) - The current protected maintainer label and compatibility-sensitive Gateway lifecycle scope require an explicit exact-head maintainer review; there is no discrete mechanical defect for an automated repair lane.
Agent review details

Security

None.

Review metrics

None.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/plugins/migration-provider-runtime.test.ts, migration/backfill/repair: src/plugins/migration-provider-runtime.ts, persistent cache schema: src/plugins/loader-cache.ts, persistent cache schema: src/plugins/loader-runtime-load.ts, persistent cache schema: src/plugins/loader-runtime-registry.ts, persistent cache schema: src/plugins/loader.registration.test-utils.ts, and 11 more. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: canonical
Canonical: #117749
Summary: This PR is the final cleanup phase of the same registry-ownership architectural series; the two merged predecessors establish the new owner boundary but do not themselves delete this remaining compatibility scaffolding.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Verify exact-head lifecycle coverage (recommended)
    Before merge, inspect the current merge result for all process-root activations and confirm Gateway shutdown clears the registry only after plugin and channel teardown.
  2. Pause for owner review
    Pause the refactor if the full diff reveals an unresolved pinned-surface consumer or a runtime path that needs an intentional compatibility contract.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Rebase or refresh against current main, then verify all remaining process-root registry activations and the Gateway shutdown ordering on the exact head.

Technical review

Best possible solution:

Review the exact current head against the merged root-owned installation boundary, confirm every remaining process activation is a composition-root operation, and merge only if the three supplied runtime proofs still match that head after any rebase.

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

Not applicable as a standalone issue: this is a structural cleanup PR. The contributor supplied high-confidence after-fix runtime evidence for the affected lifecycle, but this reviewer could not independently execute or inspect the exact branch because its Git objects were unavailable locally and network resolution failed.

Is this the best way to solve the issue?

Unclear: the root-owned registry model is consistent with the repository’s stated plugin boundary and the merged predecessor work, but the best-fix judgment needs the exact branch/merge-result inspection to prove every pinned consumer has been retired safely.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The exact-head contributor comment provides redacted terminal evidence for the SQLite lifecycle flip proof, scoped-handle isolation, and an ephemeral Gateway boot/ready/clean-close run; the provided check summary also marks real behavior proof successful.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The exact-head contributor comment provides redacted terminal evidence for the SQLite lifecycle flip proof, scoped-handle isolation, and an ephemeral Gateway boot/ready/clean-close run; the provided check summary also marks real behavior proof successful.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a broad but internal runtime refactor with meaningful compatibility and availability blast radius rather than an observed emergency.
  • merge-risk: 🚨 compatibility: The branch removes legacy active-registry selection, pinned surfaces, and runtime loader compatibility paths that existing Gateway and plugin flows may still rely on.
  • merge-risk: 🚨 availability: The changed lifecycle includes Gateway startup, reload, hook dispatch, and shutdown registry cleanup, so an omitted owner path could affect service availability.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The exact-head contributor comment provides redacted terminal evidence for the SQLite lifecycle flip proof, scoped-handle isolation, and an ephemeral Gateway boot/ready/clean-close run; the provided check summary also marks real behavior proof successful.
  • proof: sufficient: Contributor real behavior proof is sufficient. The exact-head contributor comment provides redacted terminal evidence for the SQLite lifecycle flip proof, scoped-handle isolation, and an ephemeral Gateway boot/ready/clean-close run; the provided check summary also marks real behavior proof successful.

Evidence

What I checked:

  • Current-main architecture being removed: Current main still maintains an active registry plus separately pinned HTTP-route, channel, and session-extension surfaces; the PR’s described deletion targets that compatibility architecture after the merged root-owned-handle series. (src/plugins/runtime.ts:128, 564c6dee83b4)
  • Gateway lifecycle owner: Current main releases a pinned plugin route registry only in Gateway shutdown, showing why the PR’s replacement must preserve teardown ordering before clearing the active registry. (src/gateway/server-close.ts:1055, 564c6dee83b4)
  • Merged predecessor: Current main history includes the merged contribution-bundle predecessor, which the PR body identifies as the first phase of this registry-ownership series. (src/plugins/runtime.ts:128, e4d1b7e0d38c)
  • Feature provenance: Blame attributes the current multi-live-registry implementation to Peter Steinberger’s August 1 refactor, providing a concrete routing signal for the subsequent simplification. (src/plugins/runtime.ts:136, 35e4563fa864)
  • Exact-head behavior proof: The contributor’s linked comment records exact-head SQLite flip-proof success, scoped-handle isolation with no root-registry leakage, and an ephemeral Gateway ready/clean-close transcript. The GitHub context also reports the dedicated Real behavior proof check as successful. (841dc9a29ff2)
  • Review limitation: The checkout has current main but not the PR head or source revision; git cat-file attempted promisor fetches and network DNS resolution failed, so no branch-line finding or clean merge-diff conclusion is asserted.

Likely related people:

  • steipete: The supplied context identifies this author for the current cleanup and both merged predecessor PRs; current-main blame also attributes the live-registry compatibility implementation to Peter Steinberger. (role: architecture-series author and recent area contributor; confidence: high; commits: e4d1b7e0d38c, 35e4563fa864; files: src/plugins/runtime.ts, src/gateway/server-close.ts)

Rank-up moves

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

  • Refresh the exact-head merge-result review and inspect every remaining process-root registry activation before merge.

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-08-02T02:51:17.501Z sha 436eeea :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-02T03:12:14.565Z sha 5a8b152 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-02T03:33:08.938Z sha 841dc9a :: needs real behavior proof before merge. :: none

@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Exact-head runtime proof (head 841dc9a29ff, redacted transcripts)

1. SQLite flip-proof e2e — PASSES at the exact head now that the unrelated host saturation has cleared (the earlier timeouts reproduced identically on clean origin/main under load ~30; at load ~9 the exact final tree passes):

Tests  1 passed (1)   Duration 108.15s

Isolated gateway lifecycle state stays SQLite-first through the pinless activation/cleanup/close path — the exact "activation, cleanup, and restart behavior" the review asked to see.

2. Handle isolation on the surviving canonical path (real dist loader):

1) root registry installed, harnesses: [ 'root-owned-harness' ]
2) scoped handle harnesses: [ 'scoped-only-harness' ]
   handle !== root registry object: true
   root registry still carries ONLY its own harness: ["root-owned-harness"]
   scoped plugin leaked into root registry: no

3. Live ephemeral gateway on the exact-head dist (isolated state dir, loopback): boots through root activation with no pins, closes with the new registry-clearing path:

[gateway] http server listening (3 plugins: anthropic, memory-core, ollama; 0.6s)
readyz=200 after 6s
[shutdown] completed cleanly in 32ms

Also for the record, two review-cycle catches this PR absorbed at the boundary rather than in tests: the hook facade precedence regression on the shipped initializeGlobalHookRunner SDK path (real; fixed with contribution-granular three-layer precedence + regression test) and the deleted version-keyed channel-view memo (real hot-path contract; restored as a lifecycle-owned single-slot without pins).

🤖 Generated with Claude Code

@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. and removed 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. labels Aug 2, 2026
@steipete
steipete merged commit ccee629 into main Aug 2, 2026
202 of 211 checks passed
@steipete
steipete deleted the refactor/plugin-registry-scaffolding-deletion branch August 2, 2026 04:18
@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
* refactor(plugins): delete registry compat scaffolding

* test(plugins): update CLI registry handle mock

* fix(plugins): preserve explicitly initialized hook registries

* test(plugins): update registry ownership fixtures

* fix(channels): restore registry snapshot memo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: feishu Channel integration: feishu channel: imessage Channel integration: imessage channel: mattermost Channel integration: mattermost channel: slack Channel integration: slack channel: tlon Channel integration: tlon channel: whatsapp-web Channel integration: whatsapp-web cli CLI command changes gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. 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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL 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