From 85bf649432c12936757a4e2f34c35921a1395722 Mon Sep 17 00:00:00 2001 From: Sandeep Ghael Date: Mon, 16 Mar 2026 18:32:56 -0400 Subject: [PATCH] fix(channel): resolve multi-room reply routing regression (#3224) (#3378) * fix(channel): resolve multi-room reply routing regression (#3224) PR #3224 (f0f0f808, "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 * style: apply cargo fmt to channel routing fix Co-Authored-By: Claude Opus 4.6 --------- Co-authored-by: Sandeep (Claude) Co-authored-by: Claude Opus 4.6 --- src/channels/mod.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/channels/mod.rs b/src/channels/mod.rs index 8e927cac1..4648391f9 100644 --- a/src/channels/mod.rs +++ b/src/channels/mod.rs @@ -1814,7 +1814,17 @@ async fn process_channel_message( msg }; - let target_channel = ctx.channels_by_name.get(&msg.channel).cloned(); + let target_channel = ctx + .channels_by_name + .get(&msg.channel) + .or_else(|| { + // Multi-room channels use "name:qualifier" format (e.g. "matrix:!roomId"); + // fall back to base channel name for routing. + msg.channel + .split_once(':') + .and_then(|(base, _)| ctx.channels_by_name.get(base)) + }) + .cloned(); if let Err(err) = maybe_apply_runtime_config_update(ctx.as_ref()).await { tracing::warn!("Failed to apply runtime config update: {err}"); }