Skip to content

feat(matrix): add multi-room support#3224

Closed
imadnyc wants to merge 1 commit intozeroclaw-labs:masterfrom
imadnyc:feat/matrix-multi-room
Closed

feat(matrix): add multi-room support#3224
imadnyc wants to merge 1 commit intozeroclaw-labs:masterfrom
imadnyc:feat/matrix-multi-room

Conversation

@imadnyc
Copy link
Copy Markdown
Contributor

@imadnyc imadnyc commented Mar 11, 2026

Summary

  • Disable the room_id filter in listen() so messages from all joined rooms are processed
  • Embed room_id in reply_target as user||room_id for routing replies back to the correct room
  • Include room_id in the channel field (e.g. matrix:\!room_id) for per-room conversation isolation
  • Extract room_id from recipient in send() for correct message routing; falls back to configured room_id for direct sends

Details

This enables a single Matrix bot instance to respond in multiple rooms without needing separate channel configurations per room. The configured room_id still serves as a fallback when the recipient does not contain a || separator.

Test plan

  • Bot responds to messages in the configured primary room
  • Bot responds to messages in other joined rooms
  • Replies are routed to the correct room (not the configured default)
  • Conversation history is isolated per room via the channel field
  • Direct sends without || in recipient still use the configured room

🤖 Generated with Claude Code

Enable a single Matrix bot instance to respond in multiple rooms:
- Disable the room_id filter so messages from all joined rooms are processed
- Embed room_id in reply_target as "user||room_id" for routing replies
- Include room_id in channel field for per-room conversation isolation
- Extract room_id from recipient in send() for correct message routing

The configured room_id still serves as a fallback for direct sends
without a "||" separator in the recipient.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@theonlyhennygod theonlyhennygod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved for merge

@theonlyhennygod
Copy link
Copy Markdown
Collaborator

Closing in favor of new PR with conflict resolution

theonlyhennygod added a commit that referenced this pull request Mar 11, 2026
Enable a single Matrix bot instance to respond in multiple rooms:
- Disable the room_id filter so messages from all joined rooms are processed
- Embed room_id in reply_target as "user||room_id" for routing replies
- Include room_id in channel field for per-room conversation isolation
- Extract room_id from recipient in send() for correct message routing

The configured room_id still serves as a fallback for direct sends
without a "||" separator in the recipient.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
sghael pushed a commit to sghael/zeroclaw that referenced this pull request Mar 13, 2026
…abs#3224)

PR zeroclaw-labs#3224 (f0f0f80, "feat(matrix): add multi-room support") changed the
channel name format in matrix.rs from "matrix" to "matrix:!roomId", but
the channel lookup in mod.rs still does an exact match against
channels_by_name, which is keyed by Channel::name() (returns "matrix").

This mismatch causes target_channel to always resolve to None for Matrix
messages, silently dropping all replies.

Fix: fall back to a prefix match on the base channel name (before ':')
when the exact lookup fails. This preserves multi-room conversation
isolation while correctly routing replies to the originating channel.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
bglusman pushed a commit to bglusman/zeroclaw that referenced this pull request Mar 15, 2026
…abs#3224)

PR zeroclaw-labs#3224 (f0f0f80, "feat(matrix): add multi-room support") changed the
channel name format in matrix.rs from "matrix" to "matrix:!roomId", but
the channel lookup in mod.rs still does an exact match against
channels_by_name, which is keyed by Channel::name() (returns "matrix").

This mismatch causes target_channel to always resolve to None for Matrix
messages, silently dropping all replies.

Fix: fall back to a prefix match on the base channel name (before ':')
when the exact lookup fails. This preserves multi-room conversation
isolation while correctly routing replies to the originating channel.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
lantrinh1999 pushed a commit to lantrinh1999/zeroclaw-1 that referenced this pull request Mar 18, 2026
Enable a single Matrix bot instance to respond in multiple rooms:
- Disable the room_id filter so messages from all joined rooms are processed
- Embed room_id in reply_target as "user||room_id" for routing replies
- Include room_id in channel field for per-room conversation isolation
- Extract room_id from recipient in send() for correct message routing

The configured room_id still serves as a fallback for direct sends
without a "||" separator in the recipient.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
lantrinh1999 pushed a commit to lantrinh1999/zeroclaw-1 that referenced this pull request Mar 18, 2026
…abs#3224) (zeroclaw-labs#3378)

* fix(channel): resolve multi-room reply routing regression (zeroclaw-labs#3224)

PR zeroclaw-labs#3224 (9bddd43, "feat(matrix): add multi-room support") changed the
channel name format in matrix.rs from "matrix" to "matrix:!roomId", but
the channel lookup in mod.rs still does an exact match against
channels_by_name, which is keyed by Channel::name() (returns "matrix").

This mismatch causes target_channel to always resolve to None for Matrix
messages, silently dropping all replies.

Fix: fall back to a prefix match on the base channel name (before ':')
when the exact lookup fails. This preserves multi-room conversation
isolation while correctly routing replies to the originating channel.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* style: apply cargo fmt to channel routing fix

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Sandeep (Claude) <sghael+claude@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
PlebCoder pushed a commit to PlebCoder/zeroclaw that referenced this pull request Mar 19, 2026
Enable a single Matrix bot instance to respond in multiple rooms:
- Disable the room_id filter so messages from all joined rooms are processed
- Embed room_id in reply_target as "user||room_id" for routing replies
- Include room_id in channel field for per-room conversation isolation
- Extract room_id from recipient in send() for correct message routing

The configured room_id still serves as a fallback for direct sends
without a "||" separator in the recipient.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
webhive pushed a commit to webhive/zeroclaw that referenced this pull request Mar 24, 2026
…abs#3224) (zeroclaw-labs#3378)

* fix(channel): resolve multi-room reply routing regression (zeroclaw-labs#3224)

PR zeroclaw-labs#3224 (f0f0f80, "feat(matrix): add multi-room support") changed the
channel name format in matrix.rs from "matrix" to "matrix:!roomId", but
the channel lookup in mod.rs still does an exact match against
channels_by_name, which is keyed by Channel::name() (returns "matrix").

This mismatch causes target_channel to always resolve to None for Matrix
messages, silently dropping all replies.

Fix: fall back to a prefix match on the base channel name (before ':')
when the exact lookup fails. This preserves multi-room conversation
isolation while correctly routing replies to the originating channel.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* style: apply cargo fmt to channel routing fix

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Sandeep (Claude) <sghael+claude@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants