Repository navigation
improve: defer database feature loading until first use - #152071
Conversation
|
Codex review: blocked before merge. Reviewed September 19, 2026, 8:33 AM ET / 12:33 UTC (Revision 9). ClawSweeper reviewWhat this changesDefers shared database feature handlers until their first command, allowing plugin metadata reads and idle checks to use a smaller worker entry point. Warning SQLite table change This PR modifies persisted SQLite tables in Merge readiness⛔ Blocked before merge - 1 item remains The PR remains useful and has no identified blocking defect. The previous migration-proof blocker does not apply: the patch preserves stored formats and transaction semantics, and the supplied evidence covers selected fresh-install and published-updater flows. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s shared-state worker receives database commands from application features through a serialized broker. This change separates lightweight inspection from feature loading while retaining the existing database, execution, and cleanup owners. flowchart TD
A[Application database commands] --> B[Serialized worker broker]
B --> C{Metadata or idle inspection?}
C -->|Yes| D[Lightweight worker entry]
C -->|No| E[Load feature dispatcher once]
E --> F[Synchronous database operation]
D --> G[Result and lifecycle cleanup]
F --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource +66, Tests +493. Total +559 across 11 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep metadata inspection lightweight and load the existing feature dispatcher on demand, preserving synchronous mutations and the established lifecycle owner. Do we have a high-confidence way to reproduce the issue? Not applicable as a correctness-bug reproduction: this is an internal loading improvement. Current-main static imports establish the eager-loading mechanism; no startup-speed improvement was independently measured. Is this the best way to solve the issue? Yes. The patch reuses the existing lazy-loader and dispatcher, keeping database ownership and synchronous transaction boundaries intact without adding configuration or a public API. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b39f188eae55. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
a83348a to
29751d0
Compare
29751d0 to
7f05134
Compare
|
@clawsweeper re-review Final-head CI, canonical Package Acceptance, published-driver upgrade/serving, canonical emitted worker graph, and Windows first use now pass and are linked in the updated body. All nine Windows boots and 18 internal turns passed with clean shutdown. Root independently verified focused terminal logs and all ten source-proof archive members; the artifact-host restriction is a reviewer access limitation. The SQLite table warning is inapplicable: sqlite-store.worker.ts adds a private code-preparation hook, with no DDL or data-model change, and current actor/transaction authority and settlement remain intact. Fresh-state internal turns and upgrade activation/serving remain explicitly separate. No current-head latency claim is made. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
7f05134 to
5eaa029
Compare
|
Merged via squash.
|
What Problem This Solves
A plugin-metadata read loads shared-state handlers for unrelated features. This also affects metadata-only commands such as local
openclaw gateway status --no-probe --jsonwith ordinary config and an existing state database.User Impact
Metadata reads and idle checks can run without loading those handlers. The plain, non-deep status path can finish without requesting the feature runtime. The first command that needs it still pays the deferred import cost. This does not establish a measured status-command speedup. No configuration, schema, durability, retention, or public API changes are required.
Why This Change Was Made
Keep a small shared-state worker entry point and prepare feature code before dispatch. Main's existing worker lifecycle owner holds acquisition and cleanup; module preparation runs inside its release scope. Operations and transaction settlement remain synchronous. FIFO ordering, cancellation, shutdown, current-authority checks, and completed outcomes remain with the existing owners. The production diff adds 66 net lines, including the private preparation contract and entry/runtime split.
Evidence
The PR branch is based on
834f44910010744313f65d4fc86e4909b2c023ab. Fresh independent P2 review passed all seven batches with source integrity verified. The configured F8 Testbox run passed 64 tests across six lifecycle/auth files, formatting and diff checks. Its negative control reproduced the intended coordinator-contention failure when module preparation escaped the release scope, and restored candidate bytes before GREEN. Source, index, dependencies, returned artifacts and joined worker/lease closure were verified. This focused continuation did not repeat a build, compiled graph or full static checks. Added real-broker cases cover rejected preparation releasing lifecycle custody before actor close, cancellation/close during preparation, and original-error preservation through native cleanup failure.On the producer merge checkout
343db2eca8f7f7f6ac028032957735f9694abffcfor PR head5eaa029b43664e1f8707a017c122a8d7ea5c5323, the original hosted CI run recorded 213 passing cases across 21 relevant auth, worker, coordinator, lease, and runtime-config test files on Linux / Node 24.19.0, with no skips in those target files. This was verified from actual case output in 17 job logs, with shard totals and exit-zero completion checked. The coordinator-delegate file was scheduled twice: its four passing cases are verified in the unit-fast group and counted once; the other scheduled infra placement has no execution evidence. Other files in these jobs have skips.The Package Acceptance run validated the package from that same
343db2esource checkout using maintained tooling10b13070c4afb9f4c5ecefab01212ef5511246d3. The npm onboarding/channel/agent lane passed, as did the published[email protected]updater → candidate2026.9.5base scenario. The latter used updater installation with manual restart, reported a successful update, and captured the first post-core child exiting 0. Package/source binding and returned onboarding and upgrade-survivor artifacts were verified. These results establish the selected installation and upgrade flows, not startup latency or other upgrade scenarios.The static import graph of that exact accepted package also passed: metadata remains available in the initial worker graph, while one dynamically imported dispatcher and 144 exclusive chunks (1,283,965 bytes) stay outside it. The audit parsed the packaged modules without executing them; it establishes the packaged lazy boundary, not a latency improvement.
Historical evidence for the preceding candidate, retained separately:
144adb922ad38284b2f30aecd432156866f421f1candidate passed 114 tests across 14 affected files plus full build, formatting, and diff checks in the configured Testbox run. Its seven-batch independent P2 review passed. These results do not prove the new lifecycle integration on 834.The single Windows rerun passed on the same
343db2echeckout with the original 81-file test command. It recorded 1,261 passing cases and 359 skips. The maintained Node 24.x selector resolved to Node 24.20.0 for this attempt, versus 24.19.0 in the original failed run. The original watcher timeout remains unexplained; this is not an identical-runtime reproduction or a confirmed flake fix. Required-check verification and native merge gates still apply. Installed startup performance remains unqualified.