Skip to content

The agent that grows with you

fix(tool-search): pull clarify back out of the default defer set — A/B showed structured ask collapses when deferred

Tekniumb1a46e192c25
diff --git a/tests/tools/test_tool_search.py b/tests/tools/test_tool_search.py
index 902902291d1..3230d076de6 100644
--- a/tests/tools/test_tool_search.py
+++ b/tests/tools/test_tool_search.py
@@ -172,6 +172,35 @@ class TestClassification:
# computer_use IS in the curated defer set → behind the bridge.
assert "computer_use" not in names
+ def test_clarify_stays_eager_by_default(self):
+ """PR #97979 A/B verdict (288 runs, 3 model tiers): clarify deferred
+ collapsed structured ask-the-user usage 18/18 → 7/18 (gpt-terra 0/6);
+ models fell back to plain-text questions. The ask-the-user affordance
+ must stay ambient — clarify is NOT in the curated default defer set,
+ and assembles as a direct tool even when the bridge is active."""
+ from tools.registry import discover_builtin_tools
+ from tools.tool_search import (
+ _DEFAULT_DEFERRED_TOOLS,
+ ToolSearchConfig,
+ assemble_tool_defs,
+ )
+
+ assert "clarify" not in _DEFAULT_DEFERRED_TOOLS
+
+ discover_builtin_tools()
+ assembled = assemble_tool_defs(
+ [
+ _td("clarify", "Ask the user clarifying questions"),
+ _td("computer_use", "Drive the OS"),
+ ],
+ context_length=200_000,
+ config=ToolSearchConfig.from_raw({"enabled": "on"}),
+ )
+ assert assembled.activated # computer_use still activates the bridge
+ names = {td["function"]["name"] for td in assembled.tool_defs}
+ assert "clarify" in names
+ assert "computer_use" not in names
+
def test_unknown_tool_not_deferrable(self):
"""Defensive: a tool name we cannot resolve to a registry entry must
not be claimed as deferrable. This protects against the OpenClaw
diff --git a/tools/tool_search.py b/tools/tool_search.py
index 92b4afef6b7..46f9953d044 100644
--- a/tools/tool_search.py
+++ b/tools/tool_search.py
@@ -259,8 +259,16 @@ _DIRECT_SURFACE_TOOLSETS = frozenset({"desktop_ui", "project"})
# Config override: ``tools.tool_search.defer`` (list of tool names);
# ``[]`` restores the legacy everything-eager behavior, any other list
# replaces this default wholesale. Names here are POST-rename.
+#
+# ``clarify`` was in the original curated set but was pulled back to eager
+# after the maintainer A/B (PR #97979, 288 runs × 3 model tiers): with the
+# schema visible models used structured clarify 18/18 on ambiguous tasks;
+# deferred, usage collapsed to 7/18 (gpt-terra 0/6) — models fell back to
+# plain-text questions, losing the structured-choice UX and costing an
+# extra user round-trip. The ask-the-user affordance has to be ambient to
+# fire; a catalog stub is not enough. (~250 tok to keep it eager.)
_DEFAULT_DEFERRED_TOOLS = frozenset({
- "computer_use", "session_search", "clarify", "image_generate",
+ "computer_use", "session_search", "image_generate",
"todo_list", "process_manage", "cronjob_manage",
# Desktop GUI surface (desktop_ui + project toolsets)
"drive_preview", "gui_tour", "desktop_preview", "annotate_preview",
@@ -277,7 +285,7 @@ def is_deferrable_tool_name(name: str, defer_tools: Optional[frozenset] = None)
set, or the user's ``tools.tool_search.defer`` override) — this is
the 2026-08 revision of the old "core never defers" rule: core tools
in the WORKING set (terminal, files, memory, ...) still never defer,
- but the curated event-triggered set (computer_use, clarify, the GUI
+ but the curated event-triggered set (computer_use, the GUI
surface, ...) hides behind the bridge by default; OR
* it is registered with an MCP toolset prefix; OR
* it is neither in ``_HERMES_CORE_TOOLS`` nor a session-gated GUI