Skip to content

fix(cron): avoid heartbeat redelivery after successful delivery#165

Open
louiseboo wants to merge 2 commits into
EverMind-AI:mainfrom
louiseboo:fix/cron-delivery-heartbeat-duplicate
Open

fix(cron): avoid heartbeat redelivery after successful delivery#165
louiseboo wants to merge 2 commits into
EverMind-AI:mainfrom
louiseboo:fix/cron-delivery-heartbeat-duplicate

Conversation

@louiseboo

Copy link
Copy Markdown

Fixes #164

What changed

  • Skip successful Heartbeat event emission for user-facing (deliver=true) Cron jobs that were already delivered.
  • Keep Heartbeat wake behavior for successful silent jobs.
  • Preserve failure event and wake behavior.
  • Add regression coverage for delivered, silent, and no-response paths.

Root cause

A successful user-facing Cron run was delivered through the normal outlet and then emitted again as a system event. That event woke Heartbeat, which treated the same result as pending user-facing work and sent a second reminder.

Verification

  • uv run pytest -q tests/test_event_wake.py tests/test_cli_cron_handler.py -k 'not repl_assembly_cron_renders_once_via_clioutlet_not_broadcast' — 38 passed, 1 deselected
  • uv run ruff check raven/cli/_cron_handler.py tests/test_cli_cron_handler.py — passed
  • Reproduced the new regression test failing before the fix and passing after it.

The deselected REPL assembly test already fails on untouched upstream/main; this PR does not modify that path.

Clarify conditions for enqueuing system events and early heartbeat ticks for cron runs.
@louiseboo
louiseboo marked this pull request as ready for review July 21, 2026 03:42
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.

Delivered cron reminders are sent twice via heartbeat wake

1 participant