From f8d9a6a41d3013b4704704058a59b1c7889c5bda Mon Sep 17 00:00:00 2001 From: Markov Date: Fri, 27 Feb 2026 07:31:14 +0100 Subject: [PATCH] Fix: ignore system messages and own messages in router System messages (task lifecycle) were being forwarded to agent as new prompts, causing duplicate task creation. Agent also received its own chat.send broadcasts back and processed them. --- src/router.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/router.ts b/src/router.ts index 0a86ec0..544ecaa 100644 --- a/src/router.ts +++ b/src/router.ts @@ -79,6 +79,18 @@ export class EventRouter { return; } + // Ignore system messages — they are lifecycle notifications, not user input + if (authorType === 'system') { + this.log.info('│ Skipping system message: "%s"', content.slice(0, 100)); + return; + } + + // Ignore own messages (agent talking to itself) + if (resolvedAuthorSlug === this.config.slug) { + this.log.info('│ Skipping own message'); + return; + } + // Build context-rich prompt for the agent const ctx = taskId ? `[задача ${taskKey || taskId}]` : chatId ? '[чат]' : ''; const from = authorType === 'system' ? '[система]' : `@${resolvedAuthorSlug}`;