@@ -103,7 +103,6 @@ import type { WsData } from "../ws-bridge";
103103import { registerTurn , trackStreamLifetime , unregisterTurn } from "../lifecycle" ;
104104import { redactSecretString } from "../../lib/redact" ;
105105import { readBoundedResponseBody } from "../../lib/bounded-body" ;
106- import { classifyCodexPreStreamRejection } from "../../codex/quota-rejection" ;
107106import type { AdmissionLease } from "../../lib/admission" ;
108107import { supportedLadderFor } from "../effort-policy" ;
109108import { isThreadSpawnRequest } from "../effort-policy" ;
@@ -247,12 +246,8 @@ async function shouldRetryCodexPoolAccountModel400(
247246}
248247
249248/** Pre-stream quota/billing rejections that warrant one alternate-account attempt (#584). */
250- async function shouldRetryCodexPoolAccountQuota (
251- response : Response ,
252- signal ?: AbortSignal ,
253- ) : Promise < boolean > {
254- const rejection = await classifyCodexPreStreamRejection ( response , { signal } ) ;
255- return rejection . alternateRetryEligible ;
249+ export function shouldRetryCodexPoolAccountQuota ( response : Response ) : boolean {
250+ return response . status === 402 || response . status === 429 ;
256251}
257252
258253interface CodexPoolAccountRetryArgs {
@@ -1630,7 +1625,7 @@ async function handleResponsesInner(
16301625 options . abortSignal ,
16311626 ) ) {
16321627 poolRetryOutcome = 400 ;
1633- } else if ( await shouldRetryCodexPoolAccountQuota ( upstreamResponse , options . abortSignal ) ) {
1628+ } else if ( shouldRetryCodexPoolAccountQuota ( upstreamResponse ) ) {
16341629 // Pre-stream only: once SSE has begun, mid-stream quota stays terminal.
16351630 poolRetryOutcome = upstreamResponse . status ;
16361631 }
0 commit comments