The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test: adapt read mocks and fifo guard test to the sentinel probe
teknium1ea68bdda921a
diff --git a/tests/tools/test_file_operations.py b/tests/tools/test_file_operations.pyindex d23eeac5a6b..59746b7901d 100644--- a/tests/tools/test_file_operations.py+++ b/tests/tools/test_file_operations.py@@ -355,7 +355,7 @@ class TestShellFileOpsHelpers:)def side_effect(command, **kwargs):- if command.startswith("wc -c"):+ if command.startswith("if [ -f ") or command.startswith("wc -c"):return {"output": "12\n", "returncode": 0}if command.startswith("head -c"):return {"output": "print('ok')\n", "returncode": 0}@@ -383,7 +383,7 @@ class TestShellFileOpsHelpers:)def side_effect(command, **kwargs):- if command.startswith("wc -c"):+ if command.startswith("if [ -f ") or command.startswith("wc -c"):return {"output": "6\n", "returncode": 0}if command.startswith("head -c"):return {"output": "alpha\n", "returncode": 0}@@ -519,7 +519,7 @@ class TestPatchReplacePostWriteVerification:if command.startswith("mkdir "):return {"output": "", "returncode": 0}# wc -c for byte count after write- if command.startswith("wc -c"):+ if command.startswith("if [ -f ") or command.startswith("wc -c"):for path in file_contents:if path in command:return {"output": str(len(file_contents[path].encode())), "returncode": 0}@@ -556,7 +556,7 @@ class TestPatchReplacePostWriteVerification:return {"output": "", "returncode": 1}if command.startswith("mkdir "):return {"output": "", "returncode": 0}- if command.startswith("wc -c"):+ if command.startswith("if [ -f ") or command.startswith("wc -c"):return {"output": str(len(state["content"].encode())), "returncode": 0}return {"output": "", "returncode": 0}@@ -776,7 +776,7 @@ class TestByteLayerBinaryDetection:import base64 as b64def side_effect(command, **kwargs):- if command.startswith("wc -c"):+ if command.startswith("if [ -f ") or command.startswith("wc -c"):return {"output": f"{len(cjk_bytes)}\n", "returncode": 0}if command.startswith("head -c") and "| base64" in command:return {"output": b64.b64encode(cjk_bytes[:1000]).decode(), "returncode": 0}diff --git a/tests/tools/test_file_read_guards.py b/tests/tools/test_file_read_guards.pyindex 02a0f8e2a8c..1ee28f77892 100644--- a/tests/tools/test_file_read_guards.py+++ b/tests/tools/test_file_read_guards.py@@ -265,8 +265,12 @@ class TestNonRegularFileReads(unittest.TestCase):result = self._read_within_deadline(fifo_path, "fifo_read_test")- self.assertIn("error", result)- self.assertIn("not a regular file", result["error"])+ # The tool layer intercepts first with a success=False NOTE (a fact+ # about the file, not an error — merged stat-guard design); the+ # shell-layer sentinel behind it errors. Accept either surface.+ surface = result.get("error") or result.get("note") or ""+ self.assertTrue(surface, f"expected error or note, got: {result}")+ self.assertIn("not a regular file", surface)def test_read_file_tool_on_directory_errors_instead_of_blocking(self):with tempfile.TemporaryDirectory() as tmpdir: