The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test: keep two invariant tests each for the salvaged flush and compaction-clone fixes
Teknium9fe7337661f4
diff --git a/tests/agent/test_flush_uid_reinsert_guard.py b/tests/agent/test_flush_uid_reinsert_guard.pyindex 34c69bcffb5..5b55d113fa8 100644--- a/tests/agent/test_flush_uid_reinsert_guard.py+++ b/tests/agent/test_flush_uid_reinsert_guard.py@@ -106,34 +106,6 @@ def test_restored_history_rows_are_not_reinserted(tmp_path):)-def test_new_messages_after_restore_still_persist(tmp_path):- """The guard must not over-match: after a restore, a genuinely new turn- (fresh uids) still lands durably."""- agent, db = _make_agent_with_db(tmp_path)- sid = agent.session_id-- turn_one = [{"role": "user", "content": "hello", "timestamp": 2000.0}]- agent._flush_messages_to_session_db(turn_one)- restored = db.get_messages_as_conversation(sid)-- new_turn = [- *restored,- {"role": "user", "content": "second turn", "timestamp": 3000.0},- {"role": "assistant", "content": "second reply", "timestamp": 3001.0},- ]- agent._flush_messages_to_session_db(new_turn, restored)-- rows = db._read_all(- "SELECT role, content FROM messages WHERE session_id = ? ORDER BY id", (sid,)- )- contents = [r["content"] for r in rows]- assert "second turn" in contents and "second reply" in contents, (- "new post-restore messages were dropped by the dedupe guard"- )- assert contents.count("hello") == 1, "restored row was re-inserted"- assert len(contents) == 3, f"expected exactly 3 rows, got {len(contents)}: {contents}"--def test_restored_snapshot_rewrite_still_lands(tmp_path):"""The reviewer's blocker (134799 review, 2026-10-07): a restored dict thatstill carries its ``_db_row_snapshot`` is the CAS repair path's client —diff --git a/tests/hermes_state/test_compaction_carried_tail_not_cloned.py b/tests/hermes_state/test_compaction_carried_tail_not_cloned.pyindex c2e4a34a7a7..ca5fa1bab9b 100644--- a/tests/hermes_state/test_compaction_carried_tail_not_cloned.py+++ b/tests/hermes_state/test_compaction_carried_tail_not_cloned.py@@ -81,18 +81,6 @@ class TestCarriedTailAboveWatermark:(row,) = _copies(db, f"old turn {i}")assert (row["active"], row["compacted"]) == (0, 1)- def test_content_only_carried_copy_is_not_cloned(self, db: SessionDB) -> None:- """A carried dict with no id, uid or timestamp still names the row by content."""- watermark = db.get_active_message_watermark(SID)- db.append_message(SID, role="assistant", content="verbatim carried body")-- db.archive_and_compact(- SID, [_summary(), {"role": "assistant", "content": "verbatim carried body"}], watermark=watermark)-- copies = _copies(db, "verbatim carried body")- assert len(copies) == 2- assert sorted(r["active"] for r in copies) == [0, 1]-def test_foreign_identical_row_above_watermark_is_still_cloned(self, db: SessionDB) -> None:"""A row another surface appended keeps its clone even when a held row below thewatermark carries the same text: the carried dict names its own row, not the newcomer."""