From c92db7e9b7600dbba94bc75ecc2a4983935b1bde Mon Sep 17 00:00:00 2001 From: Siavash Sameni Date: Wed, 8 Apr 2026 15:34:22 +0400 Subject: [PATCH] fix: preserve original relay label through multi-hop presence propagation When propagating GlobalRoomActive to other peers, use tagged participants (with relay_label set to the originating relay) instead of the raw untagged participants. This shows "Relay C" instead of "Relay B" when C's participants are forwarded through hub B to A. Co-Authored-By: Claude Opus 4.6 (1M context) --- crates/wzp-relay/src/federation.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/crates/wzp-relay/src/federation.rs b/crates/wzp-relay/src/federation.rs index fdfe052..1c83727 100644 --- a/crates/wzp-relay/src/federation.rs +++ b/crates/wzp-relay/src/federation.rs @@ -675,12 +675,24 @@ async fn handle_signal( }).collect(); link.remote_participants.insert(room.clone(), tagged); } - // Propagate to other peers + // Propagate to other peers (with relay labels preserved) + let tagged_for_propagation = if let Some(link) = links.get(peer_fp) { + let label = link.label.clone(); + participants.iter().map(|p| { + let mut t = p.clone(); + if t.relay_label.is_none() { + t.relay_label = Some(label.clone()); + } + t + }).collect::>() + } else { + participants.clone() + }; for (fp, link) in links.iter() { if fp != peer_fp { let _ = link.transport.send_signal(&SignalMessage::GlobalRoomActive { room: room.clone(), - participants: participants.clone(), + participants: tagged_for_propagation.clone(), }).await; } }