The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(agent): classify Codex account token failures
luyifan0acd96a439b2
diff --git a/agent/error_classifier.py b/agent/error_classifier.pyindex 551a208f379..b64feed68d0 100644--- a/agent/error_classifier.py+++ b/agent/error_classifier.py@@ -348,6 +348,9 @@ _CONTENT_POLICY_BLOCKED_PATTERNS = (_AUTH_PATTERNS = ("invalid api key", "invalid_api_key", "gateway_auth_failed", "authentication", "unauthorized","forbidden", "invalid token", "token expired", "token revoked", "access denied",+ # Codex backend rejecting an OAuth access token without a usable+ # ``chatgpt_account_id`` claim; arrives as a bare ``detail`` string.+ "failed to extract accountid from token",)# Empty-response advisories (OpenRouter / nano-gpt). Checked before overflowdiff --git a/tests/agent/test_error_classifier.py b/tests/agent/test_error_classifier.pyindex 8e8dab5aa13..4e403f3d600 100644--- a/tests/agent/test_error_classifier.py+++ b/tests/agent/test_error_classifier.py@@ -1016,6 +1016,15 @@ class TestClassifyApiError:+ def test_message_account_id_token_extraction_failure_is_auth(self):+ """Codex 'Failed to extract accountId from token' without a status is an+ auth failure: no retry on the same credential, rotate, fall back (#72911)."""+ e = Exception("Failed to extract accountId from token")+ result = classify_api_error(e, provider="openai-codex")+ assert result.reason == FailoverReason.auth+ assert result.retryable is False+ assert result.should_rotate_credential is True+ assert result.should_fallback is True# ── Message-only usage limit disambiguation (no status code) ──