From 475fcf86caaf1516716b831cb544d2848c957c02 Mon Sep 17 00:00:00 2001 From: starptech Date: Thu, 2 Jul 2026 16:22:44 +0200 Subject: [PATCH] fix(console): skip console-side 429 retry for gateway providers --- packages/console/app/src/routes/zen/util/handler.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/console/app/src/routes/zen/util/handler.ts b/packages/console/app/src/routes/zen/util/handler.ts index eb7205a199..708596c3f3 100644 --- a/packages/console/app/src/routes/zen/util/handler.ts +++ b/packages/console/app/src/routes/zen/util/handler.ts @@ -210,7 +210,12 @@ export async function handler( ) logger.debug("REQUEST URL: " + reqUrl) logger.debug("REQUEST: " + reqBody.substring(0, 300) + "...") - const res = await fetchWith429Retry(reqUrl, { + const isGatewayProvider = providerInfo.id.startsWith("console.") || providerInfo.id.startsWith("console-go.") + // The inference gateway runs failover, retry, and shared cooldown handling + // internally and answers 429 with an authoritative Retry-After, so its + // verdict is final. Only direct vendor calls get the console-side 429 retry. + const fetcher = isGatewayProvider ? fetch : fetchWith429Retry + const res = await fetcher(reqUrl, { method: "POST", headers: (() => { const headers = new Headers(input.request.headers) @@ -242,7 +247,7 @@ export async function handler( signal: input.request.signal, }) - if (providerInfo.id.startsWith("console.") || providerInfo.id.startsWith("console-go.")) { + if (isGatewayProvider) { const resEndpointId = res.headers.get("x-opencode-endpoint-id") const resEndpointModelId = res.headers.get("x-opencode-upstream-model-id") if (resEndpointId && resEndpointModelId)