Squash Odysseus development history

This commit is contained in:
pewdiepie-archdaemon
2026-09-11 06:04:19 +00:00
parent e5c99a5eee
commit 6ee6502010
2050 changed files with 538359 additions and 57745 deletions
@@ -0,0 +1,25 @@
import asyncio
import json
import pytest
from src.agent_tools.web_tools import PrivateBrowserTool
@pytest.mark.parametrize("name", ["output.html", "source.svg", "report.pdf", "notes.txt"])
def test_screenshot_cannot_overwrite_nonimage_artifact(monkeypatch, tmp_path, name):
source = tmp_path / name
source.write_bytes(b"original artifact")
monkeypatch.setattr("src.tool_execution.get_active_workspace", lambda: str(tmp_path))
monkeypatch.setattr(PrivateBrowserTool, "_resolve_workspace_path", staticmethod(lambda value: source))
async def forbidden(*args, **kwargs):
raise AssertionError("browser must not launch with nonimage destination")
monkeypatch.setattr(asyncio, "create_subprocess_exec", forbidden)
result = asyncio.run(PrivateBrowserTool().execute(
json.dumps({"action": "screenshot", "path": "/workspace/" + name}),
{"session_id": "artifact-safety"},
))
assert result["exit_code"] == 1
assert "OUTPUT destination" in result["error"]
assert source.read_bytes() == b"original artifact"