fix(run): heartbeat fires immediately after start due to monotonic/time mismatch

heartbeat_due was initialized from time.monotonic() but compared against
time.time(), causing the first heartbeat to always trigger on the first
loop iteration (duplicate message at startup).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude Agent
2026-04-16 23:12:28 +00:00
parent eca2b39e64
commit 8ff31ed241

View File

@@ -556,7 +556,7 @@ def run_live(cfg, duration_s=None, capture_stub: bool = False) -> None:
audit.log({"event": "started", "config": cfg.config_version, "canary": canary_status}) audit.log({"event": "started", "config": cfg.config_version, "canary": canary_status})
start = time.monotonic() start = time.monotonic()
heartbeat_due = start + cfg.heartbeat_min * 60 heartbeat_due = time.time() + cfg.heartbeat_min * 60
levels_extractor = None levels_extractor = None
last_saved_color: str | None = None last_saved_color: str | None = None
first_accepted = True first_accepted = True