From 7848911a5f735814d2ff3a25a4b14b4e2f2f4de7 Mon Sep 17 00:00:00 2001 From: Algis Dumbris Date: Thu, 26 Mar 2026 08:56:37 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20ignore=20system=20DMs=20in=20reactor=20?= =?UTF-8?q?=E2=80=94=20prevent=20stalemate=20notification=20cascade?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The StaleWorker sends DMs from 'system' to all channel members when workflow messages are stuck in 'proposed' state. These DMs were triggering reactive agent runs, which couldn't action the stale messages, burning daily budget on wasted K8s Jobs. Now: reactor silently ignores all messages from 'system' sender. System notifications are for human review, not agent action. Co-Authored-By: Claude Opus 4.6 (1M context) --- internal/reactor/reactor.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/reactor/reactor.go b/internal/reactor/reactor.go index 3e3f4c4..18fb069 100644 --- a/internal/reactor/reactor.go +++ b/internal/reactor/reactor.go @@ -75,6 +75,13 @@ func (r *Reactor) Dispatch(ctx context.Context, event dispatcher.MessageEvent) e // evaluateTrigger runs the decision chain for a single agent. func (r *Reactor) evaluateTrigger(ctx context.Context, agentName string, event dispatcher.MessageEvent) error { + // 0. Ignore system messages — stalemate worker notifications, retention warnings, + // and other automated DMs should NOT trigger reactive runs. They're notifications + // meant for the human owner, not actionable work for agents. + if event.FromAgent == "system" { + return nil + } + // 1. Get agent config agent, err := r.agentStore.GetAgentByName(ctx, agentName) if err != nil {