Repository navigation
fix(matrix): retire shared E2EE clients safely - #119570
Conversation
Punchcard-Session: silver-valley-valley-dt
Punchcard-Session: silver-valley-valley-dt
|
Codex review: found issues before merge. Reviewed August 5, 2026, 6:30 AM ET / 10:30 UTC. ClawSweeper reviewWhat this changesThe PR replaces individual Matrix E2EE QA operation shutdowns with one shared lifecycle intended to bound active work, decrypt draining, and client teardown. Merge readinessKeep open: the proposed lifecycle still permits an unbounded final persistence wait and drains while Matrix sync is active. Likely related people: Peter Steinberger (recent QA cleanup, high confidence) and Dallin Romney (Matrix E2EE feature history, high confidence). Priority: P2 Review scores
Verification
How this fits togetherQA Lab creates disposable Matrix E2EE clients for live encrypted-message scenarios. Their operations, decryption retries, and persistence must terminate predictably so a QA worker can release or report an actionable failure. flowchart LR
Scenario[Live Matrix QA scenario] --> Client[Disposable E2EE client]
Client --> Operations[Tracked SDK operations]
Operations --> Lifecycle[Bounded shutdown lifecycle]
Lifecycle --> Sync[Stop Matrix sync]
Sync --> Drain[Drain decryptions]
Drain --> Persist[Persist or discard state]
Persist --> Outcome[Scenario result and worker release]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +77, Tests +162. Total +239 across 3 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Pause sync before draining, then make persistence either cancellable within the remaining deadline or explicitly discard state before starting an operation that cannot be bounded. Do we have a high-confidence way to reproduce the issue? Yes, from source: a never-settling final persistence promise is awaited outside the lifecycle deadline, and sync remains active during drain. A focused fake-timer regression can demonstrate both paths without a live Matrix account. Is this the best way to solve the issue? No: centralizing the lifecycle is the right owner boundary, but it must pause sync before drain and cannot claim bounded shutdown while final persistence is unbounded. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 637de7d37945. 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
|
Punchcard-Session: silver-valley-valley-dt
Punchcard-Session: silver-valley-valley-dt
|
Merged via squash.
|
…cope * origin/main: (70 commits) fix(clickclack): preserve MIME extension for unnamed uploads (openclaw#119646) fix(memory): keep post-ready RPCs responsive (openclaw#119710) fix(browser): preserve locale, timezone, and device overrides (openclaw#119695) fix(agents): stop messaging dedupe from dropping final replies that quote a short tool send (openclaw#118178) test(agents): batch code mode budget proof (openclaw#119699) fix(memory): keep gateway RPCs responsive during startup (openclaw#119676) improve(ui): trail transient session status beside row actions (openclaw#119560) refactor(msteams): consolidate channel action target resolution (openclaw#119632) fix: tail context answers the current user message (openclaw#117364) fix(whatsapp): exercise descriptor-safe credential persistence (openclaw#119621) fix(diagnostics-otel): route OTLP endpoints by signal (openclaw#101655) refactor(skills): consolidate workshop transcript and record normalization (openclaw#119643) fix(video): harden DashScope task and media lifecycle (openclaw#117303) refactor(transcripts): consolidate persistence and export ownership (openclaw#119634) fix: preserve ClickClack discussion state contracts (openclaw#118851) fix(matrix): retire shared E2EE clients safely (openclaw#119570) refactor(cron): unify catch-up persistence and payload encoding (openclaw#119636) refactor(ui): centralize composer attachment and capability controls (openclaw#119650) refactor(daemon): consolidate managed service lifecycle ownership (openclaw#119647) fix(browser): honor explicit navigation timeouts across browser drivers (openclaw#119654) ...
* fix(qa): bound Matrix E2EE client shutdown Punchcard-Session: silver-valley-valley-dt * fix(qa): drain Matrix decryptions before SDK shutdown Punchcard-Session: silver-valley-valley-dt * fix(matrix): retire shared E2EE clients safely Punchcard-Session: silver-valley-valley-dt * fix(matrix): satisfy lifecycle lint gate Punchcard-Session: silver-valley-valley-dt
Related: #76611
What Problem This Solves
Fixes an issue where encrypted Matrix shutdown could hang or preserve an unsafe sync cursor when monitor work, transient sends or controls, or event decryption was still active.
The exact-main full QA profile exposed the production lifecycle defect as two Matrix E2EE scenarios held until the outer workflow timeout and one sync-state-loss failure:
https://github.com/openclaw/openclaw/actions/runs/30983891496
Why This Change Was Made
Matrix client ownership now lives in one account-keyed shared generation with role-aware monitor and transient leases. Retirement moves through
open -> quiescing -> closing: freeze sync-cursor persistence, stop the version-pinned classicmatrix-js-sdksync loop, drain decryptions and monitor tasks, bound transient lease drain, then stop the SDK and persist crypto before marking the sync cursor clean.If sync cannot quiesce, the generation is poisoned and pending cursor state is discarded rather than persisted or silently reopened. Fully stopped SDK clients are terminal, matching the upstream Rust-crypto contract; later work acquires a fresh generation.
This does not add config, protocol, dependency, release, tag, package-publish, or version changes. Cursor journaling in #110568 and crash-downtime replay in #116934 remain separate concerns.
User Impact
Operators get deterministic Matrix shutdown behavior across monitors and one-off actions. Active work is no longer torn down underneath listeners or decrypt retries, and an uncertain shutdown cannot advance the durable sync cursor.
QA operators get prompt scenario failures with retained workflow evidence instead of workers lingering until the outer Actions timeout.
Evidence
prepare-runpassed without rebasing because current-main Matrix files do not overlap.git diff --check: passed.string-widthis 4.2.3 while the lockfile requires 8.2.2; exact-head CI will run with a clean dependency install.Punchcard-Session: silver-valley-valley-dt