Skip to content

Your lightweight open-source personal agent.

fix: clear heartbeat session to prevent token overflow

flobo3ba0a3d14d9fd
diff --git a/nanobot/cli/commands.py b/nanobot/cli/commands.py
index 8354a8349..372056ab9 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: