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.
This commit is contained in:
James 2026-03-08 04:30:53 -04:00
parent 27fb5ac215
commit 9ff3c8cde9
1 changed files with 4 additions and 1 deletions

View File

@ -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)
}
}
}