From 2e9559adf0583b174e67870872f8ed2ce6855032 Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Tue, 28 Jul 2026 19:25:45 +0500 Subject: [PATCH] test(compression): resolve context_length inside mock in overflow-warning fixture CI shard 4 caught 4 failures the local baseline diff missed (local env pollution made them look pre-existing): _make_compressor() constructs under a get_model_context_length mock but the lazy deferral (#32221) pushed resolution past the with block, so the 96K window / 75% floor the tests rely on never materialized. Resolve inside the mock. --- tests/agent/test_turn_context_overflow_warning.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/agent/test_turn_context_overflow_warning.py b/tests/agent/test_turn_context_overflow_warning.py index b63a6c8330cc6..c5b7722f2293a 100644 --- a/tests/agent/test_turn_context_overflow_warning.py +++ b/tests/agent/test_turn_context_overflow_warning.py @@ -34,7 +34,10 @@ def _make_compressor(**kwargs) -> ContextCompressor: # 96K context -> small-context floor raises threshold_percent to 0.75, # so threshold_tokens = 72_000. 73_000 is "over threshold". with patch("agent.context_compressor.get_model_context_length", return_value=96000): - return ContextCompressor(**defaults) + comp = ContextCompressor(**defaults) + # Resolve while the mock is active (lazy init, #32221). + _ = comp.context_length + return comp class TestShouldCompressInfo: