← Back to PRs

#23467: feat: support image model resolution from media tool config

by sreerevanth open 2026-02-22 10:29 View on GitHub →
agents size: XS
## Problem The image tool did not explicitly prefer `cfg.tools.media.image.models` when resolving the vision model configuration. **Why it matters:** Users should be able to define dedicated vision models (with ordered fallbacks) specifically for the image tool instead of relying only on global/default resolution logic. --- ## What Changed - Added support for resolving image models from `cfg.tools.media.image.models` - The first entry is treated as **primary**; remaining entries are treated as **fallbacks** - Preserved existing `agents.defaults.imageModel` behavior and fallback logic **What did NOT change (scope boundary):** - No changes to model execution logic - No changes to auth handling - No changes to fallback execution flow --- ## Change Type Feature ## Scope Skills / tool execution, API / contracts ## Linked Issues - Closes #23281 - Related #8096, #7564 --- ## User-Visible / Behavior Changes Users can now configure ordered vision models under `cfg.tools.media.image.models`. The first model becomes the primary vision model and subsequent models act as fallbacks. If no media image models are configured, existing behavior remains unchanged. --- ## Security Impact No new permissions, no changes to secrets/token handling, no new network calls, no changes to execution surface or data access scope. --- ## Repro & Verification 1. Configure multiple models under `cfg.tools.media.image.models` 2. Trigger the image tool 3. Inspect resolved model selection **Expected:** First configured model used as primary, remaining as fallbacks, default behavior preserved if config is absent. **Actual:** ✅ Behavior matches expected. --- ## Compatibility / Migration Fully backward compatible. No config, env, or migration changes required. <!-- greptile_comment --> <h3>Greptile Summary</h3> Added support for resolving image models from `cfg.tools.media.image.models` configuration. The implementation correctly prioritizes media-specific image models before falling back to `agents.defaults.imageModel` and other default resolution logic. The first configured model becomes the primary model, with remaining models treated as fallbacks, maintaining full backward compatibility when the config is absent. <h3>Confidence Score: 4/5</h3> - This PR is safe to merge with minimal risk - The implementation is straightforward and follows existing patterns in the codebase. It adds a new configuration path that is checked before existing fallback logic, maintaining full backward compatibility. The code includes appropriate null checks and array filtering. The only minor concern is that CLI-type models from the config would be silently filtered out, but this is handled gracefully and doesn't affect the primary use case. - No files require special attention <sub>Last reviewed commit: 447c97e</sub> <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs