Skip to content

The agent that grows with you

test(sessions): keep the adoption invariant to one row-level test

kshitijk4poor0c64226d2094
diff --git a/tests/tui_gateway/test_stranded_session_adoption.py b/tests/tui_gateway/test_stranded_session_adoption.py
index a3d0367668b..edd38370f4b 100644
--- a/tests/tui_gateway/test_stranded_session_adoption.py
+++ b/tests/tui_gateway/test_stranded_session_adoption.py
@@ -422,39 +422,6 @@ def test_donor_growth_between_export_and_retire_blocks_retirement(stores, monkey
assert not default_db.get_session(STRANDED_ID)["archived"]
-def _resume_as_developer(mod, session_id):
- return mod.handle_request({"id": "20", "method": "session.resume",
- "params": {"session_id": session_id, "profile": "developer", "lazy": True}})
-
-
-def _shown(db, session_id, **flags):
- return [(m["role"], m["content"]) for m in db.get_messages(session_id, **flags)]
-
-
-def test_adoption_carries_compacted_history_before_retiring_the_donor(gateway):
- """The retired donor is unrecoverable, so the profile copy must show everything the donor
- showed (turns archived by in-place compaction included) and feed the model the same live
- context; a live-rows-only copy left those turns visible nowhere."""
- mod, default_db, profile_home = gateway
- _seed_stranded(default_db, turns=4)
- tail = default_db.get_messages(STRANDED_ID)[-2:]
- default_db.archive_and_compact(
- STRANDED_ID, [{"role": "user", "content": "[summary of turns 1-3]"}, *tail], tail_count=2)
- shown_before = _shown(default_db, STRANDED_ID, include_compacted=True)
- live_before = _shown(default_db, STRANDED_ID)
- assert len(shown_before) > len(live_before)
-
- resp = _resume_as_developer(mod, STRANDED_ID)
-
- assert not resp.get("error"), resp.get("error")
- pdb = SessionDB(db_path=profile_home / "state.db")
- try:
- assert _shown(pdb, STRANDED_ID, include_compacted=True) == shown_before
- assert _shown(pdb, STRANDED_ID) == live_before
- finally:
- pdb.close()
-
-
def _every_row(db, session_id):
return [(m["role"], m["content"], m["active"], m["compacted"], m.get("codex_reasoning_items"))
for m in db.get_messages(session_id, include_inactive=True)]