From 3ba0191cef221828713a144b8c9357a9e105cccb Mon Sep 17 00:00:00 2001 From: Cheng Wang Date: Mon, 2 Feb 2026 19:47:42 +0800 Subject: [PATCH] fix: correct heartbeat token matching logic The HEARTBEAT_OK_TOKEN comparison was broken because the token itself ("HEARTBEAT_OK" with underscore) was being compared against a response string that had underscores removed. This made the condition always fail, preventing the heartbeat service from recognizing "no tasks" responses. Now both sides of the comparison remove underscores consistently, allowing proper matching of the HEARTBEAT_OK token. --- nanobot/heartbeat/service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nanobot/heartbeat/service.py b/nanobot/heartbeat/service.py index 4cb469e..221ed27 100644 --- a/nanobot/heartbeat/service.py +++ b/nanobot/heartbeat/service.py @@ -115,7 +115,7 @@ class HeartbeatService: response = await self.on_heartbeat(HEARTBEAT_PROMPT) # Check if agent said "nothing to do" - if HEARTBEAT_OK_TOKEN in response.upper().replace("_", ""): + if HEARTBEAT_OK_TOKEN.replace("_", "") in response.upper().replace("_", ""): logger.info("Heartbeat: OK (no action needed)") else: logger.info(f"Heartbeat: completed task")