Skip to content

[Bug]: matrix media routing #25854

@BadTurki

Description

@BadTurki

Summary

Matrix channels with multiple accounts incorrectly used the default/first authenticated account when sending images, instead of the account bound to the agent.

Steps to reproduce

Compacted Config:
{
"bindings": [
{"agentId":"main","match":{"channel":"matrix","accountId":"main"}},
{"agentId":"test2","match":{"channel":"matrix","accountId":"test2"}}
],
"channels": {"matrix":{"enabled":true,"homeserver":"https://matrix.DOMAIN.com","dm":{"policy":"pairing"},"accounts":{"main":{"name":"Main Agent","userId":"@test1:DOMAIN.com","accessToken":"ACCESS_TOKEN1"},"test2":{"name":"Test2 Agent","userId":"@test2:DOMAIN.com","accessToken":"ACCESS_TOKEN2"}}}}
}

Expected behavior

Both agents can execute image delivery to matrix chat of the requested image from their workspace.

Actual behavior

Main test1 agent successfully send the image and the second test2 agent fails with error

{
"status": "error",
"tool": "message",
"error": "M_FORBIDDEN: User @test1:DOMAIN.com not in room !THE_ROOM_ID_FOR_THE_TEST2_AGENT_DIRECT_MESSAGE"
}

OpenClaw version

2026.2.23

Operating system

Debian 13

Install method

curl -fsSL https://openclaw.ai/install.sh | bash

Logs, screenshots, and evidence

Image Image

Impact and severity

Affected: Matrix users who have multi agent routing
Severity: Blocks workflow
Frequency: Always
Consequence: Reduced functionality, only one agent can send media

Additional information

Text message routing works in private channels with these agents however when the second agent calls the message tool to send an image the code lacks the context to route the media through the non-default (first setup) account.

I fixed this bug in v2026.2.17 under PR #23333 but conflicts introduced after produced a failed build so I pulled it. Still good context for a trusted contributor that can attack this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions