fix(gateway): reset _last_flushed_db_idx when reusing cached agent (#44327) (#44518)

Co-authored-by: kyssta-exe <kyssta-exe@users.noreply.github.com>
This commit is contained in:
Kyssta
2026-06-11 22:41:34 -07:00
committed by GitHub
co-authored by kyssta-exe
parent a35b370284
commit a942bfd9cc
2 changed files with 37 additions and 0 deletions
+5
View File
@@ -12548,6 +12548,11 @@ class GatewayRunner(GatewayAuthorizationMixin, GatewayKanbanWatchersMixin, Gatew
if interrupt_depth == 0:
agent._last_activity_ts = time.time()
agent._last_activity_desc = "starting new turn (cached)"
# Reset the SessionDB flush cursor so the new turn's messages are
# fully persisted — a stale value from the previous turn would
# cause `_flush_messages_to_session_db` to skip new rows (#44327).
if hasattr(agent, "_last_flushed_db_idx"):
agent._last_flushed_db_idx = 0
agent._api_call_count = 0
def _release_evicted_agent_soft(self, agent: Any) -> None: