Repository navigation
fix: restore Matrix context reads in official installs - #147665
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 14, 2026, 7:31 AM ET / 11:31 UTC (Revision 5). ClawSweeper reviewWhat this changesRestores six scoped Matrix context reads in official installations and preserves caller and plugin authorization through HTTP requests, crypto maintenance, and client cleanup. Merge readiness⛔ Blocked before merge - 1 item remains This PR remains necessary: current main lacks Matrix’s read-authority participation. No blocking defect was found, and the updated package qualification resolves the previous review’s outstanding request. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s message tool delegates Matrix reads to the selected account’s room and DM policies. The Matrix client then retrieves provider data while the host controls whether the originating caller and plugin instance remain authorized. flowchart TD
A[Agent message tool] --> B[Host caller and plugin authority]
B --> C[Matrix account and room policy]
C --> D[Shared Matrix client]
D --> E[HTTP and crypto maintenance]
E --> F[Authorized result delivery]
B --> F
G[Plugin disposal] --> D
Before merge
Agent review detailsSecurityNone. PR surfaceSource +258, Tests +1263, Docs +6. Total +1527 across 22 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep Matrix on the existing host read-authority contract and distribute it through coordinated core/plugin version alignment with the qualified API floor. Do we have a high-confidence way to reproduce the issue? Yes: current main’s missing Matrix opt-in causes the dispatcher to enforce exact-current-conversation access for installed plugins. Source and supplied before/after boundary evidence establish the path; this read-only review did not execute it. Is this the best way to solve the issue? Yes: the patch reuses the established host authority contract and Matrix policy owner, with client-generation handling for shared crypto work and verified preservation of the previously tested implementation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ee0cf1662306. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
Preserve complete affected-test selection for common source names while retaining existing helper and tooling routing. Refs #147665.
Preserve complete affected-test selection for common source names while retaining existing helper and tooling routing. Refs openclaw#147665.
5cd15ab to
941c883
Compare
|
Fixed: scoped Matrix context reads now work in official npm and ClawHub installs. |
What Problem This Solves
Fixes Matrix message-tool context reads that are rejected after installing the official plugin from npm or ClawHub, even when the same read succeeds with the bundled plugin and the selected Matrix account allows the destination.
For example, an agent responding in one room cannot read messages from another explicitly allowed room because the installed plugin is restricted to the exact current conversation. Matrix already has provider-owned room and DM checks for these reads, but it does not participate in the host's live read-authority contract.
User Impact
The official Matrix plugin supports the same six scoped reads across bundled and installed registrations:
read,reactions,list-pins,emoji-list,member-info, andchannel-info.The selected account's action settings and room/DM policy still govern access. Member profiles require membership in the authorized room. Custom emotes retain their existing combination of that room's packs and the account's personal pack. Verification, recovery-key access, mixed
permissionsoperations, and message mutations keep their existing authorization requirements.A completed, still-authorized read can return after normal one-off client cleanup. Actual caller or plugin revocation blocks late results, and a stopped client cannot start more network work.
Why This Change Was Made
Matrix now explicitly lists the six actions in
readAuthorityActions. The shared host already recognizes these context actions; an adapter must still opt each action in separately. This uses the contract from #143341 and the complete target-alias prerequisite in #147492. The merged Discord metadata support in #147658 supplies the host eligibility needed for Matrix member and emoji reads. This PR preserves that dispatcher and adds Matrix participation. The selection repair in #147754 is included in the base.Matrix has its own HTTP routes and injects a fetch implementation into
matrix-js-sdk. Both routes now retain the submitting read's authority through DNS resolution, redirects, body consumption, and dispatcher cleanup. The action/client helpers recheck that same authority after awaited preparation and cleanup.Encrypted reads also require shared SDK maintenance. The SDK's missing-key queue can process a later read under the first caller's asynchronous context. Crypto initialization, decryption retries, and that maintenance therefore run under the existing client's generation. A distinct read entered from an SDK callback retains its own caller check. This lets a valid read continue when an earlier caller expires, blocks a newly revoked caller inside a callback, and stops maintenance when its actual client closes.
Shared clients are attached to the exact registering plugin instance. Within this module’s shared client cache, acquisition under a replacement instance waits for the prior client to stop; late cleanup cannot stop its successor. Concurrent one-off preparation shares one crypto initialization, and shutdown joins pending initialization before closing the backend and releasing its asynchronous context.
Evidence
The final Matrix implementation and tests are byte-identical to validated source
941c883. The conflict resolution onto the landed Discord result keeps the target's dispatcher unchanged and adds Matrix's six-action documentation without replacing Discord's policy text. Proof retains its actual execution identities rather than relabeling earlier runs as the replayed head6ed4e50.941c883, using real handlers, SDK HTTP, host-created plugin instances, and normal client cleanup. They cover the six reads for bundled and official-installed registrations, room/action/account denials before provider access, membership before profile retrieval, caller and plugin revocation during preparation and content delivery, excluded actions, and partial declarations.4156bfd4of941c883into128bfff; Matrix implementation/test inputs are unchanged by those upstream changes. All 19 transport cases pass across JSON, raw, and SDK requests, covering initial and redirect DNS, body consumption, dispatcher cleanup, client shutdown, and a valid second read.941c883. The original closed-caller case received provider data; it now rejects before physical HTTP while the active-caller control succeeds. This is the corrected autoreview finding, independently reviewed with its regression proof. The original implementation also fails 14 transport/lifecycle cases and four crypto-initialization cases covering duplicate initialization and shutdown before initialization finishes.941c883pass full canonical core inventory/tarball checks, native npm and official ClawHub installation, SDK surface and runtime inspection, compiled-export and installed-entry byte checks, and all 16 behavior subprocesses (26 scenario cells). The 31 stages cover the six reads, policy denials, caller/plugin revocation points, successful cleanup, and unchanged installer configuration. Both registry fixtures stop and no task processes remain.pluginApi >=2026.9.5; this is a matching-core requirement, not compatibility with released core 2026.9.4 or an encrypted Matrix state-migration claim.The completed CI run has one unrelated Docker-helper assertion failure, with the aggregate gate reporting that failure. The identical existing assertion was reproduced on unchanged
46ac2bc: it expects the old ClawHub fixture name while its consumed script uses the renamed fixture. All 16 relevant test/script/tooling inputs match the CI tree, and Matrix changes none of them. The existing repair is #148118; no Matrix behavior or test assertion was weakened.Representative reproducible integration commands:
Matched original and candidate reload captures reproduce the same pre-existing loss of a synthetic backup-key marker when an older client persists late; both clean controls retain it. This bounded persistence finding remains a separate non-blocking follow-up. The Matrix patch does not change the snapshot algorithm or Gateway reload policy.
Package tests use native installers with synthetic provider and registry responses. No release was published and no live Matrix service was used.