Skip to content

Matrix multi-account: tool-action message may send from wrong account #26457

@arthurhan8888

Description

@arthurhan8888

Summary

In Matrix multi-account setups, a message generated by agent/account A can be sent out by Matrix account B when the message is sent via a tool/action path.

Expected behavior

A message generated from account A should always be sent by account A.

Actual behavior

A tool/action send generated in account A's session is published in Matrix from another active account (account B).

Reproduction

  1. Configure Matrix with multiple accounts under channels.matrix.accounts and route each to a different agent.
  2. In one room, mention two agents in one message (for example, @bot-a @bot-b ...).
  3. Let one agent trigger a follow-up send via tool/action (for example, pinging another bot/user in-room).
  4. Observe the follow-up is sent by a different Matrix account than the one whose session generated it.

Notes

  • Mention detection on inbound is correct (event m.mentions.user_ids is as expected).
  • Session records show the originating agent/account generated the follow-up text.
  • The final Matrix sender can still be a different account.

Suspected root cause

accountId appears to be dropped in Matrix action/tool-send path before final send client resolution.
Likely relevant files:

  • extensions/matrix/src/actions.ts
  • extensions/matrix/src/tool-actions.ts

extensions/matrix/src/matrix/actions/messages.ts supports account-aware opts, so this may be a context propagation gap upstream.

Impact

  • Cross-account identity confusion in shared rooms
  • Multi-account routing trust is broken for tool/action sends
  • Can look like an unrelated bot is speaking/responding

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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