diff --git a/src/infra/heartbeat-runner.ts b/src/infra/heartbeat-runner.ts index ac3471adf..9bd67c69f 100644 --- a/src/infra/heartbeat-runner.ts +++ b/src/infra/heartbeat-runner.ts @@ -462,13 +462,18 @@ 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 - they have pending system events to process. + // EXCEPTION: Don't skip for exec events or cron jobs - they have pending system events to process. const isExecEventReason = opts.reason === "exec-event"; + const isCronReason = opts.reason?.startsWith("cron:"); const workspaceDir = resolveAgentWorkspaceDir(cfg, agentId); const heartbeatFilePath = path.join(workspaceDir, DEFAULT_HEARTBEAT_FILENAME); try { const heartbeatFileContent = await fs.readFile(heartbeatFilePath, "utf-8"); - if (isHeartbeatContentEffectivelyEmpty(heartbeatFileContent) && !isExecEventReason) { + if ( + isHeartbeatContentEffectivelyEmpty(heartbeatFileContent) && + !isExecEventReason && + !isCronReason + ) { emitHeartbeatEvent({ status: "skipped", reason: "empty-heartbeat-file",