Repository navigation
refactor(plugins): read installed metadata through the shared worker - #148017
Conversation
Move awaited installed-index and install-ledger SQL reads off the application thread while retaining the existing synchronous helpers, parser, cache owner, and lifecycle leases. Coalesce pending reads, preserve newer synchronous cache publication, and capture environment lookup semantics before awaiting. Validated ordinary metadata, recovery-location, and install-lease flows; cache coexistence and retirement; type/lint/ownership gates; a full build; and independent P2 review. Refs #144592.
Strengthen the existing three ordinary parent-SQL checks with call-through spies for prepare, exec, get, all, run, and iterate. Preserve the result assertions, observation windows, and cleanup.
|
🦞👀 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: blocked before merge. Reviewed September 14, 2026, 7:51 AM ET / 11:51 UTC (Revision 5). ClawSweeper reviewWhat this changesMoves awaited installed-plugin inventory and install-record reads into the shared SQLite worker, preserves cache lifecycle checks, and updates affected test routing and cleanup. Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this remains useful work absent from current main, with no actionable introduced defect found. The earlier migration-proof blocker does not apply because the persisted format and write path are unchanged. Priority: P2 Review scores
Verification
How this fits togetherPlugin installation, recovery, and registry refresh read installed-plugin metadata from OpenClaw’s shared SQLite database. The worker returns the stored row to the existing parser and lifecycle-owned cache before consumers use it. flowchart TD
A[Installation and recovery] --> B[Plugin metadata reader]
B --> C{Cached metadata available?}
C -->|Yes| F[Existing parser and cache]
C -->|No| D[Shared SQLite worker]
D --> E[Installed plugin row]
E --> F
F --> G[Validated inventory and install records]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +193, Tests +328. Total +521 across 28 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep awaited metadata reads on the shared worker while preserving the existing parser, synchronous consumers, and explicit cache invalidation lifecycle. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction: this is an internal storage refactor. Current-main source confirms that the awaited readers still execute synchronous SQLite work. Is this the best way to solve the issue? Yes: extending the existing worker and cache owner is a focused solution, and the retained parser and write path avoid a migration or parallel storage implementation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9a5af1b95370. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
Preserve the current session-delivery worker operation intersection while retaining the focused metadata reader changes. Record the unchanged main UI helper max-lines failure separately from passing metadata qualification.
Use existing fork owners for SQLite consumers while preserving watch ownership. Drain fixture workers before deleting state and reset stale installer replies between cases.
|
Merged via squash.
|
…penclaw#148017) * refactor(plugins): read installed metadata through the shared worker Move awaited installed-index and install-ledger SQL reads off the application thread while retaining the existing synchronous helpers, parser, cache owner, and lifecycle leases. Coalesce pending reads, preserve newer synchronous cache publication, and capture environment lookup semantics before awaiting. Validated ordinary metadata, recovery-location, and install-lease flows; cache coexistence and retirement; type/lint/ownership gates; a full build; and independent P2 review. Refs openclaw#144592. * test(plugins): observe statement execution in worker metadata reads Strengthen the existing three ordinary parent-SQL checks with call-through spies for prepare, exec, get, all, run, and iterate. Preserve the result assertions, observation windows, and cleanup. * test: route metadata consumers through host-capable workers Use existing fork owners for SQLite consumers while preserving watch ownership. Drain fixture workers before deleting state and reset stale installer replies between cases. * test: complete installed metadata worker test ownership
Let pending metadata reads finish with their captured facts after an explicit cache refresh. Keep coalescing, newer synchronous publication precedence, shutdown revocation, private snapshot identity and invalidation of completed facts in inactive caches. Delete the tests requiring the removed cancellation and cover the retained inactive-cache refresh contract. Best-effort tradeoffs accepted: - Cache invalidation during a worker read no longer cancels the read or replaces its original failure with an invalidation error. A cleared cache is not repopulated by that old read. This consistency machinery came from the worker preparation refactors in #148017 and #148305, not a reported incident. - Clearing discovery state during preparation may leave that operation using its captured mode until another explicit refresh or restart. Retain the global generation stamp for completed facts in inactive operation caches. P09 is below the campaign publication threshold: 29 net production lines removed, with no Plugin SDK export changes. No PR is intended for this packet.
Let pending metadata reads finish with their captured facts after an explicit cache refresh. Keep coalescing, newer synchronous publication precedence, shutdown revocation, private snapshot identity and invalidation of completed facts in inactive caches. Delete the tests requiring the removed cancellation and cover the retained inactive-cache refresh contract. Best-effort tradeoffs accepted: - Cache invalidation during a worker read no longer cancels the read or replaces its original failure with an invalidation error. A cleared cache is not repopulated by that old read. This consistency machinery came from the worker preparation refactors in #148017 and #148305, not a reported incident. - Clearing discovery state during preparation may leave that operation using its captured mode until another explicit refresh or restart. Retain the global generation stamp for completed facts in inactive operation caches. P09 is below the campaign publication threshold: 29 net production lines removed, with no Plugin SDK export changes. No PR is intended for this packet.
Let pending metadata reads finish with their captured facts after an explicit cache refresh. Keep coalescing, newer synchronous publication precedence, shutdown revocation, private snapshot identity and invalidation of completed facts in inactive caches. Delete the tests requiring the removed cancellation and cover the retained inactive-cache refresh contract. Best-effort tradeoffs accepted: - Cache invalidation during a worker read no longer cancels the read or replaces its original failure with an invalidation error. A cleared cache is not repopulated by that old read. This consistency machinery came from the worker preparation refactors in #148017 and #148305, not a reported incident. - Clearing discovery state during preparation may leave that operation using its captured mode until another explicit refresh or restart. Retain the global generation stamp for completed facts in inactive operation caches. P09 is below the campaign publication threshold: 29 net production lines removed, with no Plugin SDK export changes. No PR is intended for this packet.
* refactor(plugins): simplify in-flight metadata invalidation Let pending metadata reads finish with their captured facts after an explicit cache refresh. Keep coalescing, newer synchronous publication precedence, shutdown revocation, private snapshot identity and invalidation of completed facts in inactive caches. Delete the tests requiring the removed cancellation and cover the retained inactive-cache refresh contract. Best-effort tradeoffs accepted: - Cache invalidation during a worker read no longer cancels the read or replaces its original failure with an invalidation error. A cleared cache is not repopulated by that old read. This consistency machinery came from the worker preparation refactors in #148017 and #148305, not a reported incident. - Clearing discovery state during preparation may leave that operation using its captured mode until another explicit refresh or restart. Retain the global generation stamp for completed facts in inactive operation caches. P09 is below the campaign publication threshold: 29 net production lines removed, with no Plugin SDK export changes. No PR is intended for this packet. * refactor(plugins): simplify reload and metadata lifetimes Remove speculative source/metadata freshness fences, multi-Gateway arbitration, replacement reservations and nested replacement-dependency bookkeeping. Keep one self-reload check, actual call/consumer settlement, live effect authority, initial source containment, copied-byte receipts and existing caches. Best-effort tradeoffs accepted: - Source/config changes during a captured operation take effect on a later run or explicit refresh, without rehashing and revalidating the entire source graph. - One process owns one Gateway; overlapping independent Gateways are best effort. - Nested replacement dependencies use the existing bounded drain rather than a second dependency graph. Ordinary 60-second drainage and --wait remain. - Cache retirement owns one detached cleanup scope instead of handing cleanup admission between the requesting scope and its last borrower. Retained incident boundaries: #151706, #152845, #153290 and #152997. Synthetic tests that only pin removed fences are deleted with them. No intended public SDK export, persisted schema, protocol, dependency or permission changes. * fix(plugins): refuse reload from a live borrowed turn Check the current live turn's exact plugin instances once before reload effects. A turn can retain its instance between callbacks even when there is no active plugin invocation. Keep external --wait and ordinary drainage. The Gateway regression fails without the check by reaching config effects; with it, the live turn is refused before effects and the same captured context can reload after the lease closes. The six explicit-wait controls also pass. Refs #151706. * fix(plugins): preserve SDK shapes and finish reload cutover * test(plugins): finish single-owner reload coverage cutover * refactor(plugins): tidy simplified lifecycle paths * fix(plugins): retain direct reload wait refusal * fix(plugins): refresh install phases and finish single-gateway tests * test(plugins): assert final-gateway shutdown contract * test(plugins): finish retired lifecycle fixture cutover * test(plugins): keep memory fixture behind runtime boundary * test(plugins): drop superseded memory reload fence cases * test(gateway): privatize unused lifecycle fixture type
…68837) * refactor(plugins): simplify in-flight metadata invalidation Let pending metadata reads finish with their captured facts after an explicit cache refresh. Keep coalescing, newer synchronous publication precedence, shutdown revocation, private snapshot identity and invalidation of completed facts in inactive caches. Delete the tests requiring the removed cancellation and cover the retained inactive-cache refresh contract. Best-effort tradeoffs accepted: - Cache invalidation during a worker read no longer cancels the read or replaces its original failure with an invalidation error. A cleared cache is not repopulated by that old read. This consistency machinery came from the worker preparation refactors in openclaw#148017 and openclaw#148305, not a reported incident. - Clearing discovery state during preparation may leave that operation using its captured mode until another explicit refresh or restart. Retain the global generation stamp for completed facts in inactive operation caches. P09 is below the campaign publication threshold: 29 net production lines removed, with no Plugin SDK export changes. No PR is intended for this packet. * refactor(plugins): simplify reload and metadata lifetimes Remove speculative source/metadata freshness fences, multi-Gateway arbitration, replacement reservations and nested replacement-dependency bookkeeping. Keep one self-reload check, actual call/consumer settlement, live effect authority, initial source containment, copied-byte receipts and existing caches. Best-effort tradeoffs accepted: - Source/config changes during a captured operation take effect on a later run or explicit refresh, without rehashing and revalidating the entire source graph. - One process owns one Gateway; overlapping independent Gateways are best effort. - Nested replacement dependencies use the existing bounded drain rather than a second dependency graph. Ordinary 60-second drainage and --wait remain. - Cache retirement owns one detached cleanup scope instead of handing cleanup admission between the requesting scope and its last borrower. Retained incident boundaries: openclaw#151706, openclaw#152845, openclaw#153290 and openclaw#152997. Synthetic tests that only pin removed fences are deleted with them. No intended public SDK export, persisted schema, protocol, dependency or permission changes. * fix(plugins): refuse reload from a live borrowed turn Check the current live turn's exact plugin instances once before reload effects. A turn can retain its instance between callbacks even when there is no active plugin invocation. Keep external --wait and ordinary drainage. The Gateway regression fails without the check by reaching config effects; with it, the live turn is refused before effects and the same captured context can reload after the lease closes. The six explicit-wait controls also pass. Refs openclaw#151706. * fix(plugins): preserve SDK shapes and finish reload cutover * test(plugins): finish single-owner reload coverage cutover * refactor(plugins): tidy simplified lifecycle paths * fix(plugins): retain direct reload wait refusal * fix(plugins): refresh install phases and finish single-gateway tests * test(plugins): assert final-gateway shutdown contract * test(plugins): finish retired lifecycle fixture cutover * test(plugins): keep memory fixture behind runtime boundary * test(plugins): drop superseded memory reload fence cases * test(gateway): privatize unused lifecycle fixture type
Related: #144592
What Problem This Solves
Awaited plugin inventory and install-ledger reads still execute SQLite synchronously during installation, recovery, and registry refresh.
User Impact
These reads now perform their SQLite work in the shared worker. Returned metadata, existing validation, and synchronous helpers retain their contracts; no configuration or migration is required.
Why This Change Was Made
Stored compatibility is unchanged: the same
config_machine_staterow key,plugins.installedIndex, still contains the existing {revision, index} envelope with a version-1 index. The schema and write path are unchanged, and the ordinary consumer cases read fixtures encoded in that existing format.Both read paths use the existing parser and plugin cache owner. Pending reads coalesce, newer synchronous cache publication wins, and invalidated or retired caches cannot publish an old result. Environment capture uses the existing platform-aware helper.
The worker adapter and cache preparation add 193 net production lines across nine files. No schema, retention, or version changes are included. Broader configuration preparation and task/flow restoration are separate changes.
Evidence
DatabaseSync.prepare/execandStatementSync.get/all/run/iterateduring the measured read phases.6b3e342ddb1e541f56b49b942d912cf8b376e24cwas merged normally, including the shared Docker assertion repair from fix(ci): restore the ClawHub plugin sweep check #148129. The merge has no conflicts and preserves all 28 PR file blobs and package manifests. The exact previously failing Docker assertion passes. Existing main lifecycle cleanup-result changes were reviewed and retained.