From 3339255abed656d61e51e4ef5f301e98571d024b Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Tue, 22 Sep 2026 12:29:13 +0530 Subject: [PATCH] test: assert the newest record token directly in lean sampling test tests/agent/test_lean_single_aux_call.py:163 accepted either `` or a `content[-500:]` substring. The last slice is anchored to the newest record, so the fallback can never be what passes; assert `"" in out` outright and drop the now-unused `content`. Red when the tail anchor is defeated (end = len(records) - 1): 1 failed; green at head (gate 2c suggestion). --- tests/agent/test_lean_single_aux_call.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/agent/test_lean_single_aux_call.py b/tests/agent/test_lean_single_aux_call.py index 17a5bee1c1..02ec5d6553 100644 --- a/tests/agent/test_lean_single_aux_call.py +++ b/tests/agent/test_lean_single_aux_call.py @@ -152,7 +152,6 @@ class TestSampledSummaryInput: # Distinct decade markers let us verify oldest-to-newest order and # uniform coverage across the whole region. records = [f"" + ("x" * 50_000) for i in range(10)] - content = "\n\n".join(records) out, _coverage = ContextCompressor._sample_summary_records(records) assert len(out) <= ContextCompressor._SUMMARY_INPUT_MAX_CHARS assert "chars elided" in out @@ -160,7 +159,8 @@ class TestSampledSummaryInput: # Coverage reaches past the head AND includes the newest end. assert seen == sorted(seen) assert any(i >= 5 for i in seen) - assert ("" in out) or (content[-500:] in out) + # The newest record anchors the last slice, so its token must be present outright. + assert "" in out def test_legacy_mode_keeps_head_tail_bound(self): c = _mk_compressor(tail_mode="legacy")