Skip to content

The agent that grows with you

test(compression): resolve context_length inside mock in overflow-warning fixture

kshitijk4poor2e9559adf058
diff --git a/tests/agent/test_turn_context_overflow_warning.py b/tests/agent/test_turn_context_overflow_warning.py
index b63a6c8330c..c5b7722f229 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: