From 63ed4e935155725464e78d9016508c3b2f6da2d6 Mon Sep 17 00:00:00 2001 From: viettranx Date: Sun, 29 Mar 2026 22:37:01 +0700 Subject: [PATCH] fix: filter channel team task events from web UI chat Admin users were seeing team task notifications from other channels (Discord, Telegram, Lark) in their web UI chat due to bypassing the UserID event filter. Added channel check to handleTeamTaskEvent matching the existing pattern in handleAgentEvent. --- ui/web/src/pages/chat/hooks/use-chat-messages.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ui/web/src/pages/chat/hooks/use-chat-messages.ts b/ui/web/src/pages/chat/hooks/use-chat-messages.ts index c97e431a..6043e05a 100644 --- a/ui/web/src/pages/chat/hooks/use-chat-messages.ts +++ b/ui/web/src/pages/chat/hooks/use-chat-messages.ts @@ -437,9 +437,16 @@ export function useChatMessages(sessionKey: string, agentId: string) { progress_percent?: number; progress_step?: string; reason?: string; + channel?: string; }; if (!event?.team_id) return; + // Only process team task events from WS channel (matches handleAgentEvent filter). + // Prevents channel events (Telegram, Discord, etc.) leaking into web UI chat. + if (event.channel && event.channel !== "ws") { + return; + } + setTeamTasks((prev) => { const existing = prev.find((t) => t.taskId === event.task_id);