Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(watchdog): progress-mode heartbeat counts down to the deadline, not deadline+grace

garrytan2c9241cf671a
diff --git a/src/core/process-watchdog.ts b/src/core/process-watchdog.ts
index 237faf1827..da9db8a354 100644
--- a/src/core/process-watchdog.ts
+++ b/src/core/process-watchdog.ts
@@ -171,8 +171,12 @@ if (heartbeatMs > 0) {
w('parent alive ' + elapsed + 's elapsed, past the deadline and still progressing (last progress ' + Math.round((Date.now() - lastProgress) / 1000) + 's ago); stops after ' + Math.round(progressWindowMs / 1000) + 's without progress');
return;
}
+ if (progressWindowMs > 0) {
+ w('parent alive ' + elapsed + 's elapsed, deadline in ~' + Math.round((deadlineMs - (Date.now() - t0)) / 1000) + 's (extends while progressing)');
+ return;
+ }
const killIn = Math.round((deadlineMs + graceMs - (Date.now() - t0)) / 1000);
- w('parent alive ' + elapsed + 's elapsed, ' + (progressWindowMs > 0 ? 'deadline' : 'hard-kill') + ' in ~' + killIn + 's');
+ w('parent alive ' + elapsed + 's elapsed, hard-kill in ~' + killIn + 's');
}, heartbeatMs);
if (typeof hb.unref === 'function') hb.unref();
}