Refine: system messages pass only if agent @mentioned (not blanket ignore)

This commit is contained in:
Markov 2026-02-27 08:00:00 +01:00
parent f8d9a6a41d
commit fc86592a73

View File

@ -79,18 +79,22 @@ 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;
}
// System messages: only process if agent is explicitly mentioned (@slug)
// This lets assignment/mention notifications through, but ignores generic lifecycle events
if (authorType === 'system') {
if (!content.includes(`@${this.config.slug}`)) {
this.log.info('│ Skipping system message (not mentioned): "%s"', content.slice(0, 100));
return;
}
this.log.info('│ Processing system message (mentioned): "%s"', content.slice(0, 100));
}
// Build context-rich prompt for the agent
const ctx = taskId ? `[задача ${taskKey || taskId}]` : chatId ? '[чат]' : '';
const from = authorType === 'system' ? '[система]' : `@${resolvedAuthorSlug}`;