The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
docs(gateway): say rotation persists the child, not always rewrites it
kshitijk4poor3a056db7b1bb
diff --git a/gateway/run_turn.py b/gateway/run_turn.pyindex 28504ea99ec..799679ae9e6 100644--- a/gateway/run_turn.py+++ b/gateway/run_turn.py@@ -1106,7 +1106,7 @@ class GatewayTurnMixin:)_hyg_rotated = False_compressed = history- # Only rewrite the transcript when rotation produced a NEW session id. In-place compaction does NOT+ # Only persist a child transcript when rotation produced a NEW session id. In-place compaction does NOT# need a rewrite: archive_and_compact() has already soft-archived the previous active rows and# inserted the compacted messages as the new active set inside _compress_context(). Calling# rewrite_transcript() after in-place compaction would invoke replace_messages(active_only=False)@@ -1142,7 +1142,7 @@ class GatewayTurnMixin:)if _hyg_rotated or _hyg_in_place:- # Rewritten (rotation) or persisted by archive_and_compact() (in-place): reset token count.+ # Persisted (rotation) or persisted by archive_and_compact() (in-place): reset token count.session_entry.last_prompt_tokens = 0attempt.history = _compressed_new_count = len(_compressed)diff --git a/gateway/slash_commands_session.py b/gateway/slash_commands_session.pyindex 8fe6c23e9e3..f1c54312edd 100644--- a/gateway/slash_commands_session.py+++ b/gateway/slash_commands_session.py@@ -621,7 +621,7 @@ class GatewaySessionCommandsMixin:async def _persist_manual_compression(self, tmp_agent, session_entry, source, compressed) -> None:"""Commit a manual /compress result to the session store. Rotation (new continuation id)- writes the compressed messages into the NEW session so the original stays searchable;+ makes the NEW session durable (already published, else rewritten) so the original stays searchable;persist BEFORE repointing so a failed write is fatal and old history stays reachable.In-place compaction already archived + inserted rows, and a rewrite would DELETE thearchive; an unchanged id without in-place means rotation FAILED."""