The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(compression): keep refusal-case ids next to their data
kshitijk4poor0f5021e010d6
diff --git a/tests/agent/test_context_compressor.py b/tests/agent/test_context_compressor.pyindex 6cd13b87204..a56da8d5913 100644--- a/tests/agent/test_context_compressor.py+++ b/tests/agent/test_context_compressor.py@@ -445,16 +445,21 @@ def _refusals():gate = approval._COMMAND_GATEreturn [- ("terminal", {"command": "rm -rf build"},- _error_json(gate.cli_denied.format(description="", breaker=""), status="blocked")),- ("terminal", {"command": "rm -rf build"},- _error_json(gate.transport_denied.format(breaker=""), status="blocked")),- ("terminal", {"command": "rm -rf build"},- _error_json(gate.cli_timeout.format(breaker=""), status="blocked")),- ("write_file", {"path": "AGENTS.md", "content": "a\nb"},- tool_error("BLOCKED: write to protected agent-instruction file(s) (AGENTS.md) was denied by "- "the user. The user has NOT consented to this write. Do NOT retry it or attempt "- "the same edit via another path (terminal, execute_code, etc.).")),+ pytest.param("terminal", {"command": "rm -rf build"},+ _error_json(gate.cli_denied.format(description="", breaker=""), status="blocked"),+ id="cli_denied"),+ pytest.param("terminal", {"command": "rm -rf build"},+ _error_json(gate.transport_denied.format(breaker=""), status="blocked"),+ id="transport_denied"),+ pytest.param("terminal", {"command": "rm -rf build"},+ _error_json(gate.cli_timeout.format(breaker=""), status="blocked"),+ id="cli_timeout"),+ pytest.param("write_file", {"path": "AGENTS.md", "content": "a\nb"},+ tool_error("BLOCKED: write to protected agent-instruction file(s) (AGENTS.md) was "+ "denied by the user. The user has NOT consented to this write. Do NOT "+ "retry it or attempt the same edit via another path (terminal, "+ "execute_code, etc.)."),+ id="write_guard"),]@@ -462,8 +467,7 @@ class TestSummarizeToolResultRefusals:"""A refused call must not be summarized as done ("ran ...", "wrote to ..."): that turns theuser's denial into a record of the action and drops the do-not-retry instruction."""- @pytest.mark.parametrize("tool_name,args,content", _refusals(),- ids=["cli_denied", "transport_denied", "cli_timeout", "write_guard"])+ @pytest.mark.parametrize("tool_name,args,content", _refusals())def test_denial_summary_keeps_not_run_and_no_consent(self, tool_name, args, content):summary = _summarize_tool_result(tool_name, json.dumps(args), content)@@ -472,7 +476,7 @@ class TestSummarizeToolResultRefusals:assert len(summary) <= _PRUNE_MIN_CHARS - 1def test_prune_keeps_denial_across_passes(self, compressor):- tool_name, args, content = _refusals()[0]+ tool_name, args, content = _refusals()[0].valuesassert len(content) > _PRUNE_MIN_CHARSmessages = [{"role": "assistant", "tool_calls": [{"id": "t1", "type": "function",