Skip to content

fix(heartbeat): keep routine ok states silent - #1167

Open
rcnsnr wants to merge 1 commit into
openlegion-ai:mainfrom
rcnsnr:fix/heartbeat-silent-routine-ok
Open

fix(heartbeat): keep routine ok states silent#1167
rcnsnr wants to merge 1 commit into
openlegion-ai:mainfrom
rcnsnr:fix/heartbeat-silent-routine-ok

Conversation

@rcnsnr

@rcnsnr rcnsnr commented Jun 26, 2026

Copy link
Copy Markdown

Summary

  • Update heartbeat prompts in loop.py and cron.py 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 without notifying the user

Why

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_user tool calls.

Test plan

  • test_heartbeat_prompt_uses_silent_ok_rule — verifies new prompt text is present and old phrasing is gone
  • Full TestHeartbeatDispatchFn suite: 5 passed, 0 failed

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.
@cla-assistant

cla-assistant Bot commented Jun 26, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@cla-assistant

cla-assistant Bot commented Jun 26, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@bicced bicced left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) drop HEARTBEAT_OK, the heartbeat_complete liveness event is emitted independently of any notify_user call, and no downstream consumer expects a per-heartbeat notification.
  • Daily summaries are unaffected — they run via the deterministic compose_work_summary cron 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_user now writes a notification-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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants