


















@@ -1442,21 +1442,34 @@ describe("classifyProviderRuntimeFailureKind", () => {
14421442});
1443144314441444it("classifies OAuth refresh failures", () => {
1445-expect(
1446-classifyProviderRuntimeFailureKind(
1447-"OAuth token refresh failed for openai-codex: invalid_grant. Please try again or re-authenticate.",
1448-),
1449-).toBe("auth_refresh");
1450-expect(
1451-classifyProviderRuntimeFailureKind(
1452-"Your access token could not be refreshed because you have since logged out or signed in to another account. Please sign in again.",
1453-),
1454-).toBe("auth_refresh");
1455-expect(
1456-classifyProviderRuntimeFailureKind(
1457-"Your authentication session could not be refreshed automatically. Please log out and sign in again.",
1458-),
1459-).toBe("auth_refresh");
1445+const refreshFailures = [
1446+"OAuth token refresh failed for openai-codex: invalid_grant. Please try again or re-authenticate.",
1447+"Your access token could not be refreshed because you have since logged out or signed in to another account. Please sign in again.",
1448+"Your authentication session could not be refreshed automatically. Please log out and sign in again.",
1449+];
1450+for (const message of refreshFailures) {
1451+expect(classifyProviderRuntimeFailureKind(message)).toBe("auth_refresh");
1452+expect(classifyFailoverReason(message, { provider: "openai-codex" })).toBe("auth_permanent");
1453+}
1454+});
1455+1456+it("does not make uncertain OAuth refresh wrappers terminal", () => {
1457+const message =
1458+"OAuth token refresh failed for openai-codex: file lock timeout for /tmp/agent/auth-profiles.json. Please try again or re-authenticate.";
1459+expect(classifyProviderRuntimeFailureKind(message)).toBe("auth_refresh");
1460+expect(classifyFailoverReason(message, { provider: "openai-codex" })).toBe("auth");
1461+});
1462+1463+it("keeps Codex entitlement and usage-limit payloads out of terminal auth", () => {
1464+const entitlementMessages = [
1465+"You've hit your usage limit. Upgrade to Plus to continue using Codex (https://chatgpt.com/explore/plus), try again after 11:34 AM.",
1466+"You've hit your usage limit. Visit https://chatgpt.com/codex/settings/usage to purchase more credits, try again later.",
1467+'429 {"type":"error","error":{"type":"rate_limit_error","message":"You\\u0027ve hit your usage limit. Upgrade to Plus to continue using Codex (https://chatgpt.com/explore/plus), try again after 11:34 AM."}}',
1468+];
1469+for (const message of entitlementMessages) {
1470+expect(classifyProviderRuntimeFailureKind(message)).not.toBe("auth_refresh");
1471+expect(classifyFailoverReason(message, { provider: "openai-codex" })).toBe("rate_limit");
1472+}
14601473});
1461147414621475it("classifies OAuth refresh timeouts and lock contention distinctly", () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。