fix: don't skip heartbeat for cron systemEvent jobs with empty HEARTB…#5415
Closed
betterthanhajin wants to merge 1 commit intoopenclaw:mainfrom
Closed
fix: don't skip heartbeat for cron systemEvent jobs with empty HEARTB…#5415betterthanhajin wants to merge 1 commit intoopenclaw:mainfrom
betterthanhajin wants to merge 1 commit intoopenclaw:mainfrom
Conversation
|
Approved. The skip condition was too aggressive for cron-triggered heartbeats — good catch that pending systemEvents were being starved.
No regressions expected since it's only widening the bypass set. Great minimal PR. |
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Cron jobs with
kind: systemEventwere not being processed whenHEARTBEAT.mdwas empty.The heartbeat runner skips execution when
HEARTBEAT.mdhas no actionable content to save API costs. However, onlyexec-eventwas 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
isCronReasoncheck alongsideisExecEventReasonto prevent skipping heartbeat when cron jobs enqueue system events.Changes
opts.reason?.startsWith("cron:"))Fixes #5349
Greptile Overview
Greptile Summary
This PR updates the heartbeat “empty HEARTBEAT.md” optimization in
src/infra/heartbeat-runner.tsso that the runner will not skip heartbeats when the wake reason indicates a cron-triggered run (reasonstarts withcron:), alongside the existing exception forexec-event. This aligns the skip logic with the fact that cronsystemEventjobs 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
(2/5) Greptile learns from your feedback when you react with thumbs up/down!