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

PR #98628 removed _build_chunk_digests, so the two lean chunk-digest
cancellation tests reintroduced by the #97512 cherry-pick target a
deleted mechanism — removed. The #96775 stall-interrupt assertions now
match the stall_interrupted marker inside the strategy/kind-stamped
durable error instead of assuming it is the prefix.
This commit is contained in:
Teknium
2026-08-30 18:25:29 -07:00
parent ad925a08da
commit ed3562bbbc
2 changed files with 3 additions and 57 deletions

View File

@@ -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(

View File

@@ -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."""