This commit is contained in:
radling005 2026-01-30 11:55:32 +00:00 committed by GitHub
commit b4de902c33
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -462,13 +462,18 @@ export async function runHeartbeatOnce(opts: {
// Skip heartbeat if HEARTBEAT.md exists but has no actionable content. // 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). // 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 isExecEventReason = opts.reason === "exec-event";
const isCronReason = opts.reason?.startsWith("cron:");
const workspaceDir = resolveAgentWorkspaceDir(cfg, agentId); const workspaceDir = resolveAgentWorkspaceDir(cfg, agentId);
const heartbeatFilePath = path.join(workspaceDir, DEFAULT_HEARTBEAT_FILENAME); const heartbeatFilePath = path.join(workspaceDir, DEFAULT_HEARTBEAT_FILENAME);
try { try {
const heartbeatFileContent = await fs.readFile(heartbeatFilePath, "utf-8"); const heartbeatFileContent = await fs.readFile(heartbeatFilePath, "utf-8");
if (isHeartbeatContentEffectivelyEmpty(heartbeatFileContent) && !isExecEventReason) { if (
isHeartbeatContentEffectivelyEmpty(heartbeatFileContent) &&
!isExecEventReason &&
!isCronReason
) {
emitHeartbeatEvent({ emitHeartbeatEvent({
status: "skipped", status: "skipped",
reason: "empty-heartbeat-file", reason: "empty-heartbeat-file",