The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(browser): drop agent_browser_runnable and the agent-browser resolution allowlist rows
Teknium4ad6e4eaec88
diff --git a/hermes_constants.py b/hermes_constants.pyindex f9897c96cc4..7c00d84a32c 100644--- a/hermes_constants.py+++ b/hermes_constants.py@@ -614,22 +614,6 @@ def with_hermes_node_path(env: dict[str, str] | None = None) -> dict[str, str]:return env_for("npm", base_env=env)-def agent_browser_runnable(path: str | None) -> bool:- """True when *path* is an agent-browser CLI that runs (``--version`` exits 0).-- Dead/wrong-arch/hung binaries are rejected so callers try the next candidate.-- A bare presence check (``shutil.which`` / ``Path.exists``) is not enough: agent-browser's npm- ``postinstall`` re-points a *global* install symlink (e.g. ``/opt/homebrew/bin/agent-browser``) at our- local ``node_modules/agent-browser/bin/...`` binary, which then disappears on the next ``hermes update``- — leaving a **dangling symlink** that ``which`` still reports but exec fails on with exit 127 (issue- #48521). Callers that trust such a path silently break every browser tool.- """- if not path:- return False- return _is_executable_file(path) and _version_probe_ok(path)--def _legacy_path_has_content(path: Path) -> bool:"""True iff *path* is a non-directory file or a populated directory.diff --git a/tests/fixtures/resolution_allowlist.json b/tests/fixtures/resolution_allowlist.jsonindex 0fce8d5a0fe..b38155aa122 100644--- a/tests/fixtures/resolution_allowlist.json+++ b/tests/fixtures/resolution_allowlist.json@@ -448,16 +448,6 @@"symbol": "find_lightpanda_binary","kind": "bare_which"},- {- "path": "tools/browser_tool_install.py",- "symbol": "_chromium_installed",- "kind": "bare_which"- },- {- "path": "tools/browser_tool_install.py",- "symbol": "_find_agent_browser",- "kind": "bare_which"- },{"path": "tools/checkpoint_manager.py","symbol": "_init_store",diff --git a/tests/test_hermes_constants.py b/tests/test_hermes_constants.pyindex a8a46c8035d..a213fba9e2c 100644--- a/tests/test_hermes_constants.py+++ b/tests/test_hermes_constants.py@@ -10,7 +10,6 @@ import pytestimport hermes_constantsfrom hermes_platform.host import runtime as host_runtimefrom hermes_constants import (- agent_browser_runnable,get_default_hermes_root,get_hermes_dir,get_hermes_home,@@ -505,40 +504,6 @@ class TestSecureParentDir:assert called_with[0] == (str(real_dir), 0o700)[email protected]("posix") # POSIX shell stubs; Windows uses .cmd shims-class TestAgentBrowserRunnable:- """agent_browser_runnable() validates the resolved CLI actually runs.-- Regression coverage for issue #48521: a dangling global symlink left by- agent-browser's npm postinstall is reported by ``which`` but fails at exec- with exit 127, silently breaking every browser tool. The validator must- reject it (and other non-runnable candidates) so callers fall through.- """-- def _stub(self, tmp_path, name, body, mode=0o755):- p = tmp_path / name- p.write_text(body)- p.chmod(mode)- return p-- def test_none_and_empty_rejected(self):- assert agent_browser_runnable(None) is False- assert agent_browser_runnable("") is False-- def test_dangling_symlink_rejected(self, tmp_path):- link = tmp_path / "agent-browser"- link.symlink_to(tmp_path / "does-not-exist")- # exists() follows the link → False, so it's rejected without exec.- assert agent_browser_runnable(str(link)) is False---------class TestGetHermesDir:"""Tests for ``get_hermes_dir(new_subpath, old_name)``.