Repository navigation
fix(openai): treat credit_balance_exhausted as terminal credit exhaustion - #18770
diegosouzapw merged 3 commits into
Conversation
d0ebf50 to
01b9060
Compare
…tion Eligible ChatGPT Pro and Business subscriptions now receive monthly API credits that need no payment method. When that balance is spent the organization's requests fail with HTTP 429 and error code `credit_balance_exhausted`. The code was missing from CREDITS_EXHAUSTED_SIGNALS, so a response carrying only `error.code` fell through to the rate-limit branch. The account stayed selectable and kept getting retried on a short backoff even though it cannot recover until someone buys credits. List it alongside `insufficient_quota`. The separate entry matters because the credits guide documents the code, not the older type or message, and a body that omits those would otherwise never reach the terminal branch. The new test file covers accountFallback.ts, so it is registered in stryker.conf.json alongside another covering test that cheaper-inference#18649 left out of the list: the mutation-test-coverage gate compares every covering unit test against tap.testFiles and fails on the drift, which made it impossible to land this change without repairing that omission too. Signed-off-by: Minxi Hou <houminxi@gmail.com>
01b9060 to
0caac3c
Compare
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
41843d8
into
cheaper-inference:release/v3.8.53
What
Adds
credit_balance_exhaustedtoCREDITS_EXHAUSTED_SIGNALS.Why
Eligible ChatGPT Pro and Business subscriptions receive monthly API credits that need no payment method. When that balance is spent, requests fail with HTTP 429 and error code
credit_balance_exhausted(credits guide):That code was not in the list. A response carrying only
error.codetherefore failed to match any signal and fell through to the rate-limit branch, so the account stayed selectable and kept being retried on a short backoff — even though it cannot recover until someone buys credits.The existing
insufficient_quotaentry covers the case where the body still carries the older type. It does not cover a body that surfaces only the code, which is the shape the guide documents. Listing the code explicitly makes both shapes terminal.Testing
tests/unit/credit-balance-exhausted-signal.test.ts, 5 cases:{"error":{"code":"credit_balance_exhausted"}}classifies — this is the case that failed before the changerate_limit_exceededbody is not misread as credit exhaustionAll 5 fail against the previous list (case 2) or guard against regressions (cases 3-5); the neighbouring suites
auth-passthrough-credit-lockoutandaccount-fallback-servicestay at 100 passing.Also in this diff
tests/unit/18633-credit-exhaustion-parks-connection.test.tsis registered instryker.conf.jsontoo. That file arrived with #18649 and covers bothaccountFallback.tsandsrc/sse/services/auth.ts, but was never added totap.testFiles.check:mutation-test-coverage --strictscans every unit test against the mutated modules and fails on that drift, so any PR adding a covering test hits it — repairing the omission was the only way to land this one.