Repository navigation
fix(qa): await Matrix E2EE room readiness - #119920
vincentkoc wants to merge 8 commits into
Conversation
Punchcard-Session: quiet-valley-meadow-gq
Exact-head real-behavior proof (AWS Crabbox)Attaching the exact-head Tuwunel Matrix E2EE proof referenced in the PR body ("Note on prior remote run"). This supersedes the earlier dirty-sync run and is asserted against this PR head.
Results:
This confirms, on the exact PR head, that encrypted-room sends only proceed after authoritative readiness and that published QA artifacts stay redaction-safe. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed August 6, 2026, 7:36 PM ET / 23:36 UTC. ClawSweeper reviewWhat this changesThis PR makes Matrix E2EE QA clients wait for a live, joined, crypto-ready room before sending and ensures all shutdown cleanup steps are attempted. Merge readinessNo concrete exact-head defect was found; the prior cleanup and abort-settlement findings are addressed. Keep this maintainer-authored, protected, draft PR open for owner handling and an exact-head refresh after current-main integration. Priority: P2 Review scores
Verification
How this fits togetherMatrix QA provisions disposable encrypted clients and a local Tuwunel harness to exercise channel behavior. SDK sync state feeds a readiness gate before scenario traffic, while shutdown removes private runtime state after scenarios finish or fail. flowchart LR
A[Matrix sync event] --> B[SDK state bridge]
B --> C[Room readiness gate]
C --> D[QA E2EE scenario]
D --> E[Client shutdown]
E --> F[Private runtime cleanup]
Decision needed
Why: The maintainer label and MEMBER authorship require explicit owner handling even though no code finding remains. Before merge
Agent review detailsSecurityNone. PR surfaceSource +323, Tests +1369. Total +1692 across 29 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep cache provenance at the SDK producer and explicit room readiness in the QA client; make the PR ready against current main and retain exact-head dependency, lifecycle, and live-harness proof before landing. Do we have a high-confidence way to reproduce the issue? Yes for the QA path: current-main accepts generic sync readiness while the branch's focused tests model cached PREPARED followed by live room hydration. Direct matrix-js-sdk source inspection was unavailable in this checkout, so confidence is source-based rather than independently live-reproduced. Is this the best way to solve the issue? Yes: recording cache provenance at the SDK event producer and requiring named rooms only in the QA client is preferable to a per-send production wait or treating cached sync as authoritative. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d64f5b6a0960. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
Punchcard-Session: cobalt-valley-meadow-mg
Punchcard-Session: cobalt-valley-meadow-mg
Punchcard-Session: cobalt-valley-meadow-mg
Punchcard-Session: cobalt-valley-meadow-mg
Punchcard-Session: cobalt-valley-meadow-mg
|
@clawsweeper re-review Exact head: Current hosted proof: AWS Linux/Tuwunel Prior rank-up moves are dispositioned:
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Punchcard-Session: cobalt-valley-meadow-mg
Punchcard-Session: cobalt-valley-meadow-mg
|
Thanks for the PR. We're closing older pull requests that have gone stale against current This draft has had no commits since August 6 and has not been refreshed against current main. Please reopen a fresh PR if the Matrix E2EE readiness wait is still needed. |
Related: #110968 #117390 #119570
What Problem This Solves
OpenClaw's Matrix E2EE QA clients could treat a cache-restored
PREPAREDsync state as live readiness and send before joined-room membership and per-room crypto state were authoritatively hydrated. The harness also had lifecycle paths where cancellation, cleanup, or restart failures could outlive shutdown, suppress a primary error, skip later cleanup, or retain secret-bearing Tuwunel runtime files.Why This Change Was Made
The readiness invariant is owned by the Matrix SDK client lifecycle, so the SDK now records
SyncStateData.fromCacheat the producer boundary and exposes a bounded, abortablewaitForEncryptedRoomReady(...). It resolves only after:PREPAREDorSYNCINGstate;/joined_roomsresponse.The supplied abort signal now propagates through the transport request. Readiness abort waits for the joined-room request to settle before client shutdown and startup rollback.
The Matrix QA lifecycle now uses one ordered error-accumulation invariant across shared driver/observer startup, bootstrap, room, isolated-room, CLI gateway, adapter, and harness cleanup:
AggregateErrormessage, ordered primary first, withcauseset to the primary;User Impact
Matrix E2EE QA sends now wait for authoritative live readiness instead of racing cache restoration. Lifecycle failures retain the original operational cause without hiding cleanup failures, and secret-bearing Tuwunel runtime state is removed on every attempted shutdown path. Production Matrix channel delivery semantics are unchanged.
Scope
No config, protocol, SQLite, release, or production device-deletion policy changes. Separate production Matrix/device-recovery issues remain separate.
Evidence
Exact PR head:
c6b7a52ae9b897201cd556fbe05258e84e5b6d07Production LOC: +597/-280 (net +317)
Tests/internals: +1363/-45 (net +1318)
The production growth is justified by the SDK readiness/cancellation contract and the QA lifecycle/security ownership invariant. The test growth covers complete shared/CLI failure matrices, bootstrap, room/fault/recovery/isolated cleanup, Docker settlement, readiness abort settlement, and config restoration after restart failure.
Independent focused local proof on this exact head:
oxfmt --checkpassed on all 18 locally changed files.git diff --checkpassed.origin/main(9c2dbf6500f16cafc6c68edbc3144b9acf06fe56) is conflict-free.Direct dependency contract rechecked against installed
[email protected]source/types:SyncState.Preparedmay be emitted from cached sync withfromCache: true.PreparedandSyncing.isEncryptionEnabledInRoom(roomId).getJoinedRooms()is the authoritative/joined_roomsrequest.Exact-head hosted Linux/Tuwunel proof:
run_f27d91de0ed6ran the 233 focused tests, private-QA build, and all three live scenarios on AWS Linux/Tuwunel. The scenarios passed. Its outer proof failure came from a post-run assertion that misspelledmatrix-e2ee-...asmatrix-e2e-...; it was not a scenario failure.run_0e5f7dbd1cd5reran the live scenarios after establishing zero harness directories and zero containers. It exited 0 and attachedrun_0e5f7dbd1cd5-artifacts.tgz, rooted at.artifacts/qa-e2e/pr-119920-9b51b5706405/.matrix-e2ee-basic-reply,matrix-e2ee-sync-state-loss-crypto-intact, andmatrix-e2ee-artifact-redaction: 3/3 passed.matrix.legacy-state; encryption setup and artifact safety are recorded asmatrix.encryption-setupandsecurity.redaction-artifact-safety.[email protected]push-rule diagnostics sourced tolib/pushprocessor.js:123,126; non-allowlisted stderr was 0 bytes. The Crabbox proof command itself emitted 0 stderr bytes.Exact-head AWS fresh-PR diagnostic:
run_a4a193ecd39eused the trusted secretless bootstrap, verified exact headc6b7a52ae9b897201cd556fbe05258e84e5b6d07, and launched a transport-resilient detached diagnostic.BUILD_RC=0andQA_RC=0. Canonical scenariomatrix-e2ee-dm-sas-verification: 1 total, 1 passed, 0 failed, 0 skipped; schema v2 full evidence passed withmatrix.encryption-setup; scenario wall time was 93.115s.a29cd0e8e7e1cab1fa4205800796e7113c32846137a5f3c8921b78c02a27b5a1; evidenceea49c05d17272ffc49832cbdd5fc02722c414ceb45d95cdb15ff33600c216d74; reporte0641037c1142d8177790f84eb6c7a44f76b78b39bb2ec5409cdf41e7c97dfcc.[email protected]shutdown warnings:OutgoingRequestsManager was stopped,null pointer passed to rust, andMatrixClient has been stopped. This is not a clean or zero-stderr crypto shutdown. The warnings are inherited current-main lifecycle follow-up scope linked to fix(matrix): retire shared E2EE clients safely #119570 and Matrix crypto-store: state only persisted on 60s timer + sync stop helpers do not await final persist (E2EE decryption breaks across restarts) #76611; this PR does not fix them.The two harness directories seen after the focused test phase were created during
harness.runtime.test.tsfault-injection mocks before the live run. The final proof removed only those current-run test artifacts, established a clean baseline, and reran the live scenarios to measure production cleanup independently.The prior run
run_d747c0af17becovered only original head792903094f95408d054248f340b4256f2270738fand remains historical evidence, not proof for the current head.Fresh branch autoreview on the exact head was clean with no actionable findings. The PR remains draft because GitHub Actions is in a major outage and the exact hosted gates are queued.
ClawSweeper
The latest durable review is pinned to original head
792903094f95408d054248f340b4256f2270738f. Every item in itsRank-up moves:section is implemented and independently verified:The duplicate security/availability checklist items in that review are closed by the same two repairs. The requested exact-head re-review remains queued in ClawSweeper's runner infrastructure; it would refresh the rating but does not add an undispositioned move. Independent exact-head review, hosted proof, autoreview, and repo-native review artifacts found no remaining candidate defect.
Issue Reconciliation
Landing this PR closes none of the production Matrix issues or competing PRs listed below.
Punchcard Receipts
Original PR receipt:
pc1.cHVuY2hjYXJkLXNlcnZlci1yZWNlaXB0LXYxAGF0dF8wMUtaQkJXMTlNTjBUS0pTMldNRVJORzEwMAB0bn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