fix(channel): resolve multi-room reply routing regression (#3224)#3378
Merged
SimianAstronaut7 merged 2 commits intozeroclaw-labs:masterfrom Mar 16, 2026
Merged
Conversation
…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>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Independent VerificationThis fix was independently discovered and verified end-to-end by @dancingclaw (with coding agent assistance). Reproduction & ConfirmationWe hit this exact bug while setting up Matrix E2EE support. The symptoms:
Root Cause (matches this PR)
Testing Performed
Additional ContextThis also affects any future channel that uses a Recommendation: This is a critical bug — all Matrix reply routing is broken on This comment was authored by a coding agent (Claude) acting on behalf of @dancingclaw, who discovered, verified, and approved this message. |
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>
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
masterfor all contributions):masterf0f0f808, "feat(matrix): add multi-room support") changed the Matrix channel name format from"matrix"to"matrix:!roomId"insrc/channels/matrix.rsline 870, but the channel routing lookup insrc/channels/mod.rsline 1695 still performs an exact match againstchannels_by_name(keyed byChannel::name()which returns"matrix"). The lookup for"matrix:!roomId"always fails, makingtarget_channelNone and silently dropping all replies.:and retries with the base channel name when an exact match fails.mod.rs.Label Snapshot (required)
risk: low|medium|high):risk: lowsize: XS|S|M|L|XL, auto-managed/read-only):size: XSchannelchannel: matrixChange Metadata
bug|feature|refactor|docs|security|chore):bugruntime|provider|channel|memory|security|ci|docs|multi):channelLinked Issue
Supersede Attribution (required when
Supersedes #is used)N/A
Validation Evidence (required)
The change is a minimal, self-contained routing fallback — 6 lines of idiomatic Rust with no new dependencies, no unsafe code, and no API surface changes. The logic is:
:and retry with the base name.cargo testnot run locally (requires full dependency chain); CI will validate.Security Impact (required)
Privacy and Data Hygiene (required)
passCompatibility / Migration
i18n Follow-Through (required when docs or user-facing wording changes)
Human Verification (required)
matrix.rs:870(message emission withformat!("matrix:{}", room.room_id())) throughmod.rs:1695(channel lookup). Confirmed thatchannels_by_nameis populated fromChannel::name()which returns"matrix"— so the qualified key"matrix:!roomId"will never match without the fallback.:in name — exact match succeeds, fallback never runs. (2) Channels with:but no matching base name — returns None as before. (3) Multiple channels with same base name — first registered wins (same as current behavior).Side Effects / Blast Radius (required)
src/channels/mod.rs.:in its channel name and there is a different channel whose name matches the prefix, routing could incorrectly fall back to the wrong channel. This is unlikely given current channel naming conventions.target_channelresolution.Agent Collaboration Notes (recommended)
AGENTS.md+CONTRIBUTING.md): YesRollback Plan (required)
git revert <commit-sha>— single commit, no dependencies.Risks and Mitigations
:.🤖 Generated with Claude Code