From 27b1a4fd9af52db5823593732f89c168c232a950 Mon Sep 17 00:00:00 2001 From: iliya Date: Mon, 30 Mar 2026 19:07:16 +0300 Subject: [PATCH] fix(graph): filter system messages from particles + fix direction - Skip idle_notification, shutdown, and other JSON system messages (was showing {"type":"idle_notificatio... as particle labels) - Skip system_notification source messages - Skip messages with < 3 chars --- .../agent-graph/adapters/TeamGraphAdapter.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/renderer/features/agent-graph/adapters/TeamGraphAdapter.ts b/src/renderer/features/agent-graph/adapters/TeamGraphAdapter.ts index fb446754..97d0fdcf 100644 --- a/src/renderer/features/agent-graph/adapters/TeamGraphAdapter.ts +++ b/src/renderer/features/agent-graph/adapters/TeamGraphAdapter.ts @@ -494,6 +494,9 @@ export class TeamGraphAdapter { if (this.#seenMessageIds.has(msgKey)) continue; this.#seenMessageIds.add(msgKey); + // Skip system/noise messages (idle notifications, JSON blobs) + if (TeamGraphAdapter.#isSystemMessage(msg)) continue; + const edgeId = TeamGraphAdapter.#resolveMessageEdge(msg, teamName, leadId, leadName, edges); if (!edgeId) continue; @@ -691,6 +694,18 @@ export class TeamGraphAdapter { return `member:${teamName}:${name}`; } + /** Filter out system/noise messages that shouldn't show as particles */ + static #isSystemMessage(msg: InboxMessage): boolean { + const text = msg.text ?? ''; + // JSON system messages (idle_notification, shutdown, etc.) + if (text.startsWith('{"type":') || text.startsWith('{"type" :')) return true; + // Very short system messages + if (text.length < 3) return true; + // System notification source + if (msg.source === 'system_notification') return true; + return false; + } + static #buildParticleLabel( text: string | undefined, kind: 'inbox' | 'comment',