Native vision priority over auxiliary fallback routing
Cluster 29135 · agent · Bug. Data as of
2 open items. Fix merged in #57650 on 3 Jul 2026. Check it covers your case.
The short answer
- Known?
- Yes. 10 related items grouped here, 2 issues already closed.
- Fix event
- A fix was merged to main in PR #57650. Check it covers your case. No release data is tracked. Fix link checked: 3 Jul 2026.
- Tracker
- The maintainers' tracker marks this
partially resolved, deciding PR #57650. That is separate from the fix event.
Next step: read #57650, then check whether your report is the one still open.
Read #57650Pick up a Lab taskThese issues and pull requests concern the logic for preferring native model vision capabilities over configured auxiliary vision overrides in auto image-routing mode. Multiple fixes and features address cases where auxiliary.vision configuration incorrectly blocked or bypassed native vision support.
Open issues1
- Issue#44299auxiliary.vision explicit config blocks native vision + need image-in-user-message injection for providers like Xiaomi MiMo
Open PRs1
- PR#144834fix(vision): reshape tool-result images to user message for strict providers and prevent aux stream crashes
Fixes on record
-
#57650 fix(agent): prefer native vision over auxiliary fallback in auto mode (#29135)
files:
agent/image_routing.py,tests/agent/test_image_routing.pyShow the diff
-
agent/image_routing.py@@ -17,13 +17,17 @@ | ``text``, default ``auto``) and the active model's capability metadata. In ``auto`` mode: - - If the user has explicitly configured ``auxiliary.vision.provider`` - (i.e. not ``auto`` and not empty), we assume they want the text pipeline - regardless of the main model — they've opted in to a specific vision - backend for a reason (cost, quality, local-only, etc.). - - Otherwise, if the active model reports ``supports_vision=True`` in its - models.dev metadata, we attach natively. - - Otherwise (non-vision model, no explicit override), we fall back to text. + - If the active model reports ``supports_vision=True`` (via config + override or models.dev metadata), we attach natively — vision-capable + main models should always see the original pixels, even when an + auxiliary vision backend is configured. That auxiliary backend then + acts as a *fallback* for sessions whose main model can't take images. + - Otherwise, if the user has explicitly configured ``auxiliary.vision`` + (provider/model/base_url not ``auto``/empty), we route through the + text pipeline so the auxiliary vision backend can describe the image + for the text-only main model. + - Otherwise (non-vision model, no explicit override), we fall back to + text via the default vision_analyze flow. This keeps ``vision_analyze`` surfaced as a tool in every session — skills and agent flows that chain it (browser screenshots, deeper inspection of @@ -342,8 +346,10 @@ def _coerce_mode(raw: Any) -> str: def _explicit_aux_vision_override(cfg: Optional[Dict[str, Any]]) -> bool: """True when the user configured a specific auxiliary vision backend. - An explicit override means the user *wants* the text pipeline (they're - paying for a dedicated vision model), so we don't silently bypass it. + An explicit override means the user has a dedicated vision backend + available; it's used as a *fallback* when the main model can't take + images natively. In ``auto`` mode, native vision on a vision-capable + main model still wins over this fallback — see issue #29135. """ if not isinstance(cfg, dict): return False @@ -432,13 +438,15 @@ def decide_image_input_mode( if mode_cfg == "text": return "text" - # auto - if _explicit_aux_vision_override(cfg): - return "text" - + # auto: prefer native vision when the main model supports it. An + # explicit auxiliary.vision config acts as a *fallback* for text-only + # main models — it should not preempt native vision on a model that + # can natively inspect the pixels (issue #29135). supports = _lookup_supports_vision(provider, model, cfg) if supports is True: return "native" + if _explicit_aux_vision_override(cfg): + return "text" return "text" -
tests/agent/test_image_routing.py@@ -97,11 +97,21 @@ def test_auto_with_unknown_model(self): with patch("agent.image_routing._lookup_supports_vision", return_value=None): assert decide_image_input_mode("openrouter", "brand-new-slug", {}) == "text" - def test_auto_respects_aux_vision_override_even_for_vision_model(self): - """If the user configured a dedicated vision backend, don't bypass it.""" + def test_auto_prefers_native_for_vision_capable_main_model_even_with_aux_configured(self): + """Regression #29135: vision-capable main model wins over aux fallback. + + Auxiliary.vision is a fallback for text-only main models; it must + not preempt native vision on a vision-capable main model. + """ cfg = {"auxiliary": {"vision": {"provider": "openrouter", "model": "google/gemini-2.5-flash"}}} with patch("agent.image_routing._lookup_supports_vision", return_value=True): - assert decide_image_input_mode("anthropic", "claude-sonnet-4", cfg) == "text" + assert decide_image_input_mode("anthropic", "claude-sonnet-4", cfg) == "native" + + def test_auto_uses_aux_vision_fallback_for_text_only_main_model(self): + """#29135: aux vision still acts as fallback for non-vision main models.""" + cfg = {"auxiliary": {"vision": {"provider": "openrouter", "model": "google/gemini-2.5-flash"}}} + with patch("agent.image_routing._lookup_supports_vision", return_value=False): + assert decide_image_input_mode("deepseek", "deepseek-v4-pro", cfg) == "text" def test_none_config_is_auto(self): with patch("agent.image_routing._lookup_supports_vision", return_value=True): @@ -325,15 +335,25 @@ def test_auto_text_for_custom_with_no_override(self): with patch("agent.models_dev.get_model_capabilities", return_value=None): assert decide_image_input_mode("custom", "unknown", {}) == "text" - def test_explicit_aux_vision_override_still_wins(self): - # If the user has configured a dedicated vision aux backend, respect - # it even when supports_vision: true is also set. + def test_explicit_aux_vision_no_longer_overrides_native_capable_main(self): + # #29135: aux.vision is a fallback for text-only main models; it + # must NOT preempt native routing when the main model can take + # images directly (supports_vision: true). cfg = { "model": {"supports_vision": True}, "auxiliary": {"vision": {"provider": "openrouter", "model": "gemini-2.5-pro"}}, } with patch("agent.models_dev.get_model_capabilities", return_value=None): - assert decide_image_input_mode("custom", "qwen3.6-35b", cfg) == "text" + assert decide_image_input_mode("custom", "qwen3.6-35b", cfg) == "native" + + def test_explicit_aux_vision_used_when_main_model_supports_vision_false(self): + # #29135 counterpart: text-only main model + aux fallback → text. + cfg = { + "model": {"supports_vision": False}, + "auxiliary": {"vision": {"provider": "openrouter", "model": "gemini-2.5-pro"}}, + } + with patch("agent.models_dev.get_model_capabilities", return_value=None): + assert decide_image_input_mode("custom", "deepseek-v4", cfg) == "text" # ─── build_native_content_parts ──────────────────────────────────────────────
-
5 PRs closed without merging
From the close comments: superseded by another PR 2 · duplicate 1 · merged via another change 1 · other 1
- #29138 fix: prefer native vision in auto image routing · other
-
#32519 fix(agent): prefer native vision over auxiliary fallback in auto mode (#29135) · merged via another change →
#57650 -
#44320 fix(image-routing): check native vision support before aux override · superseded by another PR →
#44305 -
#44450 fix(agent): prefer native vision when main model supports it (#44299) · superseded by another PR →
#32519,#44299 -
#45571 fix(vision_tools): check supports_vision_tool_messages in native fast path (#44299) · duplicate →
#39692,#47747,#44299,#39685
Closed issues · 2
How this cluster was grouped
-
Link evidence (
partly structural links): some members are connected by structural evidence (shared changed files, or a closing/superseded reference); the rest are joined by an automated relevance judgement over their text. - Members outside that structural core may belong to a different underlying problem.
-
Pairwise link density
0.20: the share of item pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36.1.00means every pair is linked.