From 0f977de2d25aae7d6897f8b7c0963621ac189e49 Mon Sep 17 00:00:00 2001 From: Phillipe Lopes Date: Thu, 27 Nov 2025 17:04:13 -0300 Subject: [PATCH] fix: map 404 to 429 to trigger opencode retries --- lib/request/fetch-helpers.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/request/fetch-helpers.ts b/lib/request/fetch-helpers.ts index 6690c4b..668f348 100644 --- a/lib/request/fetch-helpers.ts +++ b/lib/request/fetch-helpers.ts @@ -270,9 +270,13 @@ export async function handleErrorResponse( const headers = new Headers(response.headers); headers.set("content-type", "application/json; charset=utf-8"); + // Map 404 to 429 to trigger opencode retries + const status = response.status === 404 ? 429 : response.status; + const statusText = response.status === 404 ? "Too Many Requests" : response.statusText; + return new Response(enriched, { - status: response.status, - statusText: response.statusText, + status, + statusText, headers, }); }