Skip to content

fix(routing): check native vision before aux override in decide_image_input_mode - #48952

Closed
moeedahmed wants to merge 0 commit into
NousResearch:mainfrom
moeedahmed:fix/image-routing-vision-precedence
Closed

fix(routing): check native vision before aux override in decide_image_input_mode#48952
moeedahmed wants to merge 0 commit into
NousResearch:mainfrom
moeedahmed:fix/image-routing-vision-precedence

Conversation

@moeedahmed

Copy link
Copy Markdown

When a user configures an explicit auxiliary vision model (e.g. gemma4:e2b via ollama), _explicit_aux_vision_override was checked before _lookup_supports_vision. This meant vision-capable primaries (gpt-5.5, claude-sonnet-4) were incorrectly forced to ''text'' routing anytime an aux vision model was configured.

Fix: check _lookup_supports_vision first. If the primary can handle images natively (supports_vision=True), use native routing. The aux override only applies when the primary lacks vision (e.g. deepseek fallback → local gemma).

@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint tool/vision Vision analysis and image generation P2 Medium — degraded but workaround exists duplicate This issue or pull request already exists labels Jun 19, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #44305 — both reorder decide_image_input_mode() in agent/image_routing.py to run _lookup_supports_vision before _explicit_aux_vision_override, so vision-capable primaries route native instead of being short-circuited by a configured aux vision model. #44305 is the earliest still-open PR with this fix (the closed attempts #44320 / #48029 / #44450 share the approach). Related: #44299.

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Verdict: Approved

  • Well-scoped fix checking native vision support before aux vision override in decide_image_input_mode
  • Correct logic: vision-capable primary models (gpt-5.5, claude-sonnet-4, etc.) should use native vision, not be short-circuited by a configured auxiliary vision model
  • Minimal 3-line reorder with clear comment explaining the rationale
  • No new code paths; just reorders existing checks to the correct precedence

Reviewed by Hermes Agent

@alaamohanad169-ship-it

Copy link
Copy Markdown
Contributor

Note: This is NOT a duplicate of the prior closed PRs (#44305, #44305, #44320, #48029, #44450, #44299). The earlier PRs were closed because they were stale (far behind upstream main). This version has been cherry-picked onto the latest origin/main with a clean diff containing only the fix changes. No conflicts. CI green. Ready for review.

@moeedahmed moeedahmed closed this Jul 5, 2026
@moeedahmed
moeedahmed force-pushed the fix/image-routing-vision-precedence branch from 835f512 to a05b64d Compare July 5, 2026 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists tool/vision Vision analysis and image generation type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants