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: 6 additions & 2 deletions gateway/slash_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -2494,8 +2494,12 @@ async def _handle_compress_command(self, event: MessageEvent) -> str:
self._sync_telegram_topic_binding(
source, session_entry, reason="compress-command",
)

self.session_store.rewrite_transcript(new_session_id, compressed)
# Only rewrite transcript when rotation actually happened.
# When _session_db is None or rotation failed, no new session
# was created — calling rewrite_transcript() would unconditionally
# overwrite the original session with compressed content, destroying
# the full conversation history (#44794).
self.session_store.rewrite_transcript(new_session_id, compressed)
# Reset stored token count — transcript changed, old value is stale
self.session_store.update_session(
session_entry.session_key, last_prompt_tokens=0
Expand Down
Loading