The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(agent): match reversed reasoning_effort unsupported wording in retry rung
Yagna Vudathu4190af38d7b3
diff --git a/agent/auxiliary_client.py b/agent/auxiliary_client.pyindex c70ad437918..12e49e80aae 100644--- a/agent/auxiliary_client.py+++ b/agent/auxiliary_client.py@@ -3303,8 +3303,13 @@ def _is_reasoning_field_rejection(exc: Exception) -> bool:status = getattr(exc, "status_code", None)if status is not None and status not in {400, 422}:return False+ err_lower = str(exc).lower()if not any(_is_unsupported_parameter_error(exc, name) for name in ("reasoning", "think")):- return False+ # Reversed word order some providers use ("reasoning_effort 'none' unsupported"):+ # the field token plus standalone "unsupported" nearby is the same rejection (#114460).+ token = _REASONING_FIELD_TOKEN.search(err_lower)+ if token is None or "unsupported" not in err_lower[token.end():token.end() + 32]:+ return False# The reasoning token must be a standalone wire-field name: not a model-id segment ("The model# kimi-k2-thinking is not supported when using this account" is route gating that belongs to the# provider-fallback rung) and not the adjective in "... not supported with reasoning models".diff --git a/tests/agent/test_auxiliary_parameter_rung_chaining.py b/tests/agent/test_auxiliary_parameter_rung_chaining.pyindex dd77fd1fa6e..0f613b18b67 100644--- a/tests/agent/test_auxiliary_parameter_rung_chaining.py+++ b/tests/agent/test_auxiliary_parameter_rung_chaining.py@@ -68,6 +68,25 @@ def test_primary_rungs_chain_in_provider_order_and_strip_each_field_once():assert _is_reasoning_field_rejection(_Bad400("Extra inputs are not permitted, field: 'reasoning'"))+def test_reasoning_effort_none_unsupported_reversed_wording():+ """#114460: providers that put the adjective last+ (``reasoning_effort 'none' unsupported; ...``) must still fire the+ strip-and-retry rung."""+ msg = (+ "Error code: 400 - "+ "reasoning_effort 'none' unsupported; use minimal|low|medium|high|xhigh"+ )+ assert _is_reasoning_field_rejection(_Bad400(msg))+++def test_reasoning_model_route_gating_still_not_a_field_rejection():+ """Route gating that merely names a thinking model is not a wire-field+ rejection and must not strip."""+ assert not _is_reasoning_field_rejection(+ _Bad400("The model kimi-k2-thinking is not supported when using this account")+ )++def test_fallback_candidate_recovers_from_rejected_temperature():client = _rejecting_client("temperature")resp = _call_fallback_candidate_sync(