From 0e99e31fe9d10760ef43d613959acb76c284aea4 Mon Sep 17 00:00:00 2001 From: operator Date: Mon, 5 Oct 2026 03:30:25 +0000 Subject: [PATCH] fix(loop): eliminate main chat saturation from sidechat activity - Exclude automated jobs ([JOB ...]) and heartbeat from sidechat activity digestion - Exclude recurring background job channels (box-*-health, canary, heartbeat) from monitored sidechats - Reset default prompt destinations to dedicated task sidechats (646 tasks, main-loop brain, pip tasks, muse tasks) - Prevent synthetic 'Incoming sidechat activity' prompts from polluting agent Main Chats --- bin/self_main_loop.py | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/bin/self_main_loop.py b/bin/self_main_loop.py index 65caf68..e7d8e43 100755 --- a/bin/self_main_loop.py +++ b/bin/self_main_loop.py @@ -63,11 +63,11 @@ FOLLOWUPS_FILE = os.path.join(BASE, "followups.json") DEFAULT_AGENTS = ["muse", "pip", "646", "opm", "dev"] # Prompting sidechat per agent — mirrors box-ctl.py NOTIFY_SIDECHATS. DEFAULT_PROMPT_SIDECHAT = { - "646": "main", - "opm": "main", - "pip": "main", - "muse": "main", - "dev": "main", + "646": "646 tasks", + "opm": "main-loop brain", + "pip": "pip tasks", + "muse": "muse tasks", + "dev": "dev-audit-channel", } DEFAULT_SENDER = "opm" # neutral sender, mirrors `box notify` READ_LIMIT = 30 @@ -138,6 +138,8 @@ def get_config(st): continue if a == "opm" and sc in ("heartbeat",): continue + if sc == "main": + continue prompt[a] = sc enabled = dict(cfg.get("enabled") or {}) # Default any unlisted agent to enabled. @@ -245,7 +247,11 @@ def get_monitored_sidechats(agent): continue item_agent = item.get("agent") if name.endswith(f"@{agent}") or (item_agent == agent and "@" not in name): - if name.startswith("pipe-") or name.startswith("test-"): + if name.startswith("pipe-") or name.startswith("test-") or name.startswith("onboarding-"): + continue + if "heartbeat" in name.lower(): + continue + if any(name.startswith(p) for p in ("box-http-health", "box-service-health", "box-deep-health", "canary")): continue monitored[uuid] = name return monitored @@ -413,7 +419,14 @@ def check_sidechats(agent, cfg, wm, threads_meta): } for m in msgs] new_msgs = new_messages(formatted, {"last_id": last_id}) - incoming = [m for m in new_msgs if m.get("role") != "assistant"] + incoming = [] + for m in new_msgs: + if m.get("role") == "assistant": + continue + text = m.get("text", "") + if "[JOB " in text or "Heartbeat check" in text or "[from:super]" in text: + continue + incoming.append(m) if incoming: new_activity.append({ @@ -617,6 +630,9 @@ def do_check(only_agent=None): parts.append(compose_dual_digest(agent, main_new, sc_activity)) if subagent_alerts: parts.extend(subagent_alerts) + if not parts: + results[agent] = {"ok": True, "new": 0} + continue digest = "\n\n".join(parts)[:DIGEST_MAX * 2] if not sidechat: log("%s: no prompting sidechat configured, skipping" % agent)