suppress unnecessary heartbeat 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:
@@ -153,9 +153,15 @@ class HeartbeatService:
|
||||
logger.info("Heartbeat: OK (nothing to report)")
|
||||
return
|
||||
|
||||
taskmessage = tasks + "\n\n**IMPORTANT NOTICE:** If there is nothing material to report, reply only with <SILENT_OK>."
|
||||
|
||||
logger.info("Heartbeat: tasks found, executing...")
|
||||
if self.on_execute:
|
||||
response = await self.on_execute(tasks)
|
||||
response = await self.on_execute(taskmessage)
|
||||
|
||||
if response and "<SILENT_OK>" in response:
|
||||
logger.info("Heartbeat: OK (silenced by agent)")
|
||||
return
|
||||
if response and self.on_notify:
|
||||
logger.info("Heartbeat: completed, delivering response")
|
||||
await self.on_notify(response)
|
||||
|
||||
Reference in New Issue
Block a user