Skip to content

The agent that grows with you

fix(aux): flatten the Codex reasoning projection guard; pin OpenAI's unsupported-none 400 shape

teknium180009fbd6f6d
diff --git a/agent/auxiliary_client.py b/agent/auxiliary_client.py
index 774b298880e..a2970bbc8a9 100644
--- a/agent/auxiliary_client.py
+++ b/agent/auxiliary_client.py
@@ -1472,9 +1472,7 @@ class _CodexCompletionsAdapter:
from agent.reasoning_effort import clamp_effort
from agent.transports.codex import _codex_efforts_for_route
supported = _codex_efforts_for_route(model, host, is_codex_backend=route.is_codex_backend)
- if not supported:
- pass
- elif reasoning_cfg.get("enabled") is not False:
+ if supported and reasoning_cfg.get("enabled") is not False:
# Truthy-only: Codex 400s on e.g. {"effort": null}, so falsy → default.
effort = clamp_effort(reasoning_cfg.get("effort") or "medium", supported)
resp_kwargs["reasoning"] = {"effort": effort, "summary": "auto"}
diff --git a/tests/agent/test_error_classifier.py b/tests/agent/test_error_classifier.py
index 348261d2434..ac662bcaeba 100644
--- a/tests/agent/test_error_classifier.py
+++ b/tests/agent/test_error_classifier.py
@@ -9,6 +9,7 @@ from agent.error_classifier import (
FailoverReason,
PROVIDER_STREAM_NON_JSON_ERROR_CODE,
classify_api_error,
+ is_reasoning_field_rejection,
_extract_status_code,
_extract_error_body,
_extract_error_code,
@@ -931,6 +932,19 @@ class TestClassifyApiError:
)
assert gated.reason != FailoverReason.reasoning_mandatory
+ def test_openai_unsupported_none_effort_body_is_reasoning_mandatory(self):
+ """OpenAI's real 400 for ``reasoning.effort: none`` on a model whose ladder has no ``none`` (o3/o4-mini,
+ gpt-5/gpt-5-codex; ``none`` is gpt-5.1+): the SDK message carries the body — ``param: reasoning.effort``
+ plus ``code: unsupported_value`` — and must take the drop-the-disable retry rung, not a format abort."""
+ body = {"error": {"message": "Unsupported value: 'none' is not supported with this model. Supported values "
+ "are: 'low', 'medium', and 'high'.",
+ "type": "invalid_request_error", "param": "reasoning.effort", "code": "unsupported_value"}}
+ msg = f"Error code: 400 - {body}"
+ assert is_reasoning_field_rejection(msg)
+ result = classify_api_error(MockAPIError(msg, status_code=400, body=body), provider="openai-api", model="o4-mini")
+ assert result.reason == FailoverReason.reasoning_mandatory
+ assert result.retryable is True and result.should_fallback is False
+
# ── Provider-specific: llama.cpp grammar-parse ──
def test_llama_cpp_unable_to_generate_parser_template(self):