broker: skip broadcast self-delivery

This commit is contained in:
damocles 2026-05-20 13:55:46 +02:00
parent bded8d789f
commit 0b237d7d8c

View file

@ -540,16 +540,18 @@ impl Coordinator {
}
}
/// Deliver `body` to every currently-registered agent, appending the
/// standard broadcast hint. Returns a list of per-agent error strings
/// for any that failed (empty = all ok). The sender's own inbox is
/// included — the hint text tells agents to ignore if no action needed.
/// Deliver `body` to every currently-registered agent except the sender,
/// appending the standard broadcast hint. Returns a list of per-agent
/// error strings for any that failed (empty = all ok).
pub fn broadcast_send(&self, from: &str, body: &str) -> Vec<String> {
const HINT: &str =
"\n\n⚠️ _hint: this was a broadcast and may not need any action from you_";
let broadcast_body = format!("{body}{HINT}");
let mut errors = Vec::new();
for agent_name in self.list_agents() {
if agent_name == from {
continue;
}
if let Err(e) = self.broker.send(&hive_sh4re::Message {
from: from.to_owned(),
to: agent_name.clone(),