The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(classifier): classify a retired free-route 404 as model_not_found
liuhao102448bf3118e9d0
diff --git a/agent/error_classifier.py b/agent/error_classifier.pyindex 6523ac7bad0..a191920c23a 100644--- a/agent/error_classifier.py+++ b/agent/error_classifier.py@@ -273,6 +273,10 @@ CODEX_ACCOUNT_MODEL_ENTITLEMENT_MARKER = "model is not supported when using code_MODEL_NOT_FOUND_PATTERNS = ("is not a valid model", "invalid model", "model not found", "model_not_found", "does not exist","no such model", "unknown model", "unsupported model", "no endpoints found that support tool use",+ # Nous 404 when the provider retires a :free route — the slug is dead for every+ # credential, so fall back instead of burning retries (#123180). Unlike the free-tier+ # billing wording, the account's balance/tier is not what rejected the call.+ "is no longer free",)# Qwen/vLLM chat-template "No user query found". Shared by the invalid-bodydiff --git a/tests/agent/test_error_classifier.py b/tests/agent/test_error_classifier.pyindex 4d0eb70407b..c8838d0c9e6 100644--- a/tests/agent/test_error_classifier.py+++ b/tests/agent/test_error_classifier.py@@ -231,6 +231,26 @@ class TestClassifyApiError:assert result.retryable is Falseassert result.should_fallback is True+ def test_404_retired_free_route_is_model_not_found(self):+ # The provider retired the :free route — the slug is dead for every+ # credential, so fall back instead of burning retries (#123180). Not+ # billing: the account's tier/balance is not what rejected the call.+ e = MockAPIError(+ "Not Found",+ status_code=404,+ body={+ "status": 404,+ "message": (+ "This model is no longer free. To continue using the paid "+ "variant, switch to 'meituan/longcat-2.0'."+ ),+ },+ )+ result = classify_api_error(e, provider="nous", model="meituan/longcat-2.0:free")+ assert result.reason == FailoverReason.model_not_found+ assert result.retryable is False+ assert result.should_fallback is True+def test_wrapped_402_uses_nested_body_message(self):inner = MockAPIError("inner",