Tighten optional Vision Model configuration

Alessandro committed Aug 25, 2026 at 20:20 UTC 8d1c76e654d0fa1be18f54d69a1690052096bb5b
2 files changed +5 -4
plugins/_model_config/helpers/model_config.py
+3 -4
@@ -277,9 +277,6 @@ def _clean_preset_for_file(preset: dict) -> dict:
277 slot_config = preset.get(slot)
278 if isinstance(slot_config, dict):
279 slot_clean = _strip_ui_fields(slot_config, strip_api_key=True)
280 - if slot == "vision" and _slot_has_identity(slot_clean):
281 - slot_clean["vision"] = True
282 - slot_clean.setdefault("max_embeds", 10)
280 cleaned[slot] = (
281 slot_clean
282 if name == DEFAULT_PRESET_NAME
@@ -762,7 +759,9 @@ def get_vision_model_config(agent=None) -> dict:
759 """Get the active Vision Model config after applying Main-first routing."""
760 cfg = get_effective_config(agent)
761 vision_cfg = cfg.get("vision_model", {})
765 - if not _slot_has_identity(vision_cfg):
762 + if not all(
763 + str(vision_cfg.get(key) or "").strip() for key in ("provider", "name")
764 + ):
765 return {}
766 chat_cfg = cfg.get("chat_model", {})
767 return (
tests/test_vision_load_image_refs.py
+2
@@ -143,6 +143,8 @@ def test_active_vision_model_route_prefers_main_native_vision(monkeypatch):
143
144 cases = [
145 ({"vision": False}, {}, False),
146 + ({"vision": False}, {"provider": "p"}, False),
147 + ({"vision": False}, {"name": "v"}, False),
148 ({"vision": True}, {"provider": "p", "name": "v"}, False),
149 ({"vision": False}, {"provider": "p", "name": "v"}, True),
150 (