Skip to content

[Bug]: Matrix chat session ignores reasoning setting and prints all reasoning messages regardless #24411

@andreacasini

Description

@andreacasini

Summary

atrix channel ignores session reasoningLevel: "off" setting and continues to deliver reasoning blocks (prefixed with "🔴 Reasoning:"), while the WebUI correctly hides them.

Steps to reproduce

  1. Start OpenClaw with Matrix channel enabled
  2. Send any message to trigger a response
  3. Run /reasoning off in Matrix — confirms "Reasoning visibility disabled"
  4. Send another message
  5. Reasoning blocks still appear in Matrix client (e.g., Element)
  6. Open WebUI (http://127.0.0.1:18789) — reasoning is correctly hidden there

Expected behavior

When reasoningLevel: "off" is set (via /reasoning off or in session config), reasoning blocks should NOT be delivered to Matrix — same behavior as WebUI.

Actual behavior

  • WebUI: Respects reasoningLevel: "off"
  • Matrix: Ignores setting, delivers "🔴 Reasoning:" blocks anyway ✗

OpenClaw version

2026.2.22

Operating system

linux

Install method

docker

Logs, screenshots, and evidence

The session correctly stores `reasoningLevel: "off"`:

{
  "reasoningLevel": "off",
  "thinkingLevel": null
}


The delivery code checks `includeReasoning: reasoningMode === "on"` but the Matrix extension's delivery path appears to bypass or ignore this check.

Additionally, `/reasoning off` may have a secondary bug: when reasoning is set to "off", the code **deletes** the field (`delete sessionEntry.reasoningLevel`) rather than setting it explicitly to `"off"`. This causes the default model-based reasoning level to kick in for models that support reasoning (like Claude Opus).

Relevant code path (`reply-DW3JcvGm.js`):

let resolvedReasoningLevel = directives.reasoningLevel ?? sessionEntry?.reasoningLevel ?? "off";
if (!(directives.reasoningLevel !== void 0 || sessionEntry?.reasoningLevel !== void 0 && sessionEntry?.reasoningLevel !== null) && resolvedReasoningLevel === "off") 
  resolvedReasoningLevel = await modelState.resolveDefaultReasoningLevel();


When `sessionEntry.reasoningLevel` is `null` (deleted), `resolveDefaultReasoningLevel()` returns `"on"` for reasoning-capable models.



Configuration:


{
  channels: {
    matrix: {
      enabled: true,
      homeserver: "https://matrix.org",
      userId: "@<redacted>:matrix.org",
      dm: {
        policy: "allowlist",
        allowFrom: ["@<redacted>:matrix.org"]
      }
    }
  },
  agents: {
    defaults: {
      thinkingDefault: "low",
      verboseDefault: "off"
    }
  }
}


### Workaround attempted

Manually setting `reasoningLevel: "off"` (string, not null) in the session JSON file and restarting gateway — did not resolve the issue for Matrix delivery.

Impact and severity

Medium-High — Reasoning blocks clutter the Matrix chat, making it difficult to read responses. Users are forced to use WebUI instead of their preferred Matrix client.

Additional information

Proposed fix

  1. Matrix extension should check resolvedReasoningLevel before delivering reasoning blocks
  2. /reasoning off command should set reasoningLevel: "off" explicitly rather than deleting the field
  3. Consider adding channels.matrix.includeReasoning: false config option as a channel-level override

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions