Repository navigation
fix(plugins): release predecessor registries after replacement - #149644
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 16, 2026, 2:28 AM ET / 06:28 UTC (Revision 8). ClawSweeper reviewWhat this changesThe PR prevents plugin replacement callbacks from retaining older registries, adds collection coverage, and corrects database-related test routing and teardown. Merge readiness✅ Ready for maintainer review This remains a useful, focused repair absent from current main. No actionable defects were found. The documented acceptance of the broader memory shortfall resolves the previous review’s blocker for this bounded change. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s plugin loader builds registries from plugin code, configuration, and prepared capability information. Replacement registries keep active plugin operations available while retired registries release their resources. flowchart LR
A[Plugin code and configuration] --> B[Plugin loader]
C[Prepared capability information] --> D[Isolated resolver closure]
D --> B
E[Previous registry] --> B
B --> F[Replacement registry]
F --> G[Active plugin operations]
E --> H[Retirement and collection]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +9, Tests +97. Total +106 across 5 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep capability callbacks scoped to their prepared facts and preserve normal registry retirement, with broader native ESM memory work remaining separate. Do we have a high-confidence way to reproduce the issue? Yes: current main retains the implicated inline closure, and the supplied before/after collection regression isolates its predecessor-retention effect. This read-only review did not execute a current-main reproduction. Is this the best way to solve the issue? Yes: moving closure creation outside the loader removes the diagnosed capture while preserving the returned context and existing lifecycle contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against cda032ef33a1. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (7 earlier review cycles)
|
|
Maintainer disposition for the review’s memory-limit item: land this focused repair as part of the five-PR retention stack, subject to CI and the native landing gates. The maintainer explicitly approved landing the stack with the documented remaining failure. This accepts the independently demonstrated owner repairs; it does not claim complete reload-memory acceptance. The 500-update ESM forced-GC result remains 36.65 MiB against the unchanged 32 MiB limit. The remaining native ESM module-job growth stays open for further work; no threshold increase, idle subtraction, or plateau claim is being used to turn that result green. The linked proof separately demonstrates caller collection, predecessor release, stopped-handle cleanup, bundled setup code reuse, and published-registry reuse. Functional reload/install/restart observations retain their recorded scope. Installed/source plugins keep their captured generations, and compiled bundled code replacement retains its documented build-and-restart requirement. |
a0f524e to
ab6e5b7
Compare
ab6e5b7 to
9deac96
Compare
40af823 to
04d8b22
Compare
|
Merged via squash.
|
…law#149644) * fix(plugins): isolate retained capability resolver scope * test(plugins): run runtime registry state checks in host processes * test(reef): drain state lifecycle before fixture removal
Landed: merged into
mainas36e07b8f00243891da8649812863c8cf3ba95349on September 16, 2026. Required CI passed on the final PR head. All five stack layers are merged; final receipts and before/after proof. The accepted partial repair boundary is unchanged: ESM forced-GC growth remains 36.65 MiB against the 32 MiB limit.What Problem This Solves
An escaped capability resolver retained the loader scope and its previous plugin registry after replacement.
User Impact
The live replacement can retain its prepared capability facts without retaining the chain of retired registries.
This is one layer of a partial memory repair: the combined ESM forced-GC endurance result is still 36.65 MiB against a 32 MiB limit (failed).
Why This Change Was Made
Create the resolver outside the loader lexical scope. Route the companion runtime-registry tests through the required host-process lane.
Evidence
Landing CI exposed a Reef test teardown bug: native reset preceded temporary-file deletion without draining async database admissions. Both fixtures now await the existing lifecycle close. The real Linux SQLite/inode probe changed from 511 failures to zero under the same 511 inode reuses; the complete Reef file passed 30/30 locally. No production changes, timeout increases or relaxed assertions. Local extension lint could not run through the borrowed-dependency guard; current hosted CI remains required. Reef cleanup proof.
The combined plugin source passed 356/356 tests across 18 files before this test-only cleanup; every production byte remains identical. Integration results.
The four remaining plugin layers were refreshed onto main
08584b3d34c526ad438b39b32931a64a6c61a992. Every authored plugin-layer added/removed line is unchanged. Temporary Goal-test, planner-fixture and chat-renderer corrections were removed because main now owns their repairs: planner fixture, Goal read reuse and UI cleanup. The three files now exactly match main. The original stricter Goal bound passes all12 cases; removing canonical entry reuse still fails at four reads against its three-read limit. Fresh hosted CI is required for the refreshed heads. Refresh proof and identities.With the independent cached-error repair applied, the predecessor-collection regression still failed; after this repair all 18 retention cases passed. The host-process routing correction separately passed 33 registry tests. Five live CJS replacements removed the observed resolver/predecessor retaining paths.
Proof source:
6320346a6d281d4ab570cd67b241ec5d9a74ced8; the originally published stack top14a29985cfbc1b6f5e379b225ae7c00078061c16had the identical Git tree (bcdb4a87fb86add0a49982acf26af4568056f61b). The source-built live runs completed all four 20-warmup/500-measured lanes with functional checks passing and stable Gateway PID/socket. Real CLI install/reinstall auto-application and a separate physical shutdown/relaunch also passed. The 500-update trigger was source edits plus explicitplugins.reload; HTTP/tool checks were sampled, with full per-update tuples verified in the short diagnostics.Layer proof and reproduction commands · Before/after log excerpts · Live reload/restart measurements · Fresh review and commit provenance.
Fresh publication validation: P0–P2 cumulative review found no actionable defects. At publication, the stack plus main
b036baa80649passed 99 tests across 11 files, zero failed/skipped, including cache, registry-retention and state-lease owner/sibling coverage. The first integration attempt lacked package-local dependency links; the same command passed after restoring the existing links without an install or source changes. This combined-tree check supplements the exact-source build and live evidence above.Landing follow-up: two test-only corrections now distinguish retained task bytes from Vite source-map text and bundled companion reuse from installed-plugin capture. The paired reproductions passed 36/36 lifecycle tests and 8/8 companion cases; both scoped P0–P2 reviews and full changed-file gates passed. These follow-up commits change tests only; the five reviewed production patches are preserved. CI repair proof and commands. Those original test repairs remain in their owning layers; their historical results retain their source identities.
Scope and limitations
Stack order (review bottom to top):