Skip to content

A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.

fix(tools): keep Chrome's page content agent out of the console lines web_check parses

eyalgolan3a355eaeca9d
diff --git a/tools/tests/test_web_check_shots.py b/tools/tests/test_web_check_shots.py
index 2ec13baa1..01b6b56d5 100644
--- a/tools/tests/test_web_check_shots.py
+++ b/tools/tests/test_web_check_shots.py
@@ -124,3 +124,9 @@ def test_a_silent_browser_stalls_out_before_the_timeout(capsys):
code = wc.watch(queue.Queue(), lambda: None, lambda: None, ["PROFILE visual done"], wc.re.compile("FAIL"), 3600,
now=lambda: next(clock), sleep=lambda s: None, stall=120)
assert code == 1 and "STALLED" in capsys.readouterr().out
+
+
+def test_chrome_keeps_its_page_content_agent_quiet_so_it_cannot_split_a_console_line():
+ # Chrome 153's --v=1 log of ai_page_content_agent.cc ("GetAIPageContent SYNC MainFrame") was written into the middle of
+ # an 8000-character SHOT line on stderr, so that part failed to parse (Task 10: hero06judea 165-166 of 167, three runs).
+ assert "--vmodule=ai_page_content_agent=0" in wc.chrome_flags("/tmp/p", swiftshader=False)
diff --git a/tools/web_check.py b/tools/web_check.py
index bb82568e9..4041e2d90 100644
--- a/tools/web_check.py
+++ b/tools/web_check.py
@@ -176,7 +176,9 @@ def find_chrome() -> Path:
def chrome_flags(profile: str, swiftshader: bool, dpr: float = 1.0) -> list[str]:
"""Headless Chrome at the device pixel ratio (1 unless asked), frame rate uncapped (so frame times are not the
display's), never throttled, with a DevTools port for the viewport override."""
- flags = ["--headless=new", "--enable-logging=stderr", "--v=1", "--no-first-run", "--no-default-browser-check",
+ # --vmodule: Chrome's page content agent logs at --v=1 from another thread, and its line can land inside a long
+ # console line (a SHOT part) on stderr, which then fails to parse.
+ flags = ["--headless=new", "--enable-logging=stderr", "--v=1", "--vmodule=ai_page_content_agent=0", "--no-first-run", "--no-default-browser-check",
"--autoplay-policy=no-user-gesture-required", "--window-size=1920,1080", f"--force-device-scale-factor={dpr:g}",
"--disable-frame-rate-limit", "--disable-gpu-vsync", *KEEP_AWAKE, "--remote-debugging-port=0",
f"--user-data-dir={profile}"]