feat(FN-4386): complete Step 2 — gate timer heartbeat when idle

Fusion-Task-Id: FN-4386
Fusion-Task-Lineage: 82c1c281-8d69-42c1-8705-90e811b6df93
This commit is contained in:
Fusion
2026-05-13 16:25:31 -07:00
committed by gsxdsm
parent e1f2b24685
commit 8a9f320983

View File

@@ -3764,8 +3764,17 @@ export class HeartbeatTriggerScheduler {
return;
}
// Guard: skip timer ticks for idle agents when configured
const timerRc = (agent.runtimeConfig ?? {}) as {
allowParallelExecution?: boolean;
skipHeartbeatWhenIdle?: boolean;
};
if (timerRc.skipHeartbeatWhenIdle === true && (!agent.taskId || agent.taskId.length === 0)) {
heartbeatLog.log(`Timer tick skipped for ${agentId} (skipHeartbeatWhenIdle, no task assigned)`);
return;
}
// Guard: when parallel execution is disabled, skip if the agent's bound task is actively executing
const timerRc = (agent.runtimeConfig ?? {}) as { allowParallelExecution?: boolean };
if (timerRc.allowParallelExecution === false && agent.taskId && this.isTaskExecuting?.(agent.taskId)) {
heartbeatLog.log(`Timer tick skipped for ${agentId} (parallel execution disabled, task ${agent.taskId} executing)`);
return;