From b6c6f650eebc05e7fbb14dfa1930df6d9d8731c7 Mon Sep 17 00:00:00 2001 From: yoniebans Date: Wed, 20 May 2026 11:30:08 +0200 Subject: [PATCH] test(session-log): pin no-session_json regression + drop trailing whitespace Adds TestNoSessionJsonSnapshot to lock the contract that session_log_file attribute, _save_session_log method, and the per-session JSON snapshot writer are gone. logs_dir is retained for request_dump_*.json. Also cleans up stray trailing whitespace in test_run_agent_codex_responses introduced when the _save_session_log stub line was deleted. --- tests/run_agent/test_run_agent.py | 25 +++++++++++++++++++ .../test_run_agent_codex_responses.py | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/tests/run_agent/test_run_agent.py b/tests/run_agent/test_run_agent.py index 83a1cb3044c..f3ea9f4f59c 100644 --- a/tests/run_agent/test_run_agent.py +++ b/tests/run_agent/test_run_agent.py @@ -554,6 +554,31 @@ class TestExtractReasoning: assert result == "from structured field" +class TestNoSessionJsonSnapshot: + """Regression: agent must not write session_{sid}.json snapshots. + + state.db is the canonical message store after #29182. The legacy snapshot + writer was removed; this test pins that contract so a future refactor + can't silently reintroduce the file (and the ~500MB/950-file disk usage + that came with it). + """ + + def test_session_log_file_attribute_not_set(self, agent): + assert not hasattr(agent, "session_log_file"), ( + "session_log_file attribute removed in #29182 — state.db is canonical" + ) + + def test_no_session_log_writer_method(self, agent): + assert not hasattr(agent, "_save_session_log"), ( + "_save_session_log method removed in #29182" + ) + + def test_logs_dir_retained_for_request_dumps(self, agent): + # logs_dir is kept because agent_runtime_helpers.dump_api_request_debug + # still writes request_dump_*.json there (debug breadcrumb path). + assert hasattr(agent, "logs_dir") + + class TestGetMessagesUpToLastAssistant: def test_empty_list(self, agent): assert agent._get_messages_up_to_last_assistant([]) == [] diff --git a/tests/run_agent/test_run_agent_codex_responses.py b/tests/run_agent/test_run_agent_codex_responses.py index 163dbd0033b..42948e1c41e 100644 --- a/tests/run_agent/test_run_agent_codex_responses.py +++ b/tests/run_agent/test_run_agent_codex_responses.py @@ -362,7 +362,7 @@ def test_build_api_kwargs_codex_preserves_supported_efforts(monkeypatch): agent._cleanup_task_resources = lambda task_id: None agent._persist_session = lambda messages, history=None: None agent._save_trajectory = lambda messages, user_message, completed: None - + kwargs = agent._build_api_kwargs( [ {"role": "system", "content": "sys"},