fix(agent): replay the history prefix when healing a deleted session row
The heal retry passed the caller's conversation_history through, so _db_flush_collect's id()-based history shortcut treated the prefix as already durable and skipped it. The row was recreated with only the new tail and the flush returned True: a silent partial restore. On the session_row_missing retry, pass conversation_history=None so the full in-memory transcript lands on the recreated row. Co-authored-by: 赵桂雄 <daniel21436@hotmail.com>
This commit is contained in:
@@ -444,7 +444,10 @@ class SessionPersistenceMixin:
|
||||
return True
|
||||
except 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 False
|
||||
|
||||
def _get_messages_up_to_last_assistant(self, messages: List[Dict]) -> List[Dict]:
|
||||
|
||||
Reference in New Issue
Block a user