From 41843b0fb06008aa970fe48816d223fd67e3ba25 Mon Sep 17 00:00:00 2001 From: Flo Date: Mon, 23 Mar 2026 17:58:41 +0300 Subject: [PATCH] fix: clear heartbeat session to prevent token overflow (#2398) --- nanobot/cli/commands.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nanobot/cli/commands.py b/nanobot/cli/commands.py index 4ffe6a640..ef0bc31da 100644 --- a/nanobot/cli/commands.py +++ b/nanobot/cli/commands.py @@ -621,6 +621,12 @@ def gateway( chat_id=chat_id, on_progress=_silent, ) + + # Clear the heartbeat session to prevent token overflow from accumulated tasks + session = agent.sessions.get_or_create("heartbeat") + session.clear() + agent.sessions.save(session) + return resp.content if resp else "" async def on_heartbeat_notify(response: str) -> None: