The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(codex): clamp xAI max/ultra aliases to the model's reasoning ceiling (#87279)
liuhao10248fe863325467
diff --git a/agent/transports/codex.py b/agent/transports/codex.pyindex bf73ba971fa..6f6d255d61f 100644--- a/agent/transports/codex.py+++ b/agent/transports/codex.py@@ -433,11 +433,16 @@ class ResponsesApiTransport(ProviderTransport):if params.get("is_xai_responses", False):from agent.model_metadata import is_grok_46_family- # Grok 4.6 accepts xhigh as a wire value. Older Grok models top out- # at high, while max/ultra remain Hermes aliases for every xAI model.- if not is_grok_46_family(model):+ # Grok 4.6 accepts xhigh as a wire value; older Grok models top+ # out at high. max/ultra are Hermes ladder aliases for "this+ # model's ceiling", so they clamp to the strongest level the+ # model actually accepts — xhigh on grok-4.6, high elsewhere —+ # never one rung below it (#87279).+ if is_grok_46_family(model):+ _effort_clamp.update({"max": "xhigh", "ultra": "xhigh"})+ else:_effort_clamp["xhigh"] = "high"- _effort_clamp.update({"max": "high", "ultra": "high"})+ _effort_clamp.update({"max": "high", "ultra": "high"})if (params.get("provider") or "").strip().lower() == "actual":# Actual Computer relays to SGLang/vLLM backends that accept only# none/low/medium/high/max for reasoning effort — a forwardeddiff --git a/tests/agent/transports/test_codex_transport.py b/tests/agent/transports/test_codex_transport.pyindex 408b49d450b..533bba8551d 100644--- a/tests/agent/transports/test_codex_transport.py+++ b/tests/agent/transports/test_codex_transport.py@@ -1021,7 +1021,9 @@ class TestCodexTransportXaiReasoningEffort:assert kw["reasoning"]["effort"] == "xhigh"@pytest.mark.parametrize("effort", ["max", "ultra"])- def test_grok_46_clamps_hermes_aliases_to_high(self, transport, effort):+ def test_grok_46_clamps_hermes_aliases_to_model_ceiling(self, transport, effort):+ """Hermes ladder aliases mean "this model's ceiling" — on grok-4.6+ that is xhigh, not one rung below it (#87279)."""kw = transport.build_kwargs(model="x-ai/grok-4.6-latest",messages=[{"role": "user", "content": "hi"}],@@ -1030,6 +1032,19 @@ class TestCodexTransportXaiReasoningEffort:reasoning_config={"effort": effort},)+ assert kw["reasoning"]["effort"] == "xhigh"++ @pytest.mark.parametrize("effort", ["max", "ultra"])+ def test_older_grok_clamps_aliases_to_high(self, transport, effort):+ """Older Grok tops out at high; above-ceiling aliases land there."""+ kw = transport.build_kwargs(+ model="grok-4.5",+ messages=[{"role": "user", "content": "hi"}],+ tools=[],+ is_xai_responses=True,+ reasoning_config={"effort": effort},+ )+assert kw["reasoning"]["effort"] == "high"def test_older_grok_clamps_xhigh_to_high(self, transport):