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: