Skip to content

The agent that grows with you

fix(browser): name a missing pinned browser.executable_path in the missing-Chromium hint

Teknium68c437a9044b
diff --git a/hermes_cli/browser_runtime.py b/hermes_cli/browser_runtime.py
index a2409b20200..4de9753015f 100644
--- a/hermes_cli/browser_runtime.py
+++ b/hermes_cli/browser_runtime.py
@@ -76,6 +76,9 @@ def chromium_missing_hint() -> str:
"""One actionable line for "no Chromium" on this machine. Never suggests npm."""
from hermes_platform.host.runtime import is_termux
+ if pinned := _configured_executable(): # the pin wins over every other source, so name it
+ return (f"browser.executable_path is set to {pinned}, which is not a browser on this machine: fix the "
+ "path, or clear it to use Hermes's Chromium.")
if is_termux():
return ("No Chromium found: pm builds none for Termux. Install one with "
"`pkg install x11-repo && pkg install chromium`, or set browser.executable_path.")
diff --git a/tests/tools/test_browser_pm.py b/tests/tools/test_browser_pm.py
index 453a0eecfd2..3a7ef0e0f98 100644
--- a/tests/tools/test_browser_pm.py
+++ b/tests/tools/test_browser_pm.py
@@ -136,6 +136,18 @@ def _pin_executable(path) -> None:
(get_hermes_home() / "config.yaml").write_text(json.dumps({"browser": {"executable_path": str(path)}}))
+def test_a_missing_pinned_browser_is_named_in_the_hint(browser_store, tmp_path):
+ """The pin wins over pm's Chromium, so "install chromium" cannot help: the hint names the pinned path."""
+ _, _, publish = browser_store
+ publish("chromium")
+ missing = tmp_path / "moved away" / "chrome"
+ _pin_executable(missing)
+ ok, hint = launcher.chromium_ready()
+ assert ok is False
+ assert "browser.executable_path" in hint and str(missing) in hint
+ assert "hermes pm install chromium" not in hint
+
+
def test_historical_warmer_is_inert(monkeypatch):
def forbidden(*args, **kwargs):
pytest.fail("historical browser warmer must do no work")