The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(image-routing): resolve vision capability of valid Codex `-900k` variants via their base slug
teknium1c6d0b632d57c
diff --git a/agent/image_routing.py b/agent/image_routing.pyindex 949a46da527..8cb8d597a7b 100644--- a/agent/image_routing.py+++ b/agent/image_routing.py@@ -286,6 +286,13 @@ def _probe_models_dev(provider: str, model: str, cfg: Optional[Dict[str, Any]])# "unknown" would fall back to attempting the call and reintroduce the bug. This preserves the# historical network-on-cold-cache behavior for this one path; the fetch is cached (4h TTL) and# backoff-limited after failures.+ if (provider or "").strip().lower() == "openai-codex":+ # A VALID Codex ``-900k`` picker variant is a Hermes-side alias of its base slug; the catalog+ # only knows the base, so look that up. The runtime model id stays untouched (the transport+ # owns wire normalization) and ineligible ``-900k`` strings pass through unchanged (#102189).+ from agent.model_metadata import strip_codex_context_variant_suffix++ model = strip_codex_context_variant_suffix(model)caps = get_model_capabilities(provider, model, allow_network=True)return None if caps is None else caps.supports_visiondiff --git a/tests/agent/test_image_routing.py b/tests/agent/test_image_routing.pyindex 3a3aa9fd694..69eecf07619 100644--- a/tests/agent/test_image_routing.py+++ b/tests/agent/test_image_routing.py@@ -670,3 +670,26 @@ class TestProbeApiKeyForwarding:) as detect:_lookup_supports_vision("custom", "llava", {"model": {"api_key": key}})assert detect.call_args.kwargs.get("api_key") == key+++class TestCodexContextVariantVisionLookup:+ """Issue #102189: a VALID Codex ``-900k`` picker variant is an alias of its base slug, so the+ vision-capability lookup must key on the base while ineligible ``-900k`` strings gain nothing."""++ def test_valid_variant_resolves_against_base_slug(self, monkeypatch):+ from types import SimpleNamespace+ import agent.models_dev as models_dev+ import agent.image_routing as image_routing++ seen = []++ def fake_caps(provider, model, allow_network=False):+ seen.append(model)+ return SimpleNamespace(supports_vision=True) if model == "gpt-5.6-sol" else None++ monkeypatch.setattr(models_dev, "get_model_capabilities", fake_caps)+ assert image_routing._probe_models_dev("openai-codex", "gpt-5.6-sol-900k", {}) is True+ assert seen == ["gpt-5.6-sol"]+ # Ineligible alias: looked up verbatim, no capability gained.+ assert image_routing._probe_models_dev("openai-codex", "gpt-5.5-900k", {}) is None+ assert seen[-1] == "gpt-5.5-900k"