From 9ff3c8cde95f47e62089ca41b2e0b532610879c1 Mon Sep 17 00:00:00 2001 From: James Date: Sun, 8 Mar 2026 04:30:53 -0400 Subject: [PATCH] fix: broadcast messages use agentchat session, not main When a human sends a group message (with or without name-mentions), agents were being dispatched with direct=true, routing to the 'main' session. This conflicts with active webchat/Telegram sessions on the same agent, causing silent timeouts (context deadline exceeded). Fix: broadcast/name-mention dispatches now use direct=false, which routes to the 'agentchat' session. Only explicit To-field 1:1 messages still use direct=true -> main session. Identified from agentchat logs 2026-03-08. Issue: James messages dropping when webchat session was active. --- main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index d435ca2..3d6f2d3 100644 --- a/main.go +++ b/main.go @@ -396,7 +396,10 @@ func (h *Hub) handleWS(w http.ResponseWriter, r *http.Request) { } } for _, name := range targets { - h.sendToAgent(msg, name, 999, true) + // Use direct=false for broadcasts/name-mentions so they route to + // the "agentchat" session, not "main" (avoids conflict with active + // webchat/Telegram sessions on the same agent). + h.sendToAgent(msg, name, 999, false) } } }