fix(heartbeat): keep routine ok states silent - #1167
Conversation
Heartbeat prompts in both loop.py and cron.py previously instructed agents to always report results via notify_user. This produced unnecessary user notifications on every routine heartbeat cycle where nothing meaningful happened. Update the prompt text to instruct agents to use notify_user ONLY for actionable updates, alerts, or scheduled digest outputs. When everything is normal, agents should stay silent and return HEARTBEAT_OK. Test verifies the new prompt text is present and the old "Report what you worked on to the USER" phrasing is gone.
|
|
bicced
left a comment
There was a problem hiding this comment.
Approving — sound, low-risk improvement. Traced the full heartbeat/notification path to confirm safety:
- Silent heartbeats are already a designed-and-tested outcome:
suppress_empty+_EMPTY_RESPONSES(cron.py) dropHEARTBEAT_OK, theheartbeat_completeliveness event is emitted independently of anynotify_usercall, and no downstream consumer expects a per-heartbeat notification. - Daily summaries are unaffected — they run via the deterministic
compose_work_summarycron path (ensure_summary_job), not the heartbeat prompt. - The "actionable / alert / scheduled digest" carve-out preserves notifications for monitor/listening-style digest agents.
- Aligns with the chat-native-delivery direction:
notify_usernow writes anotification-role transcript row, so routine "nothing happened" pings are higher-visibility noise — trimming them is consistent.
One note on leverage: the heaviest no-op ticks are already short-circuited structurally before the LLM ever runs (the skip-LLM paths in cron.py / loop.py + suppress_empty), so this prompt nudge mainly trims over-reporting agents. That's fine — just don't expect a dramatic drop. If a hard guarantee is ever wanted, a server-side filter on heartbeat-origin notification events would be the structural lever (out of scope here).
Verified locally: tests/test_cron.py 92 passed, tests/test_loop.py 223 passed; the notify_user to report results assertions at test_loop.py:1999/2016 are unaffected (they cover the task/chat prompts, not the heartbeat prompt this edits).
Summary
loop.pyandcron.pyto instruct agents to usenotify_useronly for actionable updates, alerts, or scheduled digest outputsHEARTBEAT_OKwithout notifying the userWhy
The previous prompts always instructed agents to "report results to the user via notify_user", producing unnecessary notifications on every routine heartbeat cycle where nothing meaningful happened. This creates notification fatigue and wastes API credits on redundant
notify_usertool calls.Test plan
test_heartbeat_prompt_uses_silent_ok_rule— verifies new prompt text is present and old phrasing is goneTestHeartbeatDispatchFnsuite: 5 passed, 0 failed