The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(tui_gateway): the resume guard fail-open proof is the history read, not the reopen (#85303)
Brooklyn Nicholson11439b6bb31b
diff --git a/tests/tui_gateway/test_protocol.py b/tests/tui_gateway/test_protocol.pyindex ef443041537..7ddaa246b09 100644--- a/tests/tui_gateway/test_protocol.py+++ b/tests/tui_gateway/test_protocol.py@@ -939,7 +939,7 @@ def test_deferred_hydration_falls_back_to_tip_when_lineage_exceeds_limit(server,def test_session_resume_guard_failure_fails_open(server, monkeypatch):"""A transient guard error must not block resume (fail open, log only)."""- reopened = []+ reads = []class _DB:def get_session(self, sid):@@ -954,9 +954,17 @@ def test_session_resume_guard_failure_fails_open(server, monkeypatch):def assert_resume_safe(self, _sid):raise RuntimeError("database is locked")- def reopen_session(self, sid):- reopened.append(sid)- return True+ def get_messages_as_conversation(self, _sid, **_kwargs):+ reads.append("tip")+ return []++ def get_resume_conversations(self, _sid):+ reads.append("lineage")+ return ([], [])++ def get_ancestor_display_prefix(self, _sid):+ reads.append("prefix")+ return []monkeypatch.setattr(server, "_get_db", lambda: _DB())@@ -971,11 +979,13 @@ def test_session_resume_guard_failure_fails_open(server, monkeypatch):})- # The guard must not block: no 4130. Reopen being attempted proves- # execution moved past the guard.+ # The guard must not block: no 4130, and execution moved PAST the guard to the+ # history read (omit_messages reads the tip segment). (#85303 made the mount+ # read-only — resume no longer reopens the row, so the history read is what+ # proves the guard was survived.)err = response.get("error") or {}assert err.get("code") != 4130- assert reopened == ["transient-guard-session"]+ assert "tip" in reads, "history read must have run"def test_session_resume_active_turn_payload_matches_desktop_fixture(server, monkeypatch):