diff --git a/run_agent.py b/run_agent.py index 99fb5a1563a..0f85bf690f0 100644 --- a/run_agent.py +++ b/run_agent.py @@ -168,7 +168,6 @@ from agent.tool_result_classification import ( file_mutation_result_landed, ) from agent.trajectory import ( - convert_scratchpad_to_think, has_incomplete_scratchpad, save_trajectory as _save_trajectory_to_file, ) from agent.message_sanitization import ( @@ -1505,16 +1504,6 @@ class AIAgent: from agent.agent_runtime_helpers import dump_api_request_debug return dump_api_request_debug(self, api_kwargs, reason=reason, error=error) - @staticmethod - def _clean_session_content(content: str) -> str: - """Convert REASONING_SCRATCHPAD to think tags and clean up whitespace.""" - if not content: - return content - content = convert_scratchpad_to_think(content) - content = re.sub(r'\n+()', r'\n\1', content) - content = re.sub(r'()\n+', r'\1\n', content) - return content.strip() - def interrupt(self, message: str = None) -> None: """ diff --git a/tests/run_agent/test_run_agent.py b/tests/run_agent/test_run_agent.py index 9cdf16feb2e..83a1cb3044c 100644 --- a/tests/run_agent/test_run_agent.py +++ b/tests/run_agent/test_run_agent.py @@ -554,25 +554,6 @@ class TestExtractReasoning: assert result == "from structured field" -class TestCleanSessionContent: - def test_none_passthrough(self): - assert AIAgent._clean_session_content(None) is None - - def test_scratchpad_converted(self): - text = "think answer" - result = AIAgent._clean_session_content(text) - assert "" not in result - assert "" in result - - def test_extra_newlines_cleaned(self): - text = "\n\n\nx\n\n\nafter" - result = AIAgent._clean_session_content(text) - # Should not have excessive newlines around think block - assert "\n\n\n" not in result - # Content after think block must be preserved - assert "after" in result - - class TestGetMessagesUpToLastAssistant: def test_empty_list(self, agent): assert agent._get_messages_up_to_last_assistant([]) == []