Summary
Rooms with exactly 2 members (bot + one user) that are explicitly listed in channels.matrix.groups config are still classified as direct messages by directTracker.isDirectMessage(). Messages route to the main DM session instead of getting an isolated group session.
Steps to reproduce
- Create a Matrix room with only the bot and one user (2 members total)
- Add the room to
channels.matrix.groups in config:
"groups": {
"!roomId:example.com": {
"allow": true,
"requireMention": false
}
}
- Restart the gateway
- Send a message in that room
- Check the session key assigned to the message
Expected behavior
The message should be routed to a group session (e.g. agent:main:matrix:channel:!roomId:example.com) because the room is explicitly configured in groups.
Actual behavior
The message is routed to the main DM session (agent:main:main) because directTracker.isDirectMessage() returns true for any 2-member room, regardless of the groups config.
OpenClaw version
2026.2.15
Operating system
Debian 12 / Linux
Install method
npm global
Logs, screenshots, and evidence
No error in logs as the DM classification is silent. Verified by comparing session keys: messages in 2-member configured rooms get `agent:main:main` instead of `agent:main:matrix:channel:!roomId`.
Impact and severity
Affected: Any Matrix user with project-specific rooms where only the bot and one user are members
Severity: High (blocks intended workflow)
Frequency: 100% repro
Consequence: All project rooms share the main session context instead of being isolated. Cross-project context leakage, no per-room conversation history.
Additional information
Workaround: patch src/matrix/monitor/handler.ts to check roomsConfig keys before calling directTracker.isDirectMessage():
const explicitlyConfiguredAsGroup = roomsConfig && Object.keys(roomsConfig).some(
(key) => key === roomId || (roomAliases && roomAliases.includes(key))
);
const isDirectMessage = explicitlyConfiguredAsGroup
? false
: await directTracker.isDirectMessage({ roomId, senderId, selfUserId });
The root cause is in createDirectRoomTracker in direct.ts which classifies rooms by member count. The groups config should take precedence over heuristic DM detection.
Summary
Rooms with exactly 2 members (bot + one user) that are explicitly listed in
channels.matrix.groupsconfig are still classified as direct messages bydirectTracker.isDirectMessage(). Messages route to the main DM session instead of getting an isolated group session.Steps to reproduce
channels.matrix.groupsin config:Expected behavior
The message should be routed to a group session (e.g.
agent:main:matrix:channel:!roomId:example.com) because the room is explicitly configured ingroups.Actual behavior
The message is routed to the main DM session (
agent:main:main) becausedirectTracker.isDirectMessage()returns true for any 2-member room, regardless of the groups config.OpenClaw version
2026.2.15
Operating system
Debian 12 / Linux
Install method
npm global
Logs, screenshots, and evidence
Impact and severity
Affected: Any Matrix user with project-specific rooms where only the bot and one user are members
Severity: High (blocks intended workflow)
Frequency: 100% repro
Consequence: All project rooms share the main session context instead of being isolated. Cross-project context leakage, no per-room conversation history.
Additional information
Workaround: patch
src/matrix/monitor/handler.tsto checkroomsConfigkeys before callingdirectTracker.isDirectMessage():The root cause is in
createDirectRoomTrackerindirect.tswhich classifies rooms by member count. The groups config should take precedence over heuristic DM detection.