fix: clear heartbeat session to prevent token overflow (#2398)

This commit is contained in:
Flo 2026-03-23 17:58:41 +03:00 committed by GitHub
parent 528b3cfe5a
commit 41843b0fb0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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: