Repository navigation
fix(matrix): prevent shared clients from colliding across accounts - #119667
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 5, 2026, 4:31 PM ET / 20:31 UTC. ClawSweeper reviewWhat this changesThis PR serializes the complete Matrix account identity tuple as JSON so delimiter-containing authentication values cannot make separate accounts share one client generation. Merge readinessKeep open: current main still uses an ambiguous delimiter-joined Matrix shared-client key, while this PR repairs that owner boundary with focused regression and runtime evidence. Priority: P1 Review scores
Verification
How this fits togetherThe Matrix plugin maps account authentication to a process-local shared client generation, which owns startup, encryption preparation, leases, and retirement. Bootstrap and monitoring flows acquire those generations before performing Matrix work. flowchart LR
A[Matrix account authentication] --> B[Shared client identity key]
B --> C{Existing generation?}
C -->|yes| D[Reuse client lease]
C -->|no| E[Create Matrix client]
D --> F[Crypto and lifecycle]
E --> F
F --> G[Bootstrap and monitor flows]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -2, Tests +44. Total +42 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Merge the structured producer-side key and keep the collision-plus-lease regression as the canonical protection for Matrix shared-client identity. Do we have a high-confidence way to reproduce the issue? Yes. The legacy key visibly maps the supplied delimiter-shaped tuples to the same joined string, and the exact-head harness records isolated real-client behavior after the change. Is this the best way to solve the issue? Yes. Encoding the existing ordered identity tuple once at the shared-client producer prevents aliasing without adding escaping rules, downstream guards, config, or a parallel lifecycle path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2db3431f4aa1. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
Maintainer outcome for exact head |
|
Merged via squash.
|
…cope * origin/main: (24 commits) fix(backup): skip transient gateway lock databases (openclaw#119782) test(agents): use canonical auth session fixtures (openclaw#119821) fix(memory): keep QMD file hints after stale docid misses (issue openclaw#113041) (openclaw#113515) test(doctor): align fast-path repair contracts (openclaw#119812) perf(agents): index subagent recovery ownership (openclaw#119793) fix(gateway): keep chat startup off catalog discovery (openclaw#119742) fix(test): keep TUI PTY suites in their owner lane (openclaw#119787) docs: correct dashboard auth precedence (openclaw#119785) docs: document control ui owner handoff fix: grant host-authorized control ui owner access fix(worktrees): preserve registered roots during orphan cleanup (openclaw#119709) fix(matrix): prevent shared client key collisions (openclaw#119667) fix(diagnostics-otel): propagate exported span context (openclaw#112283) fix(worker): isolate state observer failures (openclaw#117507) fix(qa): attest realized profile executions (openclaw#119761) fix(gateway): finish successful sessions after timestamp races (openclaw#119752) fix(agents): fence restart recovery lifecycle (openclaw#119776) fix(ui): preserve chat history and active run timing (openclaw#119729) improve(ollama): reduce inactive startup cost (openclaw#119745) improve(gateway): defer inactive plugin runtime imports (openclaw#119733) ...
AI-assisted: This change was developed with Codex.
What Problem This Solves
Fixes an issue where distinct Matrix authentication configurations could resolve to the same module-global shared client state when raw tuple fields formed the same delimiter-joined key. This could couple client identity, encryption preparation, startup state, and lease ownership across accounts.
The regression uses a historical Matrix user ID shape that Matrix clients are required to accept.
Why This Change Was Made
The shared-client identity tuple is now serialized as one JSON value instead of joining independently serialized fields with
|. The same seven fields and boolean normalization remain part of the key, so ordinary sharing behavior is unchanged while field boundaries become unambiguous.User Impact
Distinct Matrix accounts keep independent client, crypto, startup, and lease state even when their authentication values contain delimiter-shaped text. Repeated requests for the same account still share one client normally.
Evidence
6561fa6a08bd00d5e6a7d9a1640e12aaf067a66d.real-client=true distinct=true same-auth-reused=true first-release-held=true first-release-final=true second-release-final=true secret-output=false.mainat414616f583897a161645d0b15faffb6c41542845was merged without changing the two-file PR surface; the regression test now exercises the generation-lease API.29175dd11e90335e608543cd83b2ae66f5bd69d9returned the first tuple's client for the second colliding tuple.git diff --checkpassed.