Skip to content

The agent that grows with you

test(compression): cover legacy clarify result shapes

Yuan Lia50078d2d3f5
diff --git a/tests/agent/test_context_compressor.py b/tests/agent/test_context_compressor.py
index aa724120384..8e28efad6f9 100644
--- a/tests/agent/test_context_compressor.py
+++ b/tests/agent/test_context_compressor.py
@@ -16,6 +16,7 @@ from agent.context_compressor import (
COMPRESSED_SUMMARY_METADATA_KEY,
_PRUNE_MIN_CHARS,
_summarize_tool_result,
+ _sum_clarify,
_is_summary_access_or_quota_error,
)
from agent.compression_marker import _COMPRESSION_MARKER_PREFIX
@@ -49,6 +50,20 @@ def compressor():
return c
+class TestLegacyClarifyResults:
+ def test_old_batch_shape_preserves_answers(self):
+ content = json.dumps({"responses": [{"question": "env", "user_response": "production"}]})
+ summary = _sum_clarify("clarify", {}, content, len(content), 1)
+ assert "production" in summary
+ assert summary.startswith("[clarify] user responded: ")
+
+ def test_old_top_level_shape_preserves_answer(self):
+ content = json.dumps({"question": "env", "user_response": "staging"})
+ summary = _sum_clarify("clarify", {}, content, len(content), 1)
+ assert "staging" in summary
+ assert summary.startswith("[clarify] user responded: ")
+
+
class TestSummarizeToolResultWebExtract:
"""Pre-compression pruning must survive web_extract calls whose ``urls`` are
web_search result dicts ({"url"/"href": ...}), which models routinely forward