diff --git a/tests/agent/test_context_compressor.py b/tests/agent/test_context_compressor.py index 42f6de0fd3..88a23b44cf 100644 --- a/tests/agent/test_context_compressor.py +++ b/tests/agent/test_context_compressor.py @@ -38,16 +38,6 @@ class TestShouldCompress: assert compressor.should_compress(prompt_tokens=50000) is False -class TestShouldCompressPreflight: - def test_short_messages(self, compressor): - msgs = [{"role": "user", "content": "short"}] - assert compressor.should_compress_preflight(msgs) is False - - def test_long_messages(self, compressor): - # Each message ~100k chars / 4 = 25k tokens, need >85k threshold - msgs = [{"role": "user", "content": "x" * 400000}] - assert compressor.should_compress_preflight(msgs) is True - class TestUpdateFromResponse: def test_updates_fields(self, compressor): @@ -58,27 +48,12 @@ class TestUpdateFromResponse: }) assert compressor.last_prompt_tokens == 5000 assert compressor.last_completion_tokens == 1000 - assert compressor.last_total_tokens == 6000 def test_missing_fields_default_zero(self, compressor): compressor.update_from_response({}) assert compressor.last_prompt_tokens == 0 -class TestGetStatus: - def test_returns_expected_keys(self, compressor): - status = compressor.get_status() - assert "last_prompt_tokens" in status - assert "threshold_tokens" in status - assert "context_length" in status - assert "usage_percent" in status - assert "compression_count" in status - - def test_usage_percent_calculation(self, compressor): - compressor.last_prompt_tokens = 50000 - status = compressor.get_status() - assert status["usage_percent"] == 50.0 - class TestCompress: def _make_messages(self, n): diff --git a/tests/cli/test_reasoning_command.py b/tests/cli/test_reasoning_command.py index 4270d630db..554cb6f96b 100644 --- a/tests/cli/test_reasoning_command.py +++ b/tests/cli/test_reasoning_command.py @@ -619,17 +619,14 @@ class TestReasoningDeltasFiredFlag(unittest.TestCase): agent = AIAgent.__new__(AIAgent) agent.reasoning_callback = None agent.stream_delta_callback = None - agent._reasoning_deltas_fired = False agent.verbose_logging = False return agent - def test_fire_reasoning_delta_sets_flag(self): + def test_fire_reasoning_delta_calls_callback(self): agent = self._make_agent() captured = [] agent.reasoning_callback = lambda t: captured.append(t) - self.assertFalse(agent._reasoning_deltas_fired) agent._fire_reasoning_delta("thinking...") - self.assertTrue(agent._reasoning_deltas_fired) self.assertEqual(captured, ["thinking..."]) def test_build_assistant_message_skips_callback_when_already_streamed(self): @@ -640,8 +637,7 @@ class TestReasoningDeltasFiredFlag(unittest.TestCase): agent.reasoning_callback = lambda t: captured.append(t) agent.stream_delta_callback = lambda t: None # streaming is active - # Simulate streaming having fired reasoning - agent._reasoning_deltas_fired = True + # Simulate streaming having already fired reasoning msg = SimpleNamespace( content="I'll merge that.", @@ -665,9 +661,8 @@ class TestReasoningDeltasFiredFlag(unittest.TestCase): agent.reasoning_callback = lambda t: captured.append(t) agent.stream_delta_callback = lambda t: None # streaming active - # Even though _reasoning_deltas_fired is False (reasoning came through - # content tags, not reasoning_content deltas), callback should not fire - agent._reasoning_deltas_fired = False + # Reasoning came through content tags, not reasoning_content deltas. + # Callback should not fire since streaming is active. msg = SimpleNamespace( content="I'll merge that.", @@ -689,7 +684,6 @@ class TestReasoningDeltasFiredFlag(unittest.TestCase): agent.reasoning_callback = lambda t: captured.append(t) # No streaming agent.stream_delta_callback = None - agent._reasoning_deltas_fired = False msg = SimpleNamespace( content="I'll merge that.",