diff --git a/tests/run_agent/test_compression_boundary_hook.py b/tests/run_agent/test_compression_boundary_hook.py index 26bac74163b..ef06e97e369 100644 --- a/tests/run_agent/test_compression_boundary_hook.py +++ b/tests/run_agent/test_compression_boundary_hook.py @@ -52,6 +52,11 @@ class TestCompressionBoundaryHook: compressor.last_completion_tokens = 0 # Avoid the summary-error warning path compressor._last_summary_error = None + # MagicMock auto-creates truthy attrs; explicitly clear the abort + # flag so the post-compress abort branch in + # conversation_compression.py does not short-circuit before the + # session-id rotation we are asserting on. + compressor._last_compress_aborted = False agent.context_compressor = compressor original_sid = agent.session_id @@ -137,6 +142,7 @@ class TestCompressionBoundaryHook: compressor.last_prompt_tokens = 0 compressor.last_completion_tokens = 0 compressor._last_summary_error = None + compressor._last_compress_aborted = False # Raise only on the compression-boundary call, not on earlier calls. def _raise_on_compression(*args, **kwargs): diff --git a/tests/test_cli_manual_compress.py b/tests/test_cli_manual_compress.py index 26b966ab6b7..c12bf1a227e 100644 --- a/tests/test_cli_manual_compress.py +++ b/tests/test_cli_manual_compress.py @@ -10,13 +10,14 @@ class DummyAgent: self.session_id = "new-session" self.calls = [] - def _compress_context(self, messages, system_message, *, approx_tokens=None, focus_topic=None): + def _compress_context(self, messages, system_message, *, approx_tokens=None, focus_topic=None, force=False): self.calls.append( { "messages": messages, "system_message": system_message, "approx_tokens": approx_tokens, "focus_topic": focus_topic, + "force": force, } ) return ([{"role": "user", "content": "[CONTEXT SUMMARY]: compacted"}], "new system prompt")