Skip to content

The agent that grows with you

test(compression): pin the status-only "blocked" refusal with the workdir guard

kshitijk4poor37a230525351
diff --git a/tests/agent/test_context_compressor.py b/tests/agent/test_context_compressor.py
index 7786e3357ee..974426e70f9 100644
--- a/tests/agent/test_context_compressor.py
+++ b/tests/agent/test_context_compressor.py
@@ -438,13 +438,15 @@ class TestSummarizeToolResultClarify:
def _refusals():
"""Refused-call results from the real producers: the approval gate messages in their terminal /
- tool_error envelopes, a pending gateway approval, and a successful kanban_block (``status``
+ tool_error envelopes, the workdir guard's ``status`` "blocked" envelope (its error reads
+ "Blocked:", not "BLOCKED"), a pending gateway approval, and a successful kanban_block (``status``
"blocked" with no error, which is not a refusal). ``expected`` lists substrings the summary must
contain; empty means it must not read as refused."""
from tools import approval
from tools.kanban_tools import _ok
from tools.registry import tool_error
from tools.terminal_tool import _error_json
+ from tools.terminal_tool_guards import _validate_workdir
gate = approval._COMMAND_GATE
no_consent = ["BLOCKED, not run", "did NOT consent"]
@@ -464,6 +466,9 @@ def _refusals():
"retry it or attempt the same edit via another path (terminal, "
"execute_code, etc.)."),
no_consent, id="write_guard"),
+ pytest.param("terminal", {"command": "ls"},
+ _error_json(_validate_workdir("a;b"), status="blocked"),
+ ["BLOCKED, not run"], id="workdir_guard"),
pytest.param("terminal", {"command": "rm -rf build"},
_error_json("", status="pending_approval"),
["awaiting the user's approval, not run"], id="pending_approval"),