The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(compression): update _pre_msg_count after durable adoption
kshitij8eaaa5021c09
diff --git a/agent/conversation_compression.py b/agent/conversation_compression.pyindex 09df0c66c4d..0f56f9a92c4 100644--- a/agent/conversation_compression.py+++ b/agent/conversation_compression.py@@ -1737,6 +1737,7 @@ def compress_context(len(durable_parent),)messages = durable_parent+ _pre_msg_count = len(messages)# Token estimate was for the stale snapshot; clear it so# the compressor re-derives from the adopted transcript# instead of under-counting the newly visible rows.diff --git a/contributors/emails/[email protected] b/contributors/emails/[email protected]new file mode 100644index 00000000000..c7510483c04--- /dev/null+++ b/contributors/emails/[email protected]@@ -0,0 +1 @@+kshitijk4poordiff --git a/tests/agent/test_compression_concurrent_fork.py b/tests/agent/test_compression_concurrent_fork.pyindex bc20dfcb7af..6e0360c5157 100644--- a/tests/agent/test_compression_concurrent_fork.py+++ b/tests/agent/test_compression_concurrent_fork.py@@ -377,9 +377,8 @@ def test_durable_message_committed_before_lease_is_adopted(assert returned is not stale_snapshotassert returned[0]["content"] == "[CONTEXT COMPACTION] summary"assert agent.session_id != parent_sid- child = db.find_live_compression_child(parent_sid)- assert child is not None- child_id = child["id"] if isinstance(child, dict) else child+ child_id = _live_child_id(db, parent_sid)+ assert child_id is not Noneassert child_id == agent.session_iddef test_skipped_compression_returns_messages_unchanged(tmp_path: Path) -> None: