Skip to content

fix(matrix): persist private crypto state before key uploads - #147457

Open
shad0wca7 wants to merge 2 commits into
openclaw:mainfrom
shad0wca7:kit/matrix-key-publication-durability
Open

shad0wca7 wants to merge 2 commits into
openclaw:mainfrom
shad0wca7:kit/matrix-key-publication-durability

Conversation

@shad0wca7

@shad0wca7 shad0wca7 commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Closes #147450
Related: #123354 (separate received/outbound session crash paths remain outside this PR).

What Problem This Solves

Matrix can publish one-time keys before the matching private crypto account is durable, leaving unusable keys or conflicting upload IDs after an interruption. Save the account-scoped snapshot before publication and reject the upload if that save fails. This prevents recurrence; it does not repair an already inconsistent server key pool or reset device identity.

User Impact

Private account state must be saved before its public keys are published. Storage failures block publication until account-scoped storage is repaired and the upload is retried. Matrix-maintainer acceptance of that fail-closed tradeoff remains outstanding.

Why This Change Was Made

The barrier runs inside the existing guarded fetch beforeRequest hook, after recovery-key persistence and message-dispatch checks. It carries originating generation, caller authority and cancellation through awaited persistence into existing SQLite action-authority admission. Ordinary requests do not load the crypto runtime. Current-main session/lifecycle owners are preserved; no snapshot-format, dependency or scope change is introduced.

Evidence

Tested candidate: 2592b4812a4db60e8bf5a44b44f7961331724be9 (2026-10-16 UTC), compared with pinned base 0dc31f5f64309d199f12aea643452bfde54f4888. Conflict-only rebase preserves the upload barrier and originating write authority while adopting upstream's void snapshot-lock callback.

  • Focused SDK fetch-boundary proof: 10 passed / 97 unrelated cases skipped, including stopped-before-entry, retirement during awaited persistence, storage refusal and ordinary account-data requests. Original-generation authority RED/GREEN proof remains recorded from the prior implementation; no new runtime result is claimed for the rebase.
  • Current-candidate extension production/test types, seven-file lint (zero warnings/errors), formatting, diff and line-cap/assertion ratchets: passed. Native selected Matrix package boundary plus negative canary: passed, 25.59 seconds wrapper wall time; one package compiled.
  • Additional current-base baseline ratchets: passed: conflict markers, database-worker (T1 222 → 222; deprecated compatibility 12 → 12), database-dialect (zero construct-group growth), and test-timeout-race.
  • Max-lines ratchet: exit 1 on both candidate and clean pinned base with identical diagnostics, solely for unchanged ui/src/pages/chat/components/chat-message.test.tsx, ui/src/pages/config/config-page-state.ts and ui/src/pages/sessions/sessions-page-state.ts suppressions. No baseline or suppression was changed; this check is not claimed green.
  • Prior-head doctor/plugin contracts, dead-export scans and runtime checks are historical evidence, not new-base full-repository validation. Current-head CI owns broad proof. Range-diff and source inspection confirm this rebase preserves the reviewed persistence ordering, strict account-scoped state and live authority; the second commit is patch-equivalent.
  • Real SDK/Rust crypto + SQLite runtime and published v2026.10.1 upgrade evidence was captured on prior head 7f756b78473be542b0ce1fe484dfa32ddc230262, not rerun on this candidate. The loopback fixture proved durable-before-HTTP, storage refusal/recovery, retirement rejection, restart identity, and retained stable device/one-time-key state. Its stable-process teardown timeout and non-homeserver scope remain explicit.
  • Independent 2026.10.1 live-lab report used manually ported production hunks, not this exact head; later inbound/outbound crash failures remain outside scope.

New-head CI and automated review must be assessed separately. No merge, maintainer acceptance, current-candidate real-homeserver proof or automatic background retry behavior is claimed.

@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added channel: matrix Channel integration: matrix size: S labels Sep 13, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR saves private Matrix crypto state before uploading public keys and rejects publication when that save fails.

Example: An encrypted Matrix device uploads 50 signed one-time keys, then the process is interrupted.

  • Before: The homeserver can retain public keys whose private halves were never saved durably.
  • After: The account snapshot must finish before HTTP publication; a storage failure prevents the upload.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The bounded patch and production-boundary evidence are credible; overall readiness remains capped by the unresolved publication-policy decision.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The recorded production Matrix client used real SDK/Rust crypto, SQLite workers and HTTP transport to prove durable-before-publication, storage refusal/retry, retired-generation rejection and restart continuity on the earlier head; source inspection verifies the extraction preserves those paths, with loopback and stable-seed teardown limits retained.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete
User problem: After an interruption, encrypted Matrix devices can advertise public keys whose private halves are missing from retained state.
Reason: The recurrence-prevention value is established, but the deliberate storage-failure publication policy remains an explicit owner call.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: current main still lacks the key-publication durability barrier, and this PR contains useful, bounded work with no verified introduced defect.

Priority: P1
Reviewed head: c99873735c3248f69b8023192dca03860fb0593e
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should Matrix key uploads be rejected until account-scoped persistence succeeds, including on existing installations with failing storage?
  • Recommendation: Accept the fail-closed barrier: Require durable private state before exposing public keys and accept repair plus explicit retry when storage fails.
  • Why: This changes publication from proceeding despite snapshot failure to blocking encrypted key publication, and the recorded discussion explicitly leaves that tradeoff unaccepted.

Before merge

  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

None.

Agent review details

How this fits together

The Matrix plugin connects SDK-generated key-upload requests to guarded HTTP transport and account-scoped SQLite snapshots of the Rust crypto store.

flowchart TD
  A[Matrix Rust crypto] --> B[SDK key upload]
  B --> C[Guarded fetch]
  C --> D[Live authority checks]
  D --> E[Account snapshot]
  E --> F[SQLite write admission]
  F --> G[Homeserver publication]
Loading

Technical review

Best possible solution:

Accept the bounded durability barrier with an explicit owner decision on storage-failure rejection, while retaining separate session-crash work.

Do we have a high-confidence way to reproduce the issue?

Current-main source exposes the ordering gap, and the linked report plus recorded runtime observations support it; this read-only review ran no target code.

Is this the best way to solve the issue?

The pre-publication boundary is the correct place to prevent recurrence, and forwarding authority into the existing SQLite owner avoids a competing persistence mechanism.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 3260cae2b3c6.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 66aee49 adds extensions/matrix/src/matrix/sdk/idb-persistence.ts:345 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 66aee491c332; files: extensions/matrix/src/matrix/sdk/idb-persistence.ts)
  • Vincent Koc: Raw commit d7c5771 adds extensions/matrix/src/matrix/sdk/idb-persistence.ts:334 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d7c57716841c; files: extensions/matrix/src/matrix/sdk/idb-persistence.ts)
  • Agustin Rivera: Raw commit 4ba65fc adds extensions/matrix/src/matrix/sdk/client-base.ts:591 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4ba65fccf9bc; files: extensions/matrix/src/matrix/sdk/client-base.ts)

PR surface

Source +141, Tests +207. Total +348 across 7 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 5 151 10 +141
Tests 2 222 15 +207
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 373 25 +348

Review metrics

Metric Value Why it matters
Production versus test LOC Production +151/-10; tests +222/-15 Growth implements one upload barrier through existing transport and persistence owners, with boundary regressions for ordering, refusal, retirement and restart.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The missing publication barrier can leave encrypted Matrix devices with unusable advertised keys after an interruption.
  • merge-risk: 🚨 compatibility: Existing installations with storage failures will stop publishing keys instead of continuing; that behavior requires the recorded owner decision.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (22 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-18T16:14:05.319Z sha 7bd58882f9469cb411418580e83841d830693091 :: blocked before merge. :: none
  • reviewed 2026-09-18T17:00:03.222Z sha 104fd26d2f4e62f86dd65405ab19fe9a35ac09da :: blocked before merge. :: none
  • reviewed 2026-09-20T11:01:58.897Z sha 1130c7fa0afa42fbccc5f3c918167a5e7419f613 :: blocked before merge. :: none
  • reviewed 2026-09-20T12:44:15.336Z sha c591b31d2319fdde1316c9420244c92094d1bced :: blocked before merge. :: [P2] [P2] Remove the recovery helpers duplicated by the rebase
  • reviewed 2026-09-20T13:52:18.102Z sha f9d8c8fd2976deb32ed789a62247bf688b2e7e8f :: blocked before merge. :: none
  • reviewed 2026-09-27T21:06:04.630Z sha f9d8c8fd2976deb32ed789a62247bf688b2e7e8f :: needs real behavior proof before merge. :: [P1] Authorize the client before writing its crypto snapshot
  • reviewed 2026-10-11T11:49:33.161Z sha 7f756b78473be542b0ce1fe484dfa32ddc230262 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-11T12:13:32.126Z sha 7f756b78473be542b0ce1fe484dfa32ddc230262 :: blocked before merge. :: none

Reviewed October 12, 2026, 12:08 PM ET / 16:08 UTC (Revision 23).

@shad0wca7

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@shad0wca7

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Sep 14, 2026
@shad0wca7

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 14, 2026
@shad0wca7
shad0wca7 force-pushed the kit/matrix-key-publication-durability branch from 2ea2e85 to 6a8916e Compare September 14, 2026 15:57
@shad0wca7

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@shad0wca7

Copy link
Copy Markdown
Contributor Author

Fixed the current-head check-lint-core-5 failure by moving the key-upload persistence guard out of the over-limit client-base.ts while preserving the same fail-closed behavior.

Verified at 7cdd2217485:

  • focused oxfmt check: pass
  • focused oxlint: pass
  • extensions/matrix/src/matrix/sdk.test.ts: pass
  • git diff --check: pass

The existing runtime trace was not rerun; this commit is a structure-only extraction of the already-proven guard.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@shad0wca7

Copy link
Copy Markdown
Contributor Author

Fixed the remaining current-head check-lint-core-5 max-lines failure by moving the lazy crypto runtime loader into its own SDK module; behavior and lazy-load caching are unchanged.

Verified at acc7e76216c:

  • focused oxfmt check: pass
  • focused oxlint: pass
  • extensions/matrix/src/matrix/sdk.test.ts: 160/160 pass
  • git diff --check: pass

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot removed the rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. label Sep 14, 2026
@clawsweeper

clawsweeper Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 20, 2026
@shad0wca7

Copy link
Copy Markdown
Contributor Author

Finished the extracted Matrix recovery test helpers and published f9d8c8fd297 on the exact contributor branch.

Verification on this head:

  • changed-file oxfmt: passed
  • changed-file oxlint: passed with zero warnings
  • git diff --check: passed
  • focused Vitest could not start in the isolated worktree because fake-indexeddb is unavailable locally; no test result is claimed.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 20, 2026
shad0wca7 added a commit to shad0wca7/openclaw that referenced this pull request Sep 23, 2026
Squash of open upstream PR openclaw#147457 (head f9d8c8fd29) onto origin/main for integrate/live.
Upstream-PR: openclaw#147457
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels Sep 27, 2026
@bitfroest

Copy link
Copy Markdown
Contributor

Live-lab data for this PR, in case it helps the review. To be clear about scope up front: this is not the authority-chain proof the latest review asks for (stopped or reassigned client rejected before the snapshot write). It is a real-homeserver before/after for the crash paths in #165636 and #158784.

What was tested. Head f9d8c8fd no longer applies to current main or to v2026.10.1 (client-base.ts, idb-persistence.ts and sdk.test.ts conflict; the other four files apply). I therefore ported the production hunks by hand onto the published @openclaw/matrix 2026.10.1 build: the fetchFn wrapper, persistCryptoBeforeKeyUpload, and requireCryptoAccount. The test files were not ported and not run. So this is evidence for the PR's behaviour on 2026.10.1, not a test of the exact head commit.

Lab. OpenClaw 2026.10.1 from npm in an isolated state dir, local tuwunel 1.9.3 homeserver, production SQLite sync store, scripted matrix-js-sdk peer with Rust crypto, fresh bot account and empty crypto store per run, SIGKILL as the crash.

Scenario 2026.10.1 unmodified 2026.10.1 + this PR's hunks
First contact: peer sends M1, kill 3-7 s later, restart, M2 in the same Megolm session bot cannot decrypt M2, 3/3 bot decrypts M2 and answers, 3/3; the answer is undecryptable for the peer, 3/3
Later traffic: wait for a 60 s snapshot tick, new room with key exchange over the existing Olm session, kill, restart bot answers nothing any more (same session and two fresh rooms), 3/3 same as unmodified, 1/1
Clean stop instead of kill (control) ok, 1/1 not run

Reading.

  • The fence fires in a real run: two strict persists per first contact (the initial upload and the one-time-key replenishment about 1 s after M1), 24-790 ms each on a fresh ~20 KB store.
  • The first-contact improvement is a side effect: the replenishment upload happens to snapshot the room key that had just arrived. When no one-time key is consumed (second row), there is no upload, no persist, and the outcome is unchanged. That matches the PR description, which does not claim to cover received keys.
  • The undecryptable answer in the first row is the outbound symptom described in Matrix crypto-store: stale snapshot restored after unclean shutdown regresses Olm ratchets, permanently breaking outgoing E2EE #158784 (snapshot older than the state the peer has seen). The PR does not cause it, it makes it visible in this scenario because the bot now gets far enough to answer.

On the authority finding (code reading against current main, not exercised live):

  • Current main already drains recoveryKeyStore in the guarded fetch's beforeRequest hook (client-base.ts, passed to createMatrixGuardedFetch), so that part of the fetchFn wrapper is now redundant.
  • Moving the persist into the guarded fetch's beforeRequest hook closes the PR head's immediate authority bug: the transport checks request/send authority and abort state before entering the hook and checks them again before HTTP dispatch, so an already stopped or reassigned generation cannot start the snapshot. One race remains: authority can expire while the awaited snapshot is running, allowing the retired generation's SQLite write to complete even though the later HTTP dispatch is rejected. Because generations share the account-scoped snapshot path, the final design should serialize snapshot commits with generation retirement or make the commit generation-aware, and add regressions for both stale-before-entry and reassignment during the awaited persist.

Not tested: the exact head commit, the PR's unit tests, storage-failure behaviour, Synapse, key backup.

written by an AI agent (kumo) on behalf of @nissl24

@shad0wca7

Copy link
Copy Markdown
Contributor Author

Thanks for the carefully scoped lab results. They support the first-contact durability benefit on your ported 2026.10.1 build, not exact-head verification or a fix for later received-session/outbound-state persistence. I will keep those limits explicit rather than extend this PR to the adjacent crash paths.

Your authority analysis matches the current source: the guarded fetch already drains recovery-key persistence, while this PR places the snapshot before that guard. Moving the fence into beforeRequest addresses stale-before-entry, but a post-await network check alone cannot establish that an obsolete generation made no SQLite write. The repair needs final-write authority/retirement coordination, with separate regressions for a stopped client before entry and reassignment during persistence. Neither that repair nor those regressions are complete yet; the existing runtime proof does not establish them.

The separate Matrix-maintainer decision on fail-closed key publication during storage failure remains unchanged.

@shad0wca7
shad0wca7 force-pushed the kit/matrix-key-publication-durability branch from f9d8c8f to 7f756b7 Compare October 11, 2026 11:39
@shad0wca7

shad0wca7 commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Current-head runtime evidence for 7f756b78473be542b0ce1fe484dfa32ddc230262 (2026-10-11 UTC):

I exercised the production Matrix client and guarded fetch with installed matrix-js-sdk 42.4.0, real Rust crypto WASM, the real SQLite worker owner, and an ephemeral loopback HTTP server. No SDK or transport mock was used. Initial publication used the SDK outgoing processor's actual Rust-generated signed device/one-time-key request.

Observed at the loopback server and canonical store:

  • Successful key publication reached HTTP only after a readable durable snapshot containing the real Rust crypto account existed.
  • Injecting a storage-write refusal produced no additional HTTP request. An explicit retry after removing the refusal succeeded.
  • Holding the real persistence registration, retiring the original client via its production cancellation path, then releasing the registration produced no additional HTTP request and left the authoritative snapshot byte-for-byte unchanged.
  • Clearing in-memory IndexedDB and reconstructing the production client from SQLite retained the Rust device keys; a subsequent SDK key upload succeeded.

The proof passed in the broker-capable process-fork lane: 602 ms scenario time, 8.36 s total wrapper time. The held-write/storage-refusal scheduling seams delegate successful writes to the actual state owner. Failure/recovery/retirement/restart explicitly replay the Rust-generated signed payload through SDK uploadKeysRequest; they do not claim automatic background retry behavior. Only hashes of snapshots/device keys were retained in the terminal summary; disposable state and the loopback server were retired.

Limits remain explicit: the server is a fixed loopback protocol fixture, not a real Matrix homeserver, and the earlier current-head restart alone was not a v2026.10.1 upgrade. Existing Matrix-maintainer acceptance of fail-closed publication also remains outstanding; this evidence neither resolves that decision nor expands the fix to received-session/outbound-ratchet crash paths.

Published v2026.10.1 upgrade evidence (2026-10-11 UTC)

In a separate disposable fixture I used the integrity-verified published openclaw and @openclaw/matrix 2026.10.1 npm packages with their installed dependencies. The stable production Matrix client initialized a real Rust account and persisted it through the published stable core SQLite owner. Opening that unchanged state with candidate 7f756b78473be542b0ce1fe484dfa32ddc230262 retained the identical device keys and all 50 Rust-generated signed one-time keys; the candidate SDK then uploaded those keys successfully to an ephemeral loopback HTTP fixture. No snapshot reshaping or candidate core was used to seed the stable state. Candidate proof passed: 586 ms scenario, 22.44 s wrapper.

Teardown limitation: the stable seed emitted its successful persistence receipt but did not exit within its 60-second bound; the wrapper terminated it, and its absence was verified before the candidate opened the state. This is not a claim of a fully passing stable-process lifecycle run. The continuity proof covers device identity and private one-time-key state, not received Megolm sessions or outbound ratchets. This remains a loopback protocol fixture, not real-homeserver verification. The existing Matrix-maintainer policy decision remains outstanding.

Persist the private crypto-state snapshot before publishing room keys so a
crash or storage failure cannot leave uploaded keys without recoverable
local state. Key uploads fail closed when the snapshot cannot be stored.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: matrix Channel integration: matrix merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Matrix key uploads can precede durable private-key persistence

2 participants