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
This commit is contained in:
+23
-7
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user