fix broadcast send for manager, deduplicate into coordinator.broadcast_send

This commit is contained in:
damocles 2026-05-16 19:31:53 +02:00
parent f3739d2b8e
commit 1a36c38a54
3 changed files with 45 additions and 25 deletions

View file

@ -104,21 +104,7 @@ async fn dispatch(req: &AgentRequest, agent: &str, coord: &Arc<Coordinator>) ->
AgentRequest::Send { to, body } => {
// Handle broadcast sends (recipient = "*")
if to == "*" {
let agents = coord.list_agents();
let broadcast_hint = "\n\n⚠️ _hint: this was a broadcast and may not need any action from you_";
let broadcast_body = format!("{}{}", body, broadcast_hint);
let mut errors = Vec::new();
for agent_name in agents {
if let Err(e) = broker.send(&Message {
from: agent.to_owned(),
to: agent_name.clone(),
body: broadcast_body.clone(),
}) {
errors.push(format!("{}: {e}", agent_name));
}
}
let errors = coord.broadcast_send(agent, body);
if errors.is_empty() {
AgentResponse::Ok
} else {