mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 01:18:28 +00:00
fix(heartbeat): exempt wake and hook reasons from empty-heartbeat skip (openclaw#14532) thanks @arosstale
Verified: - pnpm build - pnpm check - pnpm test Co-authored-by: arosstale <117890364+arosstale@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
@@ -426,10 +426,11 @@ export async function runHeartbeatOnce(opts: {
|
||||
|
||||
// Skip heartbeat if HEARTBEAT.md exists but has no actionable content.
|
||||
// This saves API calls/costs when the file is effectively empty (only comments/headers).
|
||||
// EXCEPTION: Don't skip for exec events or cron events - they have pending system events
|
||||
// to process regardless of HEARTBEAT.md content.
|
||||
// EXCEPTION: Don't skip for exec events, cron events, or explicit wake requests -
|
||||
// they have pending system events to process regardless of HEARTBEAT.md content.
|
||||
const isExecEventReason = opts.reason === "exec-event";
|
||||
const isCronEventReason = Boolean(opts.reason?.startsWith("cron:"));
|
||||
const isWakeReason = opts.reason === "wake" || Boolean(opts.reason?.startsWith("hook:"));
|
||||
const workspaceDir = resolveAgentWorkspaceDir(cfg, agentId);
|
||||
const heartbeatFilePath = path.join(workspaceDir, DEFAULT_HEARTBEAT_FILENAME);
|
||||
try {
|
||||
@@ -437,7 +438,8 @@ export async function runHeartbeatOnce(opts: {
|
||||
if (
|
||||
isHeartbeatContentEffectivelyEmpty(heartbeatFileContent) &&
|
||||
!isExecEventReason &&
|
||||
!isCronEventReason
|
||||
!isCronEventReason &&
|
||||
!isWakeReason
|
||||
) {
|
||||
emitHeartbeatEvent({
|
||||
status: "skipped",
|
||||
|
||||
Reference in New Issue
Block a user