Skip to content

The agent that grows with you

fix(vision): advertise vision_analyze/browser_vision when the main model sees natively

teknium153183d50167d
diff --git a/tests/agent/test_vision_routing.py b/tests/agent/test_vision_routing.py
index 5cd106dbc6b..7d2b76f5c5e 100644
--- a/tests/agent/test_vision_routing.py
+++ b/tests/agent/test_vision_routing.py
@@ -257,3 +257,26 @@ model:
import tools.browser_tool
with patch.object(bt_install, "check_browser_requirements", return_value=True):
assert tools.browser_tool_install.check_browser_vision_requirements() is True
+
+ def test_native_vision_main_advertises_image_tools_but_not_video(self, isolated_home, monkeypatch):
+ """A vision-capable main model on a provider the aux resolver cannot serve (OAuth, local vLLM)
+ still gets vision_analyze and browser_vision — both handlers attach pixels natively — while
+ video_analyze, whose handler has no native path, stays hidden (#47149)."""
+ from unittest.mock import patch
+
+ _write_config(isolated_home, """
+model:
+ provider: minimax-oauth
+ default: MiniMax-M3
+ supports_vision: true
+""")
+ _fresh_modules()
+
+ import tools.browser_tool_install as bt_install
+ from tools import vision_tools
+
+ with patch.object(vision_tools, "_should_use_native_vision_fast_path", return_value=True), \
+ patch.object(bt_install, "check_browser_requirements", return_value=True):
+ assert vision_tools.check_video_requirements() is False # no aux client resolves
+ assert vision_tools.check_vision_requirements() is True
+ assert bt_install.check_browser_vision_requirements() is True
diff --git a/tools/vision_tools.py b/tools/vision_tools.py
index 4de8eda4927..a16c228d8a6 100644
--- a/tools/vision_tools.py
+++ b/tools/vision_tools.py
@@ -797,7 +797,7 @@ async def vision_analyze_tool(
return await _run_analysis("image", image_url, user_prompt, model, stage)
-def check_vision_requirements() -> bool:
+def check_video_requirements() -> bool:
"""True when ``call_llm(task="vision")`` could resolve a client.
Mirrors its fallback chain: explicit ``auxiliary.vision.provider``, then auto (main
@@ -815,6 +815,15 @@ def check_vision_requirements() -> bool:
)
+def check_vision_requirements() -> bool:
+ """Image gate (``vision_analyze``, ``browser_vision``): an aux vision client OR the native fast
+ path. Both handlers attach pixels straight to a vision-capable main model, so a main model on a
+ provider the aux resolver does not know (OAuth, local vLLM) must not hide a working tool (#47149).
+ ``video_analyze`` keeps the aux-only gate — its handler has no native path.
+ """
+ return _should_use_native_vision_fast_path() or check_video_requirements()
+
+
from tools.registry import registry, tool_error
VISION_ANALYZE_SCHEMA = {
@@ -1044,7 +1053,7 @@ registry.register(
toolset="video",
schema=VIDEO_ANALYZE_SCHEMA,
handler=_handle_video_analyze,
- check_fn=check_vision_requirements,
+ check_fn=check_video_requirements,
is_async=True,
emoji="🎬")