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.
This commit is contained in:
yoniebans 2026-05-20 11:30:08 +02:00 committed by Teknium
parent 6f1a5f8597
commit b6c6f650ee
2 changed files with 26 additions and 1 deletions

View file

@ -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([]) == []

View file

@ -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"},