The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(agent): execution guidance and browser hints drop the web_search stripper; tests assert the invariant
teknium1ac63d0eea5ce
diff --git a/agent/prompt_builder.py b/agent/prompt_builder.pyindex 69003377d6a..4a1be632308 100644--- a/agent/prompt_builder.py+++ b/agent/prompt_builder.py@@ -469,13 +469,10 @@ OPENAI_MODEL_EXECUTION_GUIDANCE = (def execution_guidance_text(valid_tool_names=None) -> str:"""OPENAI_MODEL_EXECUTION_GUIDANCE for the session's toolset (cache-safe: the toolset is fixed per session).- Without web tools (e.g. Blank Slate) the ``web_search`` mentions would dangle, so they are dropped/adjusted.+ The guidance names no web tool (#39797: a hard "use web_search" overrode SOUL.md and dangled in Blank Slate),+ so the text is the same for every toolset; the seam stays so a future toolset-dependent line has a home."""- text = OPENAI_MODEL_EXECUTION_GUIDANCE- if valid_tool_names is not None and "web_search" not in valid_tool_names:- text = text.replace("- Current facts (weather, news, versions) → use web_search\n", "")- text = text.replace("(search_files, web_search, read_file, etc.)", "(search_files, read_file, etc.)")- return text+ return OPENAI_MODEL_EXECUTION_GUIDANCE# Gemini/Gemma-specific operational guidance, adapted from OpenCode's gemini.txt.diff --git a/tests/agent/test_phantom_tool_references.py b/tests/agent/test_phantom_tool_references.pyindex 599f42c2b92..6e5a5530520 100644--- a/tests/agent/test_phantom_tool_references.py+++ b/tests/agent/test_phantom_tool_references.py@@ -4,7 +4,7 @@ session can't call (Blank Slate audit, Aug 2026).Covers:* HERMES_AGENT_HELP_GUIDANCE degrades to the docs-only variant when theskill tools aren't loaded.- * execution_guidance_text() drops web_search lines when web tools are off.+ * execution_guidance_text() never names a web tool (guidance is toolset-neutral).* The coding operating brief drops the `todo` sentence when the todo toolisn't loaded.* ESSENTIAL_SKILLS can't be disabled via config, and the CLI writer strips@@ -42,14 +42,13 @@ class TestExecutionGuidanceText:)assert execution_guidance_text(None) == OPENAI_MODEL_EXECUTION_GUIDANCE- def test_web_search_dropped_without_web_tools(self):+ def test_no_web_tool_named_without_web_tools(self):from agent.prompt_builder import execution_guidance_texttext = execution_guidance_text({"terminal", "read_file"})- assert "web_search" not in text+ assert "web_search" not in text and "web_extract" not in text# The surrounding structure survives.assert "<mandatory_tool_use>" in textassert "<missing_context>" in text- assert "(search_files, read_file, etc.)" in textclass TestCodingBriefTodoGating:diff --git a/tests/agent/test_prompt_builder.py b/tests/agent/test_prompt_builder.pyindex 69d052ef639..935ab50295c 100644--- a/tests/agent/test_prompt_builder.py+++ b/tests/agent/test_prompt_builder.py@@ -1093,8 +1093,9 @@ class TestOpenAIModelExecutionGuidance:def test_guidance_does_not_mandate_specific_web_tool(self):- assert "→ use web_search" not in OPENAI_MODEL_EXECUTION_GUIDANCE- assert "appropriate permitted retrieval/search tool" in OPENAI_MODEL_EXECUTION_GUIDANCE+ # #39797: naming web_search here overrode SOUL.md and dangled when the web toolset was off.+ assert "web_search" not in OPENAI_MODEL_EXECUTION_GUIDANCE+ assert "web_extract" not in OPENAI_MODEL_EXECUTION_GUIDANCEdef test_guidance_is_string(self):assert isinstance(OPENAI_MODEL_EXECUTION_GUIDANCE, str)diff --git a/tests/tools/test_browser_cdp_tool.py b/tests/tools/test_browser_cdp_tool.pyindex d67307568e1..94fa1ea2b0a 100644--- a/tests/tools/test_browser_cdp_tool.py+++ b/tests/tools/test_browser_cdp_tool.py@@ -467,33 +467,11 @@ def test_nested_unflagged_binary_path_passes_through(cdp_server):# ----------------------------------------------------------------------------def test_registered_in_browser_toolset():- from tools.registry import registry-- entry = registry.get_entry("browser_cdp")- assert entry is not None- # browser_cdp lives in its own toolset so its stricter check_fn- # (requires reachable CDP endpoint) doesn't gate the whole browser- # toolset — see commit 96b0f3700.- assert entry.toolset == "browser-cdp"- assert entry.schema["name"] == "browser_cdp"- assert entry.schema["parameters"]["required"] == ["method"]- assert "Chrome DevTools Protocol" in entry.schema["description"]- assert browser_cdp_tool.CDP_DOCS_URL in entry.schema["description"]- assert "web_extract" not in entry.schema["description"]- assert "available documentation lookup or extraction tool" in entry.schema["description"]---def test_dispatch_through_registry(cdp_server):- from tools.registry import registry-- cdp_server.on("Target.getTargets", lambda p, s: {"targetInfos": []})- raw = registry.dispatch(- "browser_cdp", {"method": "Target.getTargets"}, task_id="t1"- )- result = json.loads(raw)- assert result["success"] is True- assert result["method"] == "Target.getTargets"+def test_schema_description_is_toolset_neutral():+ """#39797: the static schema must not name web_extract — model_tools adds it only when the session has it."""+ desc = browser_cdp_tool.BROWSER_CDP_SCHEMA["description"]+ assert browser_cdp_tool.CDP_DOCS_URL in desc+ assert "web_extract" not in desc# ---------------------------------------------------------------------------diff --git a/tests/tools/test_browser_hardening.py b/tests/tools/test_browser_hardening.pyindex 6b168a31981..0c68118677f 100644--- a/tests/tools/test_browser_hardening.py+++ b/tests/tools/test_browser_hardening.py@@ -59,7 +59,6 @@ class TestBrowserNavigateSchemaToolReferences:assert "web_search" not in descriptionassert "web_extract" not in description- assert "lightweight retrieval tool" in description# ---------------------------------------------------------------------------diff --git a/website/docs/reference/tools-reference.md b/website/docs/reference/tools-reference.mdindex b7bdb69c284..2ab7502fff5 100644--- a/website/docs/reference/tools-reference.md+++ b/website/docs/reference/tools-reference.md@@ -22,7 +22,7 @@ In addition to built-in tools, Hermes can load tools dynamically from MCP server| `browser_click` | Click on an element identified by its ref ID from the snapshot (e.g., '@e5'). The ref IDs are shown in square brackets in the snapshot output. Requires browser_navigate and browser_snapshot to be called first. | — || `browser_console` | Get browser console output and JavaScript errors from the current page. Returns console.log/warn/error/info messages and uncaught JS exceptions. Use this to detect silent JavaScript errors, failed API calls, and application warnings. Requi… | — || `browser_get_images` | Get a list of all images on the current page with their URLs and alt text. Useful for finding images to analyze with the vision tool. Requires browser_navigate to be called first. | — |-| `browser_navigate` | Navigate to a URL in the browser. Initializes the session and loads the page. Must be called before other browser tools. For simple information retrieval, prefer web_search or web_extract (faster, cheaper). Use browser tools when you need… | — |+| `browser_navigate` | Navigate to a URL in the browser. Initializes the session and loads the page. Must be called before other browser tools. For simple information retrieval, prefer a lightweight retrieval tool when one is available (faster, cheaper). Use browser tools when you need… | — || `browser_press` | Press a keyboard key. Useful for submitting forms (Enter), navigating (Tab), or keyboard shortcuts. Requires browser_navigate to be called first. | — || `browser_scroll` | Scroll the page in a direction. Use this to reveal more content that may be below or above the current viewport. Requires browser_navigate to be called first. | — || `browser_snapshot` | Get a text-based snapshot of the current page's accessibility tree. Returns interactive elements with ref IDs (like @e1, @e2) for browser_click and browser_type. full=false (default): compact view with interactive elements. full=true: comp… | — |