The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(agent): replay the history prefix when healing a deleted session row
kshitijk4poore9a98598340b
diff --git a/agent/session_persistence.py b/agent/session_persistence.pyindex 6279f4e3d57..7ea64314d08 100644--- a/agent/session_persistence.py+++ b/agent/session_persistence.py@@ -444,7 +444,10 @@ class SessionPersistenceMixin:return Trueexcept Exception as e:if _db_flush_failed(self, e, batch_rows, _adoption_budget, messages):- return self._flush_messages_to_session_db_unlocked(messages, conversation_history, _adoption_budget=0)+ # A recreated row lost the history prefix too: the id()-based history shortcut must not skip it.+ healed = self._last_persistence_error_cause == "session_row_missing"+ return self._flush_messages_to_session_db_unlocked(+ messages, None if healed else conversation_history, _adoption_budget=0)return Falsedef _get_messages_up_to_last_assistant(self, messages: List[Dict]) -> List[Dict]: