Repository navigation
refactor: move memory event persistence off the Gateway thread - #147948
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, 10:47 PM ET / September 15, 2026, 02:47 UTC (Revision 4). ClawSweeper reviewWhat this changesMoves memory-event appends and bounded history reads onto the shared SQLite worker while preserving event ordering, retention, and durable completion. Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this protected PR still addresses synchronous journal work present on main. No blocking defect was identified, and the previous migration-proof concern does not apply to the preserved storage format and public contracts. Priority: P2 Review scores
Verification
How this fits togetherMemory recall and dreaming operations record diagnostic events in OpenClaw’s shared state database. The memory event helpers feed the plugin-state owner, whose results support history readers and exported event logs. flowchart TD
A[Memory recall and dreaming] --> B[Validate and capture event]
B --> C[Shared SQLite worker]
C --> D[Allocate sequence and commit journal]
D --> E[Existing state database]
E --> F[Bounded history read]
F --> G[History helpers and exports]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +135, Tests +148, Docs +9, Other 0. Total +292 across 22 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 journal persistence with the existing shared worker and transaction owner, preserving the public asynchronous API and existing durable records. Do we have a high-confidence way to reproduce the issue? Not applicable to this execution-boundary refactor; current-main source confirms inline SQLite work, but this review did not reproduce or measure a Gateway pause. Is this the best way to solve the issue? Yes: moving the complete journal operation onto the existing worker preserves one transaction owner and avoids a competing persistence implementation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against dd3383345724. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
Run memory recall and dreaming journal appends and bounded reads through the shared-state worker. Preserve atomic sequence allocation, cursor and event writes, retention, rollback, and stored JSON/key bytes. Retain current maintenance context and lazy event schema ownership. Related: #144592.
d8e0eef to
2596b5f
Compare
The registered public artifact provider now reaches worker-backed journal reads. Use the existing isolated database-worker test lane while preserving every fixture and assertion. Related: #144592.
|
Merged via squash.
|
…law#147948) * refactor: move memory journal persistence to SQLite worker Run memory recall and dreaming journal appends and bounded reads through the shared-state worker. Preserve atomic sequence allocation, cursor and event writes, retention, rollback, and stored JSON/key bytes. Retain current maintenance context and lazy event schema ownership. Related: openclaw#144592. * test: route LanceDB artifact tests through database workers The registered public artifact provider now reaches worker-backed journal reads. Use the existing isolated database-worker test lane while preserving every fixture and assertion. Related: openclaw#144592.
Related: #144592
What Problem This Solves
Fixes: saving or reading memory event history can pause other Gateway work while SQLite runs.
User Impact
Memory event appends and bounded reads use the shared SQLite worker while preserving existing events, ordering, retention, and reopening behavior. No configuration, schema-version, or stored-data migration is required.
Why This Change Was Made
The plugin-state owner allocates the sequence, writes the cursor and event, and applies retention in one worker transaction. Bounded reads use the existing-only path. This refresh contains only the journal change on current main, preserving the merged worker and maintenance owners and the lazy event imports.
Evidence
Nine selected ordinary journal cases passed on the refreshed composition, covering public append/read, captured inputs, concurrent sequences, retention, and reopening. The two LanceDB artifact-provider cases also pass after moving their existing file to the canonical worker test lane. Routing checks and both P2 reviews are clean.
The normal build and complete changed-file gate passed at
2596b5f8e608. Built public API checks on Node 24.21.0 and Bun 1.4.2 preserved exact event/cursor JSON and sequence 3 after reopening; missing reads created no database. Six calibrated counters (prepare,exec,get,all,run,iterate) stayed at zero during journal operations. Build metadata identifies2596b5f8e608; the follow-up changes only LanceDB test routing, and production sources and measured runtime artifacts remain byte-identical. The opt-in Codex provider harness and excluded fault/held-lock scenarios were not replayed.