Repository navigation
fix(matrix): preserve encryption keys across snapshot upgrades - #112919
Merged
Merged
Conversation
steipete
marked this pull request as ready for review
July 23, 2026 05:23
Contributor
Author
|
@clawsweeper re-review |
Contributor
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Contributor
Author
|
Merged via squash.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Jul 23, 2026
…law#112919) * fix(matrix): migrate legacy crypto snapshots via doctor * fix(matrix): harden snapshot migration failures * fix(matrix): preserve unreadable crypto snapshots * test(matrix): consolidate crypto snapshot coverage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Fixes an issue where Matrix users upgrading from releases that wrote
crypto-idb-snapshot.jsoncould have encryption state imported, renamed, or bypassed by the running client instead of by the explicit upgrade repair flow. This runtime fallback shipped in v2026.6.10 through #91100 (0566b969274) and could leave encryption keys split between a legacy sidecar and canonical SQLite state.Why This Change Was Made
The existing Matrix legacy-crypto doctor migration is now the single owner for snapshot upgrades.
openclaw doctor --fixreads the legacy snapshot under the same cross-process lock used by runtime persistence, imports it to SQLite, reads it back for structural/content verification, and only then moves the original bytes to a timestamped recovery archive. Partial or invalid SQLite writes are repaired from a valid source; valid conflicts keep SQLite canonical and archive the differing source; malformed sources are archived without deletion; filesystem read failures leave the source active.The Matrix runtime now reads and writes SQLite only. If canonical state is missing or unusable while an active legacy snapshot exists, crypto startup and persistence fail closed with a typed, path-free diagnostic directing the operator to
openclaw doctor --fix.AI-assisted implementation; the final branch passed the repository's Codex autoreview gate.
User Impact
Upgrade behavior is explicit and one-time: run
openclaw doctor --fix, then restart Matrix. Doctor preserves the original snapshot bytes in a timestamped archive, while normal runtime no longer lazily imports or renames legacy snapshots. Existing valid SQLite state remains canonical, and unreadable key material is never moved or discarded.Release-note context: Matrix upgrades now migrate legacy crypto snapshots through doctor once; runtime no longer imports snapshot sidecars.
Evidence
extensions/matrix/src/matrix/sdk/idb-persistence.tsfrom refactor(matrix): store crypto sidecars in sqlite #91100 /0566b969274.OPENCLAW_HEAVY_CHECK_LOCK_SCOPE=worktree node scripts/run-vitest.mjs extensions/matrix/doctor-contract-api.test.ts extensions/matrix/src/matrix/sdk/idb-persistence.test.ts extensions/matrix/src/matrix/client/storage.test.ts— 3 files, 34 tests passed.node scripts/check-changed.mjs— hosted Blacksmith Testbox exit 0 on the production-equivalent patch before the final test-only consolidation; extension production/test typechecks, all-extension lint, formatting, database-first legacy-store guard, sidecar-loader guard, and import-cycle check passed. Run: https://github.com/openclaw/openclaw/actions/runs/299813976794f56ea5817f6efe0b677e0a7103d6efba05c323e— CI run https://github.com/openclaw/openclaw/actions/runs/29982021488 completed successfully; 176 check runs reported zero pending and zero failed.AR="$HOME/.claude/skills/autoreview/scripts/autoreview"; "$AR" --mode branch --base origin/main— clean, no accepted/actionable findings.git diff --check— clean.