Repository navigation
fix(matrix): preserve encrypted sync state across restarts - #148152
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: needs maintainer review before merge. Reviewed September 14, 2026, 7:42 AM ET / 11:42 UTC (Revision 3). ClawSweeper reviewWhat this changesThe Matrix client retains its plugin-scoped storage capability so deferred encryption-state restores and saves continue working during restart and catch-up. Merge readiness✅ Ready for maintainer review The repair remains useful on current main, and no introduced correctness defect was found. This maintainer-authored PR also remains protected from automatic closure. Priority: P1 Review scores
Verification
How this fits togetherThe Matrix plugin saves its in-memory encryption databases into OpenClaw’s SQLite storage. Startup restores those databases, while periodic and shutdown saves preserve keys needed for subsequent encrypted conversations. flowchart TD
A[Matrix account configuration] --> B[Create Matrix client]
C[Plugin storage capability] --> B
B --> D[Client retains storage capability]
D --> E[Restore encryption databases]
E --> F[Encrypted sync]
F --> G[Periodic and shutdown saves]
G --> H[SQLite snapshot]
H --> E
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +29, Tests +42. Total +71 across 6 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep deferred encryption persistence attached to the client’s existing plugin-scoped storage owner while preserving snapshot formats and shutdown ordering. Do we have a high-confidence way to reproduce the issue? Yes, from source: deferred persistence without the originating plugin scope reaches an ambient runtime lookup that can throw. The focused regression covers retained-capability recovery; this review did not execute a current-main reproduction. Is this the best way to solve the issue? Yes. Capturing the existing storage capability fixes the lifetime mismatch without adding a global fallback, another persistence owner, a public API, or a data migration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f5c8b6e43f49. 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)
|
f38a358 to
a4dc613
Compare
|
@clawsweeper review Exact-head proof for a4dc613f6d8: focused Matrix runtime tests pass 14/14, pnpm check:changed passes, the real restart and catch-up scenario passes, and local P0-P2 autoreview is clean. Please refresh the review against this amended head. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Exact-head proof after rebase onto current main: Matrix create-client and persistence suites passed 14/14 at b0dcd77; the real restart/catch-up proof remains green. @clawsweeper review |
b0dcd77 to
6601cbc
Compare
|
Exact-head source refresh: 6601cbc has the same reviewed tree as the tested rebased commit; Matrix create-client and persistence suites passed 14/14 and the real restart/catch-up proof remains green. @clawsweeper review |
* commit '3c08384584f57787a26da9998488233fc15ccf7e': (122 commits) fix(agents): keep tool result summaries when middleware details exceed shape limits (#147805) test: make full-suite fixtures portable across runtimes (#148247) refactor(qa): share unknown confidence results (#148200) chore(android): remove unused test dependencies and duplicate Wear settings (#148231) test: reuse compiled preflight in startup fixtures (#148330) test(wizard): route recovery integration through database forks (#148337) refactor(plugins): simplify provider auth patch recursion (#147933) fix(cli): drain failed web capability output (#148234) refactor(android): remove unused production helpers (#148233) fix(plugins): scope feed integrity to hosted ClawHub (#148220) test(qa): compare Telegram entities semantically (#148219) test(qa): recognize native Slack exec progress rows (#148217) test(cron): distinguish repeated delivery incidents (#148151) test(qa): preserve restart command ownership (#148218) test(qa): isolate bundled skill CLI gateway state (#148150) test(qa): align process lifecycle contracts (#148149) improve(media): reduce metadata fetched during orphan cleanup (#148244) fix(matrix): retain sync state runtime for deferred persistence (#148152) test: deduplicate gateway watch exit fixtures (#148237) refactor(cli): derive daemon status contract from gatherer (#148108) ...
What Problem This Solves
Fixes an issue where Matrix encrypted sync state could fail to persist during restart or catch-up because deferred callbacks no longer had access to the plugin invocation runtime.
Why This Change Was Made
The Matrix client now retains its instance-scoped state-store capability when it is constructed and passes that narrow capability through deferred IndexedDB restore and persistence paths. This preserves plugin isolation without introducing a global runtime fallback.
User Impact
Matrix accounts can restart, restore encrypted sync state, and continue incremental catch-up without losing persistence access after plugin registration completes.
Evidence
Matrix runtime not initializedand passed after the fix.node scripts/run-vitest.mjs extensions/matrix/src/matrix/sdk/idb-persistence.test.ts: 9/9 passed.pnpm check:changed: passed.