Skip to content

Matrix channel: inbound DMs intermittently not dispatched to agent; no reply delivery; cross-user verification cannot complete (E2EE, self-hosted homeserver) #89254

Closed

Description

@sem00-ft

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

On OpenClaw 2026.5.28, an E2EE Matrix channel bound to an embedded (pi) agent intermittently fails to dispatch inbound DMs to the agent (~1 in 7), never delivers the agent's reply back to the room, and cannot complete cross-user SAS verification, while the homeserver serves all E2EE primitives correctly.

Steps to reproduce

  1. Self-hosted homeserver (tuwunel 1.7.0), LAN-only, federation off; bot account with E2EE bootstrapped (matrix encryption setup + verify bootstrap; verify status shows verified-by-owner, backup active, recovery key stored).
  2. Configure channels.matrix with the @openclaw/matrix plugin: encryption:true, autoJoin:"always", dm.policy:"open", bound via bindings to an embedded/pi agent.
  3. From a normal user, using a matrix-nio (0.25.2 + python-olm 3.2.16) client that trusts the bot device in code (client.verify_device), create a fresh encrypted DM, invite the bot (auto-joins), share the Megolm session, and send a message.
  4. Observe: the message is delivered and decryptable, but most sends produce no agent turn; when one does, no reply returns. Across 7 controlled runs (varied content, 12s settle delay, single room, fresh gateway restart): 1 dispatched, 0 replies.
  5. The same behavior reproduces through a real Element Web client.

Expected behavior

Every inbound DM in an allowed room is dispatched to the bound agent deterministically, and the agent's reply is delivered back to the (encrypted) room. A separate human user can verify the bot, or key-sharing works trust-on-first-use without verification.

Actual behavior

Inbound dispatch is intermittent: an encrypted DM reaches the bot and is decryptable, but only ~1 in 7 identical messages produces an agent turn; the rest are silently dropped (no agent invocation, no error logged). On the rare dispatched message, the agent's reply is never delivered back to the room (no [matrix] send line, no error). "[matrix] disabled" is logged at the end of provider startup every time, with encryption both true and false. Cross-user SAS verification (a human user ≠ bot owner verifying the bot) never completes: bot-initiated requests disappear from "verify list" almost immediately; user-initiated requests show "SAS data is not available" with the phase oscillating ready↔started.

OpenClaw version

2026.5.28

Operating system

Ubuntu 24.04

Install method

npm global (user-local), gateway run as a systemd --user service

Model

anthropic/claude-haiku-4.5

Provider / routing chain

matrix channel -> openclaw -> bound embedded/pi agent

Additional provider/model setup details

Bot connects to the homeserver locally over plaintext HTTP on 127.0.0.1:6167 (network.dangerouslyAllowPrivateNetwork:true). Homeserver is LAN-only with federation disabled.

Logs, screenshots, and evidence

Homeserver verified healthy independently of OpenClaw (raw client-server API + matrix-nio):
- sendToDevice relay works (user A -> user B delivered)
- bot device keys (curve25519 + ed25519) and cross-signing master/self-signing keys are published and visible to the user
- keys/claim returns a one-time key for both the bot and the user's Element device (both directions)
So an Olm session + Megolm key-share can be established at the protocol level; the homeserver serves every E2EE primitive the provider needs.

Impact and severity

Affected: self-hosted Matrix channel users on 2026.5.28 (multi-user E2EE bot pattern).
Severity: blocks workflow — the channel cannot be used for interactive sessions.
Frequency: intermittent dispatch (~1 in 7); reply delivery and cross-user verification fail consistently (7 controlled runs: 1 dispatched, 0 replies).
Consequence: missed messages and failed multi-user onboarding; the channel is unusable for its intended purpose.

Additional information

Not a regression — no earlier working version; broken on first deployment at 2026.5.28.

Open questions for maintainers:

  • Is the multi-user pattern (separate human users <-> one E2EE bot) supported, or only single-owner/self-verification today?
  • What does "[matrix] disabled" at the end of provider startup indicate? It correlates with the non-ingesting state.
  • Is there a config to share keys with / accept unverified devices (trust-on-first-use) to avoid cross-user verification?
  • Is "matrix verify" expected to drive a verification held by the running gateway? Each invocation appears to start its own crypto client.

Activity

  1. clawsweeper commented on Jun 1, 2026

    @clawsweeper
    Contributor

    Codex review: this still needs some work.

    Summary
    Keep this issue open: current main still omits Matrix DM configuration warnings, and an open closing PR owns the repair.

    Reproducibility: Current source deterministically skips Matrix’s nested DM warning, and existing tests assert that omission; no current-main runtime reproduction was executed.

    Root-cause cluster
    Relationship: canonical
    Canonical: #89254
    Summary: This issue owns the reporter-confirmed diagnostic gap, with one open closing repair candidate.

    Members:

    Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

    Next step
    Correct nested-field resolution in the existing fix PR, establish failing regressions for root and inherited account settings, and verify actionable Doctor guidance before landing.

    Review details

    Best possible solution:

    Provide accurate Matrix configuration warnings with explicit sender or wildcard guidance and the existing Doctor recovery command.

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

    Current source deterministically skips Matrix’s nested DM warning, and existing tests assert that omission; no current-main runtime reproduction was executed.

    Is this the best way to solve the issue?

    The shared configuration diagnostic is the appropriate repair boundary, provided it follows Matrix’s canonical nested fields and inheritance without weakening sender admission.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • The existing fix PR still needs canonical nested-field resolution corrected; current GitHub mergeability is undetermined.

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

    Label changes

    Label changes:

    No label changes.

    Label justifications:

    • P2: The remaining defect is a bounded diagnostic gap in an advanced Matrix configuration workflow with a confirmed workaround.
    • impact:ux-friction: Operators must inspect verbose rejection traces or infer the missing allowlist requirement before an otherwise working channel responds.
    Evidence reviewed

    What I checked:

    • Reporter corrected the diagnosis: sem00-ft’s June 2 follow-up traced rejection to dm_policy_not_allowlisted; an explicit sender entry restored five plaintext and two encrypted reply round trips, narrowing the issue to configuration clarity and silent rejection.
    • Current warning collector skips Matrix: The collector unconditionally skips nestedOnly channels; Matrix declares that mode in extensions/matrix/package.json:71. (src/config/validation-channel-rules.ts:138, 9e9048e0da47)
    • Existing validation coverage preserves the omission: The nested-only validation case explicitly expects no Matrix warning for dm.policy=open without dm.allowFrom. (src/config/validation.dm-policy.test.ts:170, 9e9048e0da47)
    • Admission behavior is intentional: Open DM policy admits wildcard or explicitly matched senders and otherwise returns dm_policy_not_allowlisted; Matrix reports that rejection through verbose logging before returning without dispatch. (src/channels/message-access/sender-gates.ts:68, 9e9048e0da47)
    • Existing recovery mechanism: Doctor already offers missing-wildcard repair using channel capabilities; the remaining work should connect clear Matrix guidance to that existing recovery owner. (src/commands/doctor/shared/open-policy-allowfrom.ts:20, 9e9048e0da47)
    • Open closing PR prevents closure: fix(matrix): warn when open DMs lack an allowlist wildcard #120143 remains open and unmerged and explicitly fixes this issue; its patch enables nested warnings, but its shared resolvers still accept top-level aliases that Matrix runtime does not use. (bc3012edd4df)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge; those execution lanes are retired.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

    Reviewed October 15, 2026, 10:26 PM ET / October 16, 2026, 02:26 UTC.

  2. added
    P1High-priority user-facing bug, regression, or broken workflow.
    impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.
    impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.
    issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.
    clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.
    clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    on Jun 1, 2026
  3. 38 remaining items

  4. added
    clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    and removed
    clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.
    on Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.bugSomething isn't workingbug:behaviorIncorrect behavior without a crashclawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions