suppress unnecessary cron notifications
Appends a strict instruction to background task prompts (cron and heartbeat) directing the agent to return a `<SILENT_OK>` token if there is nothing material to report. Adds conditional logic to intercept this token and suppress the outbound message to the user, preventing notification spam from autonomous background checks.
This commit is contained in:
@@ -452,6 +452,7 @@ def gateway(
|
||||
"[Scheduled Task] Timer finished.\n\n"
|
||||
f"Task '{job.name}' has been triggered.\n"
|
||||
f"Scheduled instruction: {job.payload.message}"
|
||||
"**IMPORTANT NOTICE:** If there is nothing material to report, reply only with <SILENT_OK>."
|
||||
)
|
||||
|
||||
# Prevent the agent from scheduling new cron jobs during execution
|
||||
@@ -474,7 +475,7 @@ def gateway(
|
||||
if isinstance(message_tool, MessageTool) and message_tool._sent_in_turn:
|
||||
return response
|
||||
|
||||
if job.payload.deliver and job.payload.to and response:
|
||||
if job.payload.deliver and job.payload.to and response and "<SILENT_OK>" not in response:
|
||||
from nanobot.bus.events import OutboundMessage
|
||||
await bus.publish_outbound(OutboundMessage(
|
||||
channel=job.payload.channel or "cli",
|
||||
|
||||
Reference in New Issue
Block a user