From ba0a3d14d9fdb0b0188a32239e3cf8b666f27dc3 Mon Sep 17 00:00:00 2001 From: flobo3 Date: Mon, 23 Mar 2026 15:19:08 +0300 Subject: [PATCH] fix: clear heartbeat session to prevent token overflow (cherry picked from commit 5c871d75d5b1aac09a8df31e6d1e04ee3d9b0d2c) --- nanobot/cli/commands.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nanobot/cli/commands.py b/nanobot/cli/commands.py index 8354a83..372056a 100644 --- a/nanobot/cli/commands.py +++ b/nanobot/cli/commands.py @@ -619,6 +619,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: