Repository navigation
refactor(config): prepare task visibility configuration asynchronously - #148305
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: blocked before merge. Reviewed September 14, 2026, 5:49 PM ET / 21:49 UTC (Revision 3). ClawSweeper reviewWhat this changesThe PR makes asynchronous task reads await configuration, environment, plugin metadata, and consent preparation while sharing validation with existing synchronous loaders. Merge readiness⛔ Blocked before merge - 1 item remains This remains useful work: current main still prepares configuration synchronously during bare-owner task visibility checks. No blocking introduced defect was found, and the prior generic migration-proof warning is not supported by a changed persistent contract. Priority: P2 Review scores
Verification
How this fits togetherPlugins query background tasks through OpenClaw’s task runtime. It reads persisted records, resolves the requesting owner’s identity, and returns only visible task details; cold configuration preparation supplies missing identity and policy facts. flowchart TD
A[Plugin task query] --> B[Read persisted tasks]
B --> C{Owner identity available?}
C -->|Yes| E[Check owner visibility]
C -->|No| D[Await configuration preparation]
F[Environment and stored plugin consent facts] --> D
D --> E
E --> G[Return visible task details]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +1192, Tests +1502, Docs 0, Other -1. Total +2693 across 43 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 configuration preparation behind the existing publication and metadata owners, preserving task visibility and synchronous compatibility while moving cold SQLite reads off the Gateway thread. Do we have a high-confidence way to reproduce the issue? Yes, from source: a bare-owner task without a persisted requester agent reaches the synchronous configuration loader on current main. The registered SQLite test provides a focused measurement path; this review did not execute it. Is this the best way to solve the issue? Yes. Shared sync/async orchestration retains one validation policy and existing storage owners, while the added preparation path addresses the identified cold-read boundary. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 52f2f2fd87bb. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
…ync-task-config-preparation-main-20260914
|
Merged via squash.
|
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
Builds on merged #148017.
What Problem This Solves
Cold
tasks.asyncreads can perform SQLite work on the Gateway thread when task visibility needs configuration to resolve a bare owner.User Impact
The existing
get,list,findLatest, andresolveoperations now await strict configuration preparation before applying owner visibility. Scope, lookup precedence, and response shapes remain unchanged; invalid configuration remains inaccessible.Task and flow registry readiness retains its synchronous owner in this change. This covers cold configuration after registry readiness; asynchronous registry restoration is the next cutover. Public synchronous methods remain available.
Why This Change Was Made
Configuration loading prepares its environment, plugin metadata, health, and Claw consent prerequisites through their existing owners, then rechecks admission and newer publications before activation. Synchronous and asynchronous loaders share validation. Both Claw readers retain artifact preservation and ownership validation.
The change preserves main's synchronous metadata snapshot-sharing wrapper. Prepared async facts feed the existing derivation; no Promise enters the synchronous snapshot scope. The existing config snapshot/read-for-write paths remain synchronous metadata consumers.
This focused 43-file change includes shared validation extraction and awaited environment, runtime, metadata, and consent preparation. Production changes are +2,182/-990 lines across 31 files; tests/support are +1,503/-1 across 10 files. No second metadata or publication owner is introduced. The reviewed configuration delta is applied directly to current main containing #148017, without carrying the prior private stack ancestry.
Evidence
prepare,exec,get,all,run, anditerate; direct strict-loader and metadata cases also observe six counters.pnpm buildpassed in 618.3 seconds on tree0b0ed30e91819da01727e110362b1aa4fd63ab17. Commit1c6050ff27c6342c8a314aec3c9e4d3bd30a571ahas that tree and normally merges main2f04a9e2069ee62797bdb9b86ae3c2c4e62578bainto the previous8d5efcc45ec16fc75634e9ea0292d5d8435a7263head.No schema, retention, configuration-option, or version changes are included. Held snapshot/WAL, native failure/path/size, liveness/PID, Windows runtime, and live-provider scenarios were not replayed for this composition; the inherited snapshot-sharing and Claw artifact-preservation owners were source-audited. This API does not provide a live configuration-publication fence through worker transaction settlement; that belongs to the existing activation/admission owner. No wall-clock speedup is claimed.