The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(browser): preserve image eval payload on Windows
KoNit-K1222172b2fad
diff --git a/tests/tools/test_browser_get_images_ssrf.py b/tests/tools/test_browser_get_images_ssrf.pyindex 8359d800358..7e05dd8f016 100644--- a/tests/tools/test_browser_get_images_ssrf.py+++ b/tests/tools/test_browser_get_images_ssrf.py@@ -83,3 +83,27 @@ def test_guard_does_not_block_on_failed_eval(monkeypatch):result = json.loads(browser_tool.browser_get_images(task_id="test"))assert result["success"] is Falseassert "eval failed" in result["error"]+++def test_get_images_sends_single_line_eval_and_parses_images(monkeypatch):+ """Regression for #113838: Windows CLI transport must receive one eval argument."""+ captured = {}++ def _run(task_id, command, args=None, **kwargs):+ captured["task_id"] = task_id+ captured["command"] = command+ captured["args"] = args+ return {"success": True, "data": {"result": IMAGES_JS_RESULT}}++ monkeypatch.setattr(bt_session, "_run_browser_command", _run)+ monkeypatch.setattr(bt_eval_policy, "_eval_ssrf_guard_active", lambda tid: False)++ result = json.loads(browser_tool.browser_get_images(task_id="test"))++ assert captured["command"] == "eval"+ assert "\n" not in captured["args"][0]+ assert result == {+ "success": True,+ "images": json.loads(IMAGES_JS_RESULT),+ "count": 1,+ }diff --git a/tools/browser_tool.py b/tools/browser_tool.pyindex 16c40486001..8badf1d9274 100644--- a/tools/browser_tool.py+++ b/tools/browser_tool.py@@ -1158,11 +1158,7 @@ def _maybe_stop_recording(task_id: str):_recording_sessions.discard(task_id)-_GET_IMAGES_JS = """JSON.stringify(- [...document.images].map(img => ({- src: img.src, alt: img.alt || '', width: img.naturalWidth, height: img.naturalHeight- })).filter(img => img.src && !img.src.startsWith('data:'))- )"""+_GET_IMAGES_JS = "JSON.stringify([...document.images].map(img => ({src: img.src, alt: img.alt || '', width: img.naturalWidth, height: img.naturalHeight})).filter(img => img.src && !img.src.startsWith('data:')))"def browser_get_images(task_id: Optional[str] = None) -> str: