Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion gateway/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -3379,7 +3379,13 @@ def rewrite_transcript(self, session_id: str, messages: List[Dict[str, Any]]) ->
return True
self._clear_dirty_transcript(session_id)
try:
self._db.replace_messages(session_id, messages)
# When the session has soft-archived rows (e.g. in-place compaction
# history), restrict the DELETE to active-only rows so the archived
# turns survive the rewrite. Without this guard, /retry (and any
# other caller of rewrite_transcript) silently destroys the
# durable pre-compaction history (#80216).
active_only = self._db.has_archived_messages(session_id)
self._db.replace_messages(session_id, messages, active_only=active_only)
return True
except Exception as e:
logger.debug("Failed to rewrite transcript in DB: %s", e)
Expand Down
Loading