Skip to content

The agent that grows with you

fix(browser): hide console window for npx cache warm-up on Windows

Zak B. Elepc196e0f08f62
diff --git a/tests/test_windows_subprocess_no_window_flags.py b/tests/test_windows_subprocess_no_window_flags.py
index 4855072cc32..060d17f0a23 100644
--- a/tests/test_windows_subprocess_no_window_flags.py
+++ b/tests/test_windows_subprocess_no_window_flags.py
@@ -189,13 +189,22 @@ def test_shell_hooks_hide_hook_command_windows(monkeypatch):
assert "process_group" not in captured[0][1]
+def test_agent_browser_npx_warmup_hides_npx_window(monkeypatch):
+ from tools import browser_tool
+ captured = []
+ def fake_run(cmd, **kwargs):
+ captured.append((cmd, kwargs))
+ return _Completed(stdout="1.2.3\n")
+ monkeypatch.setattr(browser_tool.shutil, "which", lambda name: "/usr/bin/npx")
+ monkeypatch.setattr(browser_tool, "windows_hide_flags", lambda: _CREATE_NO_WINDOW)
+ monkeypatch.setattr(browser_tool.subprocess, "run", fake_run)
-
-
-
+ assert browser_tool.warm_agent_browser_npx_cache() is True
+ assert captured[0][0][0] == "/usr/bin/npx"
+ assert captured[0][1]["creationflags"] == _CREATE_NO_WINDOW
diff --git a/tools/browser_tool.py b/tools/browser_tool.py
index b5afd3dba11..90c92ab2197 100644
--- a/tools/browser_tool.py
+++ b/tools/browser_tool.py
@@ -2519,6 +2519,7 @@ def warm_agent_browser_npx_cache(timeout: float = 60.0) -> bool:
text=True,
timeout=timeout,
check=False,
+ creationflags=windows_hide_flags(),
)
return result.returncode == 0
except Exception: