Treat grep no matches as nonfatal

This commit is contained in:
2026-05-11 00:27:44 +08:00
parent fcee065231
commit 717e931a5e
4 changed files with 31 additions and 7 deletions
+17
View File
@@ -112,6 +112,23 @@ def test_shell_exec_allows_safe_command(tmp_path: Path) -> None:
assert str(tmp_path) in result["result"]["output"]
def test_shell_exec_treats_grep_no_matches_as_information(tmp_path: Path) -> None:
_write_config_tree(tmp_path)
controller = RuntimeController(base_dir=tmp_path)
result = controller.handle_task(
UserTask(
input="run grep with no matches",
context={
"requested_tool": "shell_exec",
"tool_args": {"command": "printf 'abc\\n' | grep definitely_missing"},
},
)
)
assert result["status"] == "completed"
assert result["result"]["metadata"]["exit_code"] == 1
assert result["result"]["metadata"]["no_matches"] is True
def test_permission_resolution_can_resume_task(tmp_path: Path) -> None:
_write_config_tree(tmp_path)
controller = RuntimeController(base_dir=tmp_path)