fix: require executable source for Work reports

This commit is contained in:
wuyang
2026-07-26 16:35:58 +08:00
parent 87689931b5
commit 5c9f827357
2 changed files with 30 additions and 0 deletions
+9
View File
@@ -10,6 +10,7 @@ from agent_platform.models import get_model_spec
from agent_platform.runtime.loop import (
AgentLoop,
is_substantive_execution,
non_source_execution_error,
normalize_write_file_content,
python_source_error,
select_tool_specs,
@@ -59,6 +60,14 @@ def test_invalid_complete_python_source_is_detected_before_write() -> None:
assert python_source_error({"path": "benchmark.py", "content": "print('ok')\n"}) is None
def test_python_cannot_execute_documentation_or_data_files() -> None:
assert non_source_execution_error({"command": "python3 SortingReport.md"}) is not None
assert non_source_execution_error({"command": "cd /workspace && python report.json"}) is not None
assert non_source_execution_error({"command": "python3 benchmark.py"}) is None
assert non_source_execution_error({"command": "python3 -m pytest"}) is None
assert non_source_execution_error({"command": "python3 -c 'print(1)' "}) is None
def test_read_only_shell_commands_do_not_satisfy_execution_evidence() -> None:
assert not is_substantive_execution("exec", {"command": "cat report.txt"})
assert not is_substantive_execution("exec", {"command": "sed -n '1,20p' script.py"})