The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(agent): match enum-style reasoning_effort rejections with no unsupported marker
liuhao1024da8388c75964
diff --git a/agent/error_classifier.py b/agent/error_classifier.pyindex d6b0088d32f..1e7f209d74a 100644--- a/agent/error_classifier.py+++ b/agent/error_classifier.py@@ -456,13 +456,16 @@ _REASONING_MANDATORY_PATTERN = "reasoning is mandatory"# rejects sampling params for reasoning-first models with the contraction ("This model doesn't# support the temperature field", xAI Grok) and inference-profile Claude with "`temperature` is# deprecated for this model" (#111043); strict pydantic gateways (Fireworks) name the unknown-# field as "extra inputs are not permitted" (#109774). Shared with the auxiliary retry ladder+# field as "extra inputs are not permitted" (#109774). Enum-rejecting aggregators (commandcode.ai)+# say "Invalid option: expected one of ..." with no "unsupported" anywhere, naming the field only+# in the structured 'param' tail (#115277). Shared with the auxiliary retry ladder# (``agent.auxiliary_client._is_unsupported_parameter_error``).UNSUPPORTED_PARAM_MARKERS = ("unsupported parameter", "unsupported_parameter", "not supported", "does not support","doesn't support", "is deprecated for this model","unknown parameter", "unrecognized request argument", "unrecognized parameter","invalid parameter", "extra inputs are not permitted",+ "invalid option: expected one of",)# Reasoning wire-field names (the profile reasoning controls minus ``verbosity``), longest first.diff --git a/tests/agent/test_auxiliary_parameter_rung_chaining.py b/tests/agent/test_auxiliary_parameter_rung_chaining.pyindex e588ccdc070..5ff70b7d50a 100644--- a/tests/agent/test_auxiliary_parameter_rung_chaining.py+++ b/tests/agent/test_auxiliary_parameter_rung_chaining.py@@ -81,6 +81,23 @@ def test_reasoning_effort_none_unsupported_reversed_wording():assert not _is_reasoning_field_rejection(_Bad400("reasoning models: tool_choice 'required' is unsupported"))+def test_enum_rejection_with_field_in_structured_param_tail():+ """commandcode.ai rejects ``reasoning_effort: "none"`` as an enum violation whose message carries+ no "unsupported" marker at all — the field name appears only in the structured ``'param'`` tail+ (#115277). The enum wording still fires the strip-and-retry rung, while the same wording against+ a non-reasoning parameter does not (no reasoning field token anywhere)."""+ assert _is_reasoning_field_rejection(_Bad400(+ "Error code: 400 - {'error': {'message': 'Invalid option: expected one of "+ "\"low\"|\"medium\"|\"high\"|\"xhigh\"|\"max\"', 'type': 'invalid_request_error', "+ "'param': 'reasoning_effort'}}"+ ))+ assert not _is_reasoning_field_rejection(_Bad400(+ "Error code: 400 - {'error': {'message': 'Invalid option: expected one of "+ "\"low\"|\"medium\"|\"high\"|\"xhigh\"|\"max\"', 'type': 'invalid_request_error', "+ "'param': 'temperature'}}"+ ))++def test_fallback_candidate_recovers_from_rejected_temperature():client = _rejecting_client("temperature")resp = _call_fallback_candidate_sync(diff --git a/tests/agent/test_error_classifier.py b/tests/agent/test_error_classifier.pyindex 8e8dab5aa13..dbc35f63429 100644--- a/tests/agent/test_error_classifier.py+++ b/tests/agent/test_error_classifier.py@@ -893,12 +893,16 @@ class TestClassifyApiError:def test_reasoning_field_rejection_is_reasoning_mandatory(self):"""A 400 rejecting a reasoning wire control by name — reversed ("reasoning_effort 'none'- unsupported; use ...", #114460) or forward ("Unrecognized request argument supplied:- reasoning_effort") — takes the drop-the-disable rung, not the format_error abort; a- model-id segment (kimi-k2-thinking) stays route gating."""+ unsupported; use ...", #114460), forward ("Unrecognized request argument supplied:+ reasoning_effort"), or an enum rejection whose only field name sits in the structured+ 'param' tail (commandcode.ai, #115277) — takes the drop-the-disable rung, not the+ format_error abort; a model-id segment (kimi-k2-thinking) stays route gating."""for msg in ("Error code: 400 - reasoning_effort 'none' unsupported; use minimal|low|medium|high|xhigh","Unrecognized request argument supplied: reasoning_effort",+ "Error code: 400 - {'error': {'message': 'Invalid option: expected one of "+ "\"low\"|\"medium\"|\"high\"|\"xhigh\"|\"max\"', 'type': 'invalid_request_error', "+ "'param': 'reasoning_effort'}}",):result = classify_api_error(MockAPIError(msg, status_code=400), provider="custom", model="m")assert result.reason == FailoverReason.reasoning_mandatory, msg