diff --git a/src/gateway/outbound_dispatcher.rs b/src/gateway/outbound_dispatcher.rs index 11a37da..a4bfe71 100644 --- a/src/gateway/outbound_dispatcher.rs +++ b/src/gateway/outbound_dispatcher.rs @@ -12,6 +12,9 @@ pub struct OutboundDispatcher { channels: Arc>>>, } +/// Prefix for virtual scheduler chat IDs that should not be sent to external channels. +const SCHEDULER_VIRTUAL_CHAT_ID_PREFIX: &str = "scheduler/"; + impl OutboundDispatcher { pub fn new(bus: Arc) -> Self { Self { @@ -40,6 +43,17 @@ impl OutboundDispatcher { "OutboundDispatcher received message" ); + // Skip messages with virtual scheduler chat IDs (e.g., "scheduler/job_id") + // These are internal messages from SilentAgentTask that should not be sent externally + if msg.chat_id.starts_with(SCHEDULER_VIRTUAL_CHAT_ID_PREFIX) { + tracing::debug!( + channel = %msg.channel, + chat_id = %msg.chat_id, + "Skipping message with virtual scheduler chat_id" + ); + continue; + } + let channel_name = msg.channel.clone(); let channel = self.channels.read().await.get(&channel_name).cloned();