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
This commit is contained in:
iliya 2026-03-30 19:07:16 +03:00
parent f6daced2ce
commit 27b1a4fd9a

View file

@ -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',