From 1e99bd669e494f619e2e55653de4333772ad4d8c Mon Sep 17 00:00:00 2001 From: Copilot <223556219+Copilot@users.noreply.github.com> Date: Fri, 15 May 2026 06:30:40 +0200 Subject: [PATCH] fix(auto): heartbeat before unit execution to prevent false-positive watchdog stalls The HaltWatchdog fires when the loop goes >10s without a heartbeat. Each iteration ends with a heartbeat, but unit execution itself can take 3+ minutes. Without a heartbeat at the start of the unit phase, the watchdog detects idle and emits a false-positive 'possible stuck iteration' error. Add watchdog.heartbeat() immediately before both runUnitPhaseViaContract calls (one in the custom-engine path, one in the dev path) so the watchdog timer is reset before the long-running work begins. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/resources/extensions/sf/auto/loop.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/resources/extensions/sf/auto/loop.js b/src/resources/extensions/sf/auto/loop.js index e7968234b..637ae083c 100644 --- a/src/resources/extensions/sf/auto/loop.js +++ b/src/resources/extensions/sf/auto/loop.js @@ -891,6 +891,7 @@ export async function autoLoop(ctx, pi, s, deps) { } // ── Unit execution (shared with dev path) ── await enforceMinRequestInterval(s, ic.prefs); + watchdog.heartbeat(); // reset before long-running unit execution const unitPhaseResult = await runUnitPhaseViaContract( ic, iterData, @@ -1214,6 +1215,7 @@ export async function autoLoop(ctx, pi, s, deps) { }); } await enforceMinRequestInterval(s, ic.prefs); + watchdog.heartbeat(); // reset before long-running unit execution const unitPhaseResult = await runUnitPhaseViaContract( ic, iterData,