Skip to content

The agent that grows with you

test(compression): drop moot digest-loop tests; match stamped backoff errors

Tekniumed3562bbbcd8
diff --git a/tests/agent/test_compression_stall_interrupt_96775.py b/tests/agent/test_compression_stall_interrupt_96775.py
index 2f29535ae32..efbba7d853e 100644
--- a/tests/agent/test_compression_stall_interrupt_96775.py
+++ b/tests/agent/test_compression_stall_interrupt_96775.py
@@ -171,7 +171,7 @@ class TestStallInterruptedBackoff:
assert db.get_compression_lock_holder("STALL_AUX_CANCEL") is None
state = db.get_compression_failure_cooldown("STALL_AUX_CANCEL")
assert state is not None
- assert str(state["error"]).startswith(STALL_INTERRUPTED_FAILURE_CLASS)
+ assert STALL_INTERRUPTED_FAILURE_CLASS in str(state["error"])
assert "msgs=20" in str(state["error"])
assert agent.context_compressor.should_compress(50_000) is False
@@ -222,7 +222,7 @@ class TestStallInterruptedBackoff:
assert live == original
state = db.get_compression_failure_cooldown("STALL_FENCE_CANCEL")
assert state is not None
- assert str(state["error"]).startswith(STALL_INTERRUPTED_FAILURE_CLASS)
+ assert STALL_INTERRUPTED_FAILURE_CLASS in str(state["error"])
assert agent.context_compressor.should_compress(50_000) is False
db.append_message("STALL_FENCE_CANCEL", "user", "next turn")
@@ -339,7 +339,7 @@ class TestStallInterruptedBackoff:
after = db.get_compression_failure_cooldown("MERGE_MAX_STALL")
assert after is not None
assert float(after["cooldown_until"]) >= prior_until - 1.0
- assert str(after["error"]).startswith(STALL_INTERRUPTED_FAILURE_CLASS)
+ assert STALL_INTERRUPTED_FAILURE_CLASS in str(after["error"])
def test_session_db_cooldown_write_does_not_shorten_longer_deadline(
diff --git a/tests/agent/test_context_compressor.py b/tests/agent/test_context_compressor.py
index 513819ef0ca..ca997993618 100644
--- a/tests/agent/test_context_compressor.py
+++ b/tests/agent/test_context_compressor.py
@@ -26,60 +26,6 @@ class StubProviderError(Exception):
self.response = response
-def test_lean_chunk_digests_stop_after_host_cancellation(compressor, monkeypatch):
- """A cancelled total-deadline candidate must not dispatch another digest."""
- import agent.context_compressor as context_compressor_module
-
- cancelled = False
- calls = 0
-
- def fake_call_llm(**_kwargs):
- nonlocal cancelled, calls
- calls += 1
- cancelled = True
- return SimpleNamespace(
- choices=[SimpleNamespace(message=SimpleNamespace(content="digest"))]
- )
-
- monkeypatch.setattr(context_compressor_module, "_LEAN_DIGEST_CHUNK_CHARS", 20)
- monkeypatch.setattr(context_compressor_module, "_LEAN_DIGEST_MAX_CHUNKS", 8)
- monkeypatch.setattr("agent.auxiliary_client.call_llm", fake_call_llm)
- compressor._compression_cancelled_check = lambda: cancelled
-
- result = compressor._build_chunk_digests(
- [{"role": "tool", "content": "x" * 200, "tool_call_id": "call-1"}]
- )
-
- assert calls == 1
- assert "Segment 2/" not in result
-
-
-def test_lean_chunk_digests_do_not_start_after_deadline(compressor, monkeypatch):
- """The shared compaction deadline is checked before the first digest."""
- import agent.context_compressor as context_compressor_module
- from agent.conversation_compression import CompressionCommitFence
-
- calls = 0
-
- def fake_call_llm(**_kwargs):
- nonlocal calls
- calls += 1
- raise AssertionError("digest request started after total deadline")
-
- fence = CompressionCommitFence(total_ceiling_seconds=1.0)
- compressor._compression_cancelled_check = lambda: fence.is_cancelled
- monkeypatch.setattr("agent.auxiliary_client.call_llm", fake_call_llm)
-
- with patch(
- "agent.conversation_compression.time.monotonic",
- return_value=time.monotonic() + 2.0,
- ):
- assert compressor._build_chunk_digests(
- [{"role": "user", "content": "late digest"}]
- ) == ""
- assert calls == 0
-
-
@pytest.fixture()
def compressor():
"""Create a ContextCompressor with mocked dependencies."""