From 693f06d811e77b952d0dbfefefd78f78ef3d61da Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 27 May 2026 00:34:50 +0100 Subject: [PATCH] fix(live): classify Z.ai plan denials as billing drift --- src/agents/pi-embedded-helpers/failover-matches.test.ts | 6 ++++++ src/agents/pi-embedded-helpers/failover-matches.ts | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/agents/pi-embedded-helpers/failover-matches.test.ts b/src/agents/pi-embedded-helpers/failover-matches.test.ts index 6fe520965cb..f957155857e 100644 --- a/src/agents/pi-embedded-helpers/failover-matches.test.ts +++ b/src/agents/pi-embedded-helpers/failover-matches.test.ts @@ -15,6 +15,12 @@ describe("Z.ai vendor error codes (#48988)", () => { expect(isBillingErrorMessage(raw)).toBe(true); }); + it("classifies prose-only subscription plan access denials as billing", () => { + const raw = + "FailoverError: Your current subscription plan does not yet include access to GLM-5V-Turbo"; + expect(isBillingErrorMessage(raw)).toBe(true); + }); + it("classifies Z.ai 1311 with spaces as billing", () => { const raw = '{"code": 1311, "message": "model not on plan"}'; expect(isBillingErrorMessage(raw)).toBe(true); diff --git a/src/agents/pi-embedded-helpers/failover-matches.ts b/src/agents/pi-embedded-helpers/failover-matches.ts index 6e045828521..e2a1a618989 100644 --- a/src/agents/pi-embedded-helpers/failover-matches.ts +++ b/src/agents/pi-embedded-helpers/failover-matches.ts @@ -204,6 +204,8 @@ const ERROR_PATTERNS = { "账户已欠费", // Z.ai: error 1311 = model not included in current subscription plan (#48988) ZAI_BILLING_CODE_1311_RE, + /\bcurrent\s+subscription\s+plan\b.*\b(?:does\s+not|doesn't|not)\b.*\binclude\s+access\b/i, + /\bmodel\b.*\bnot\s+available\b.*\bcurrent\s+plan\b/i, ], authPermanent: HIGH_CONFIDENCE_AUTH_PERMANENT_PATTERNS, auth: [