fix: bypass empty-heartbeat-file check for cron jobs#6822
Closed
radling005 wants to merge 1 commit intoopenclaw:mainfrom
Closed
fix: bypass empty-heartbeat-file check for cron jobs#6822radling005 wants to merge 1 commit intoopenclaw:mainfrom
radling005 wants to merge 1 commit intoopenclaw:mainfrom
Conversation
Cron jobs with wakeMode: 'now' were being skipped when HEARTBEAT.md was empty or contained only comments, even though they had pending system events to process. Add cron jobs to the bypass list alongside exec-events, ensuring cron-triggered wakes are processed regardless of HEARTBEAT.md state. Fixes openclaw#4224
Author
|
Closing - created prematurely without checking if this was the right approach given existing similar PRs. Apologies for the noise. |
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.
Summary
Cron jobs with
wakeMode: 'now'were being skipped whenHEARTBEAT.mdwas empty or contained only comments, even though they had pending system events to process.Problem
When a cron job fires with
wakeMode: 'now', it:enqueueSystemEvent(text)runHeartbeatOnce({ reason: 'cron:${job.id}' })But
runHeartbeatOnce()checks ifHEARTBEAT.mdis effectively empty and skips if so — returning{ status: 'skipped', reason: 'empty-heartbeat-file' }.The bypass only existed for
reason === 'exec-event', not for cron jobs.Fix
Add cron jobs to the bypass list:
This ensures cron-triggered wakes are treated the same as exec-event wakes — both have pending system events that need processing regardless of
HEARTBEAT.mdstate.Testing
Tested locally with:
wakeMode: 'now'and emptyHEARTBEAT.mdlastStatus: 'skipped',lastError: 'empty-heartbeat-file'Fixes #4224
Recreated from #4256 which was accidentally closed.
Greptile Overview
Greptile Summary
This PR updates
runHeartbeatOnce()to avoid skipping runs triggered by cron jobs whenHEARTBEAT.mdhas no actionable content. Specifically, it extends the existing “exec-event” bypass to also include wake reasons that start withcron:(e.g.cron:<jobId>), so cron-triggered wakeups can process pending system events even if the heartbeat file is empty/comment-only.The change fits into the heartbeat runner’s early-exit logic that tries to save LLM/API cost by skipping heartbeats when there is nothing actionable in
HEARTBEAT.md. Cron jobs withwakeMode: 'now'enqueue work via system events and then callrunHeartbeatOnce(), so they need to bypass the empty-file check similar to exec-event wakes.Confidence Score: 5/5
(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!
Context used:
dashboard- CLAUDE.md (source)dashboard- AGENTS.md (source)