Skip to content

fix: don't skip heartbeat for cron systemEvent jobs with empty HEARTB…#5415

Closed
betterthanhajin wants to merge 1 commit intoopenclaw:mainfrom
betterthanhajin:main
Closed

fix: don't skip heartbeat for cron systemEvent jobs with empty HEARTB…#5415
betterthanhajin wants to merge 1 commit intoopenclaw:mainfrom
betterthanhajin:main

Conversation

@betterthanhajin
Copy link

@betterthanhajin betterthanhajin commented Jan 31, 2026

Problem

Cron jobs with kind: systemEvent were not being processed when HEARTBEAT.md was empty.

The heartbeat runner skips execution when HEARTBEAT.md has no actionable content to save API costs. However, only exec-event was exempted from this optimization, while cron jobs with pending system events were incorrectly skipped.

This caused system events from cron to queue up indefinitely until a user message triggered processing.

Solution

Add isCronReason check alongside isExecEventReason to prevent skipping heartbeat when cron jobs enqueue system events.

Changes

  • Added check for cron reasons (opts.reason?.startsWith("cron:"))
  • Updated condition to not skip heartbeat for cron-triggered events

Fixes #5349

Greptile Overview

Greptile Summary

This PR updates the heartbeat “empty HEARTBEAT.md” optimization in src/infra/heartbeat-runner.ts so that the runner will not skip heartbeats when the wake reason indicates a cron-triggered run (reason starts with cron:), alongside the existing exception for exec-event. This aligns the skip logic with the fact that cron systemEvent jobs may have pending system events to process even when the heartbeat file itself is effectively empty, preventing cron-enqueued events from stalling until a user message arrives.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk.
  • The change is small, localized, and consistent with existing reason-based exceptions, using a null-safe check for cron-prefixed reasons; it only broadens the set of reasons that bypass the empty-heartbeat skip, which matches the stated behavior for pending system events.
  • No files require special attention

(2/5) Greptile learns from your feedback when you react with thumbs up/down!

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

No files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@usama7871
Copy link

Approved.

The skip condition was too aggressive for cron-triggered heartbeats — good catch that pending systemEvents were being starved.

isCronReason addition + existing isExecEventReason makes the logic consistent now.

No regressions expected since it's only widening the bypass set.

Great minimal PR.

@tyler6204
Copy link
Member

Superseded by #11641 (merge commit: 8fae55e). Closing to reduce duplicate PR noise. Please open a new PR only if there is additional scope beyond this fix.

@tyler6204 tyler6204 closed this Feb 8, 2026
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.

Cron system events not processed without user interaction

3 participants

Comments