Repository navigation
refactor(matrix): run credential and crypto snapshot storage in workers - #149548
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 15, 2026, 10:57 PM ET / September 16, 2026, 02:57 UTC (Revision 3). ClawSweeper reviewWhat this changesMoves Matrix credential operations and encryption-state snapshots onto existing SQLite workers while preserving older-host compatibility and shutdown persistence. Merge readiness⛔ Blocked before merge - 1 item remains This remains useful work: current main still performs these operations synchronously. No actionable introduced defect was found, and the prior migration blocker is unsupported because the stored representation and public contracts remain unchanged. Priority: P2 Review scores
Verification
How this fits togetherThe Matrix plugin stores account credentials and encryption snapshots in OpenClaw’s SQLite state stores. Authentication, periodic saves, and shutdown use this state to preserve account identity and encrypted conversations across restarts. flowchart TD
A[Matrix authentication] --> B[Account credential store]
B --> C{Comparison support available}
C -->|Yes| D[SQLite workers]
C -->|Older host| E[Synchronous compatibility path]
F[Periodic save or shutdown] --> G[Locked snapshot persistence]
G --> D
D --> H[Existing durable Matrix state]
E --> H
Before merge
Agent review detailsSecurityNone. PR surfaceSource +54, Tests +51. Total +105 across 18 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Use the existing worker-backed stores and shared snapshot codec while retaining atomic credential checks, supported-host fallbacks, and shutdown settlement. Do we have a high-confidence way to reproduce the issue? Not applicable as a discrete bug reproduction: this refactor addresses source-confirmed synchronous SQLite work; no Gateway latency measurement was performed during review. Is this the best way to solve the issue? Yes. Reusing the existing asynchronous store and snapshot codec is a narrow solution that preserves the documented storage contract and supported older hosts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 42c55f596602. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
5adde8b to
eb35874
Compare
|
Merged via squash.
|
…rs (openclaw#149548) * refactor(matrix): move credential and crypto snapshot storage to workers * test(matrix): run registered reads with the host SQLite broker
What Problem This Solves
Matrix authentication and periodic crypto snapshots still run SQLite operations on the Gateway thread despite having asynchronous callers.
User Impact
These runtime paths can wait for SQLite without blocking other Gateway work. Credential revocation, token-root continuity, snapshot contents, and shutdown persistence retain their existing behavior. No configuration or migration is required.
Why This Change Was Made
Runtime credential reads use the existing asynchronous keyed store. Credential updates and token-root claims use its observed-row comparison contract, recomputing only after an explicit conflict; unknown write failures are never replayed. The published Matrix host floor includes 2026.9.4, which predates comparisons, so that host retains its existing synchronous update path. The fallback can retire when Matrix raises its declared host minimum to include comparison support.
Crypto snapshots reuse the existing asynchronous generation codec under the same cross-process lock used by runtime persistence and Doctor. The client carries its captured state runtime through shutdown, and the lock remains held through chunk writes, metadata publication, and obsolete-chunk cleanup. The duplicate synchronous snapshot codec is removed.
Synchronous account/auth descriptors, root selection, startup metadata, recovery-key callbacks, and the sync cache's multi-row codec remain outside this cut. The recovery-key cache callback has a concrete void contract in matrix-js-sdk; its Promise-based getter remains a separate follow-up. The sync cache's lock belongs to one client instance and cannot safely authorize a cross-client asynchronous generation rewrite.
Evidence
Focused synthetic proof passed: 245 Matrix tests covering credentials, auth, storage roots, thread bindings, crypto snapshots, SDK shutdown, and Doctor migration. Production and test typechecks, lint, unused-export scans, plugin/storage boundaries, and import-cycle checks passed. The initial thread-pool failures were resolved by routing the two newly worker-backed test files through the existing fork lane; no broker guard was weakened.
Independent review found no actionable P0–P2 issues. Both targeted controls failed at the intended assertions against the original owners, then passed on the restored candidate; the final patch hash was verified after restoration. No real Matrix server, account credentials, or operator state was used.
CI follow-up: the registered Matrix loopback fixture now runs in the existing host-broker process lane and joins SQLite worker cleanup before deleting its temporary state. All 27 registered read, revocation, and denial cases passed. The branch also carries the canonical alias-wrapper fixture repair from main (#149477); its 12 delegation/refusal checks passed. The original Matrix runtime patch and older-host fallback remain unchanged.
Exact-head CI passed on
eb35874265e250b1a2f46e683f945925c2f5259e, including the requiredopenclaw/ci-gate.