Skip to content

[Bug]: Matrix channel outbound m.room.message silently dropped on 2026.5.3-1 — matrix-js-sdk sendMessage never invoked, no logs at any level #78135

Closed as not planned

Description

@snowmirage

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

After installing OpenClaw 2026.5.3-1, the matrix channel receives inbound messages and the agent generates replies normally — but outbound m.room.message events silently disappear before reaching matrix-js-sdk. matrix-js-sdk's own sendEvent of type m.room.message log line never appears for openclaw-driven turns. There are no errors, warnings, or other diagnostics at info, warn, or error level. The agent session JSONL shows the assistant reply was generated cleanly with stopReason: "stop"; it just never reaches the homeserver.

The break is reproducibly inside openclaw's matrix channel wrapper — matrix-js-sdk itself, the access token, the device, and the homeserver have all been verified healthy by direct test (see "Diagnostic evidence" below).

Steps to reproduce

  1. Install OpenClaw 2026.5.3-1 as a host npm install with the matrix channel configured against an unencrypted matrix room. Node 24+ runtime.
  2. Have a user account post a message in the configured room (e.g. "ping").
  3. Observe: the gateway's session JSONL records both the inbound user message and the assistant-generated reply with stopReason: "stop". The reply never appears in the matrix room.
  4. Restarting openclaw-gateway does not resolve. Reinstalling the matrix nested deps (matrix-js-sdk, @matrix-org/matrix-sdk-crypto-nodejs, @matrix-org/matrix-sdk-crypto-wasm) does not resolve. Running npm rebuild @matrix-org/matrix-sdk-crypto-nodejs does not resolve.

Expected behavior

Agent-generated replies posted to the configured matrix room within ~seconds of generation, as observed on prior 2026.4.x releases.

Actual behavior

Agent replies generated correctly but silently dropped before reaching matrix-js-sdk. No error or warning at any log level (info / warn / error / file-log / journald).

Diagnostic evidence

1. Inbound bridge healthy. Session JSONL records user message at 2026-05-05T22:13:27.178Z with full matrix metadata (chat_id, message_id, sender). Bridge receives sync events fine.

2. Model + tool loop healthy. Session JSONL records assistant reply at 2026-05-05T22:14:00.518Z with normal stopReason: "stop", expected reply text, ~33s end-to-end model latency.

3. matrix-js-sdk's sendEvent log line is absent for openclaw turns. Grepping /tmp/openclaw/openclaw-2026-05-05.log for sendEvent returns zero hits since gateway start. matrix-js-sdk emits this line on every sendMessage invocation; absence indicates openclaw is not calling it.

4. matrix-js-sdk + same device id + same access token + same nested-deps install sends fine in isolation. Reproducer:

const sdk = require("/path/to/openclaw/node_modules/matrix-js-sdk");
const c = sdk.createClient({
  baseUrl: "http://homeserver:8008",
  accessToken: "<openclaw's access token>",
  userId: "@bot:homeserver",
  deviceId: "<openclaw's device id from storage-meta.json>",
});
await c.startClient({ initialSyncLimit: 1 });
await new Promise((res) => c.once("sync", (s) => s === "PREPARED" && res()));
const r = await c.sendMessage("<room id>", { msgtype: "m.text", body: "test" });
console.log("OK", r.event_id);

Result: SAME-DEVICE SEND OK event_id: $... — HTTP 200 from synapse in ~48ms. Confirms the bridge's matrix-js-sdk install, native binding, access token, device, and homeserver are all functional. The break is in openclaw's wrapper layer.

5. Gateway file log only emits these matrix-related lines all day:

  • [matrix] [default] starting provider (http://...) (at startup)
  • matrix: logged in as @bot:homeserver (at startup)
  • [MatrixClient] Resuming queue after resumed sync (at startup)
  • A handful of [MatrixRTCSession ... m.call#ROOM] No membership changes detected entries (call-state polling)
  • Couldn't find timeline for thread ID $... warnings on a separate room (not the affected one)

No sendEvent, no error, no warn from matrix-js-sdk during steady-state operation.

6. Native binding loads cleanly from openclaw cwd: node -e 'require("@matrix-org/matrix-sdk-crypto-nodejs")' returns 8 keys (Attachment, EncryptedAttachment, BackupDecryptionKey, ...). OlmMachine.initialize returns successfully.

7. No E2EE state present — homeserver /keys/query for the bot account returns empty device_keys/master_keys/self_signing_keys/user_signing_keys. Bot operates in unencrypted-room-only mode.

8. Gateway liveness diagnostics show event-loop pressure consistent with #77995's symptom class:

[diagnostic] liveness warning: reasons=event_loop_delay
  eventLoopDelayP99Ms=181.9-243.9 eventLoopDelayMaxMs=2294.3-3231.7
  eventLoopUtilization=0.29-0.32 active=1 waiting=0 queued=1

Magnitude is milder than #77995's report (their P99 went up to 6350ms), but queued=1 is consistently present.

9. Direct synapse send via same access token, bypassing matrix-js-sdk entirely, works: curl -X PUT -H "Authorization: Bearer <token>" .../rooms/.../send/m.room.message/<txn> -d '{"msgtype":"m.text","body":"..."}' returns HTTP 200 with event_id. Confirms synapse, network, ACL, room state are all healthy.

What this rules out

  • matrix-js-sdk itself (works in isolation with same install)
  • Native binding ABI (binding loads, OlmMachine.initialize succeeds; rebuild didn't help)
  • Access token / device / E2EE setup (synapse confirms valid device, no E2EE state to be partial about)
  • Network, synapse, room ACL (direct PUT works)
  • dist/ bundle drift (untouched since prior working state — only node_modules/.package-lock.json was rewritten by an npm install of nested matrix deps)

What's left

The break sits between "openclaw's matrix channel plugin observes the agent-generated reply" and "matrix-js-sdk's sendMessage gets called." That lane is opaque to me at info-level logging.

OpenClaw version

2026.5.3-1

Operating system

Linux (Ubuntu 24.04 / WSL2 host running as a Linux VM), node v24.15.0, npm 11.x.

Install method

npm install -g openclaw@2026.5.3-1, with the npm install --no-save workaround for matrix nested deps as documented.

Related issues

Workaround

None known. Gateway restarts and nested-deps reinstall do not restore. Going back to 2026.4.x is the only known-good state per #77995's reporter (using 2026.5.2 as their last-known-good).

Activity

  1. clawsweeper commented on May 5, 2026

    @clawsweeper
    Contributor

    Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

    Close as superseded: the reporter's follow-up disproved a Matrix wrapper regression and traced the behavior to the documented group/channel visible-reply policy; the remaining non-silent diagnostic or fallback work is already tracked by the cross-channel issue and open warning PR.

    So I’m closing this here and keeping the remaining discussion on the canonical linked item.

    Review details

    Best possible solution:

    Close this Matrix-specific report and keep any remaining diagnostic or fallback work on #77320 and its linked warning PR.

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

    No for the originally reported Matrix wrapper regression. The high-confidence current path is source-confirmed configuration behavior: group/channel visible replies resolve to message-tool-only suppression unless configured as automatic, which the reporter verified live.

    Is this the best way to solve the issue?

    Yes. Closing this Matrix-specific report and routing the remaining non-silent diagnostic/fallback discussion to the shared cross-channel tracker is the narrowest maintainable outcome; changing Matrix send delivery would fix the wrong layer.

    Security review:

    Security review: No patch is under review, and the resolved report is a configuration/support issue rather than a security-sensitive report.

    What I checked:

    • Reporter resolution: The reporter's final comment says the original Matrix-wrapper diagnosis was wrong, identifies unset group visible replies resolving to message-tool-only suppression, confirms messages.visibleReplies: "automatic" restored Matrix delivery, and links their Phoenix-side config fix.
    • Current source policy: Current main resolves group/channel source turns to message_tool_only unless the configured visible-reply mode is explicitly automatic, matching the corrected root cause rather than a Matrix send failure. (src/auto-reply/reply/source-reply-delivery-mode.ts:37, 2d9ef76d5b6b)
    • Current dispatch behavior: Current dispatch turns an undefined reply result into an empty reply list and skips unmarked final replies while suppressDelivery is true, explaining why the Matrix deliver callback and sendMessageMatrix are never invoked under this policy. (src/auto-reply/reply/dispatch-from-config.ts:1594, 2d9ef76d5b6b)
    • Current docs: The group/channel docs now say the default is messages.groupChat.visibleReplies: "message_tool", that normal final answers stay private, and that setting messages.groupChat.visibleReplies: "automatic" restores legacy visible replies. Public docs: docs/channels/groups.md. (docs/channels/groups.md:43, 2d9ef76d5b6b)
    • Matrix delivery boundary: Matrix delivery is reached through the reply dispatcher callback and then deliverMatrixReplies, which calls sendMessageMatrix; if shared dispatch suppresses replies before this callback, Matrix-specific send code is correctly never reached. (extensions/matrix/src/matrix/monitor/handler.ts:1753, 2d9ef76d5b6b)
    • Canonical remaining work: The cross-channel tracker is open and covers the same suppressed message-tool-only final diagnostic/fallback class; the open PR Clarify, warn, and recover message-tool-only finals #80949 targets a shared privacy-preserving warning at the dispatch boundary.

    Likely related people:

    • @steipete: Introduced the global visible-reply mode surface and appears repeatedly in recent history for the shared source-reply and dispatch policy files. (role: feature-history owner and recent area contributor; confidence: high; commits: e1fd27fb24ae; files: src/auto-reply/reply/source-reply-delivery-mode.ts, src/auto-reply/reply/dispatch-from-config.ts, docs/gateway/config-channels.md)
    • @scoootscooob: Authored the merged doctor compatibility commit that persisted and documented the group visible-reply default for configured-channel installs. (role: doctor/docs behavior contributor; confidence: high; commits: 85e4ec1fb1ac; files: docs/channels/groups.md, docs/gateway/doctor.md, src/commands/doctor/shared/legacy-config-core-normalizers.ts)
    • @anyech: Opened the current warning-diagnostic PR for suppressed message-tool-only finals at the shared dispatch boundary that supersedes the remaining diagnostic concern. (role: active follow-up contributor; confidence: medium; commits: 47056e8df729; files: src/auto-reply/reply/dispatch-from-config.ts, src/auto-reply/reply/dispatch-from-config.reply-dispatch.test.ts)

    Codex review notes: model gpt-5.5, reasoning high; reviewed against 2d9ef76d5b6b.

  2. snowmirage commented on May 6, 2026

    @snowmirage
    Author

    Update — confirmed on 2026.5.4, fresh session, full config sweep

    Re-tested today on the same Phoenix VM after upgrading to 2026.5.4 (released earlier today, 2026-05-05 08:24Z). Same silent drop. Posting an evidence sweep so triage doesn't have to redo it.

    Environment

    • openclaw 2026.5.4 (@openclaw/matrix@2026.5.4 shipped in dist/extensions/matrix/)
    • Node v24.15.0
    • Matrix nested deps reinstalled per the plugin's package.json: matrix-js-sdk@41.4.0, @matrix-org/matrix-sdk-crypto-nodejs@^0.5.1, @matrix-org/matrix-sdk-crypto-wasm@18.2.0. (npm install -g openclaw@2026.5.4 wipes nested deps; that's tracked separately at #75XXX-style "nested deps not auto-installed" — not the cause of this issue.)
    • Synapse + room ACL + access token + device id known-healthy: direct matrix-js-sdk@41.4.0 reproducer with the same device id sends in ~48ms (HTTP 200, message lands). Direct PUT /send/m.room.message/<txn> via curl with the same token also sends. The break is strictly inside OpenClaw between "agent emits final assistant message" and "matrix-js-sdk's sendMessage is attempted".

    What reproduces — all four show identical silent drop

    Variant Result
    2026.5.4 + Phoenix's pre-existing session (6-day, 1.3MB JSONL) inbound recorded in JSONL, model emits stopReason:"stop" with reply text, zero matrix-bridge handler activity in verbose log
    2026.5.4 + fresh session (archived current <sid>.jsonl + 11 checkpoint files + sessions.json; new session id auto-created on next inbound) same shape
    channels.matrix.streaming: "off" (Phoenix had the new "progress" mode) same shape
    channels.matrix.blockStreaming: false (Phoenix had true) same shape

    So the regression isn't gated by:

    • session state (eliminates "bloated session" / compaction-loop class)
    • the progress-mode draft-stream path added in c33e578 (feat: add channel progress drafts)
    • block-streaming routing

    It's lower in the stack than any of those switches.

    New signal — bookkeeping anomaly that fires on every dropped turn

    The gateway's diagnostic liveness warning consistently shows the same work item in both active and queued for every dropped turn, with last=model_call:started even after the JSONL records the model call as complete:

    liveness warning: reasons=event_loop_delay … 
      phase=channels.matrix.start-account 
      work=[
        active=agent:main:matrix:channel:!XXX:synapse.betoria.org(processing/model_call,q=1,age=5s last=model_call:started)
        queued=agent:main:matrix:channel:!XXX:synapse.betoria.org(processing/model_call,q=1,age=5s last=model_call:started)
      ]
    

    Same room, same age, both reading last=model_call:started. The JSONL clearly records the assistant message with stopReason:"stop" for that work item — i.e. the model_call did complete — but the diagnostic tracker's last event for the matrix lane never advances past model_call:started. If anything in the deliver path is gated on observing the model_call:completed transition for the matrix lane, that's a candidate explanation for the silent skip. (Reading extensions/matrix/src/matrix/monitor/handler.ts end-to-end didn't show such a gate, but I'm not confident I've fully traced the per-channel-work-tracker side.)

    Other smells worth flagging

    • compaction-safeguard fires on the very first turn of a fresh empty session. Log: Compaction safeguard: no real conversation messages to summarize; writing compaction boundary to suppress re-trigger loop. Repro: archive all session files, restart, send one ping → safeguard fires while processing that ping. The safeguard's name implies it's a fallback for re-trigger loops on bloated sessions; firing on a 2-message session with empty JSONL suggests its trigger condition is too eager.
    • Verbose log (/tmp/openclaw/openclaw-YYYY-MM-DD.log) is empty of matrix-handler activity for the dropped turns. Zero hits for sendMessage, sendEvent, m.room.message, deliverMatrixReplies, or any matrix-bridge delivery step. Either the deliver callback in extensions/matrix/src/matrix/monitor/handler.ts (line ~1739 in 2026.5.4) isn't being invoked at all, or it returns before any logged step.
    • Event-loop saturation during these turns: eventLoopDelayMaxMs 2.4-5.4s, eventLoopUtilization 0.36-0.67 — same regression class as [Bug]: Regression in OpenClaw 2026.5.4 / 2026.5.3-1: gateway status handler stalls ~50s, event loop degraded, Discord heartbeat timeouts #77995 but with the silent-dispatch-drop manifestation instead of channel timeouts. (Note: this surfaces even on a fresh empty session, so it's not purely session-bloat-driven.)

    Reproducer for triage

    If you can stand up an unencrypted Matrix room with synapse, the repro is straightforward:

    1. Build 46c99cff0b2f or use openclaw@2026.5.4.
    2. Configure a matrix channel with accessToken, groupPolicy: "open", bot joined, room not E2EE.
    3. Have matrix-js-sdk debug logging on (localStorage.setItem('mx_log', '*') equivalent for node, or the gateway's verbose log file).
    4. Send Ping addressed to the bot.
    5. Observe JSONL records {role:"assistant", stopReason:"stop", text:"…"} ~30s later.
    6. Observe the room never receives the message. No sendEvent of type m.room.message log line emits.
    7. Sanity check the homeserver-side path: same access token + device id + room sends fine via direct client.sendMessage in a one-shot script.

    What I can do to help

    This VM is available for live triage. Happy to:

    • Run OPENCLAW_LOG_LEVEL=debug (or whatever the right env var is — pointer welcome) and ship the resulting log.
    • Patch the matrix-bridge dispatch path with extra log lines and run a custom build.
    • Test a candidate fix.

    I'll keep digging from this side and update if I narrow further.

  3. snowmirage commented on May 6, 2026

    @snowmirage
    Author

    Resolution — not a bug, configuration gap

    Closing the loop on this. The original diagnosis was wrong: this is not a 2026.5.3-1 matrix wrapper-layer regression. The actual root cause is a config gap exposed by skipping over the version where the relevant default landed.

    Root cause

    messages.visibleReplies was added in v2026.4.29 (commit e1fd27fb24 feat(messages): add global visible replies mode) with a group-chat default of "message_tool_only". We had been on v2026.4.24 and jumped directly to v2026.5.3-1, skipping the version where the default landed. With messages.visibleReplies unset and the test room being a group chat, the default flipped us silently from "automatic-reply" to "message-tool-only" semantics.

    Trace through src/auto-reply/reply/source-reply-delivery-mode.ts:73:

    • chatType === "group"
    • cfg.messages?.groupChat?.visibleReplies ?? cfg.messages?.visibleReplies → undefined
    • mode = configuredMode === "automatic" ? "automatic" : "message_tool_only" → "message_tool_only"
    • suppressAutomaticSourceDelivery = true
    • suppressDelivery = true

    Then in src/auto-reply/reply/dispatch-from-config.ts:

    • replyResult from replyResolver(...) → undefined (the agent runs and produces text into the JSONL but the reply pipeline returns nothing because automatic delivery is suppressed)
    • replies = []
    • The for-loop at the dispatch site never iterates
    • dispatcher.sendFinalReply / dispatcher.sendBlockReply never fire
    • Matrix bridge's deliver callback in extensions/matrix/src/matrix/monitor/handler.ts is never invoked
    • No HTTP PUT /_matrix/client/v3/rooms/.../send/m.room.message/... is emitted

    Verification

    Confirmed with two rounds of bundle instrumentation on the live VM:

    1. Patched the matrix bridge deliver callback at dist/monitor-kFXE6pqL.js:2902 (deliver: async (payload, info) => {...}) to log entry. Zero hits across 10+ hours of uptime — confirms the callback was never called.
    2. Patched the dispatcher's reply-iteration loop at dist/dispatch-C8IbdPmU.js:975 (right after const replies = replyResult ? Array.isArray(...) : [...] : [];) to log replyResult-type, replies-len, suppressDelivery, and the first reply's shape. Captured: replyResult-type=undefined replies-len=0 suppressDelivery=true firstReply=none.

    Then set messages.visibleReplies: "automatic" in ~/.openclaw/openclaw.json, restarted the gateway, sent the test ping. Reply landed in 12s. Same instrument fired with kind=block text="Pong, Sir. ..." suppressDelivery=false. End of regression.

    Why we initially called this a wrapper-layer bug

    • Inbound was healthy (matrix-js-sdk delivered the user message into the JSONL with full metadata).
    • The agent ran cleanly and produced text in the JSONL with normal stopReason: "stop".
    • Matrix-js-sdk worked fine in isolation with the same access token and device id (direct reproducer sent in 48ms).
    • The runtime's diagnostic logged outcome=completed duration=Xms and session state: ... reason="run_completed" — which read as "the turn finished successfully", reinforcing the impression that something was eating the dispatch step after the runtime considered the turn done.
    • No errors, no warnings, no log lines from the matrix bridge's deliver path.

    The combination — completed-from-runtime-perspective + zero matrix-bridge activity + zero error signal — strongly read as "the wrapper is silently swallowing". In reality, suppressDelivery is a deliberate gate that's expected to leave the matrix dispatch lane untouched; from the outside it looks indistinguishable from a silent drop.

    Suggested upstream improvements (optional, non-blocking)

    The bug is fixed on our side, but the diagnosis took ~6 working hours of bundle-patching and config sweeps. A few lightweight upstream changes would have shortened it considerably:

    1. doctor warning when messages.visibleReplies resolves to "message_tool_only" (default or explicit) AND no message tool is registered for the agent's tool policy. That combination produces a silent group-chat dropout that's invisible in any log. Sample text: "Group/channel agent replies will be suppressed: messages.visibleReplies=message_tool_only and no message tool is registered. Set messages.visibleReplies=automatic or register a message tool."
    2. Verbose-level log line when suppressDelivery=true is the reason a reply payload is dropped at the dispatcher's reply-iteration loop. Currently the runtime emits outcome=completed; a one-line suppressDelivery: <reason> for <channel>:<chatId> at the moment the for-loop is skipped would be diagnosable from the verbose log alone.
    3. CHANGELOG / migration note for v2026.4.29 highlighting that the new visibleReplies group default is "message_tool_only" — i.e., behavior changed for anyone who upgraded across this version without setting the key explicitly. Not visible in the current changelog summary for that release.

    Happy to send a PR for any of these if useful — let me know which (if any) you'd want.

    Closing

    Issue can be closed as not-an-upstream-bug. Phoenix-side fix is in snowmirage/phoenix#852. Apologies for the noise on the original report — the empirical signal made it look like a runtime bug, and we were confident enough in that read to file it; turned out to be hubris. Thanks to clawsweeper for the careful path-tracing review that kept the issue open while we kept digging.

  4. locked as resolved and limited conversation to collaborators on May 17, 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

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions