From 0e154d04674297fcca603688e8b78aee737c4e1f Mon Sep 17 00:00:00 2001 From: Ayaan Zaidi Date: Sun, 12 Jul 2026 07:30:18 +0530 Subject: [PATCH] fix(auto-reply): keep typed overloaded failures on the surfaced-copy path Shipped behavior pins overloaded FailoverErrors to immediate dedicated copy (agent-runner-execution.test.ts 'surfaces typed overloaded failures'); only timeout and server_error reasons join the transient retry gate. --- src/auto-reply/reply/agent-runner-execution.test.ts | 4 ---- src/auto-reply/reply/agent-runner-execution.ts | 7 +++---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/auto-reply/reply/agent-runner-execution.test.ts b/src/auto-reply/reply/agent-runner-execution.test.ts index 27757c1ffeaf..cbec84628f88 100644 --- a/src/auto-reply/reply/agent-runner-execution.test.ts +++ b/src/auto-reply/reply/agent-runner-execution.test.ts @@ -7867,10 +7867,6 @@ describe("runAgentTurnWithFallback", () => { reason: "timeout" as const, message: "provider request timed out without status token", }, - { - reason: "overloaded" as const, - message: "provider capacity exhausted briefly", - }, ])( "retries once for structured FailoverError $reason without leading HTTP status text", async ({ reason, message }) => { diff --git a/src/auto-reply/reply/agent-runner-execution.ts b/src/auto-reply/reply/agent-runner-execution.ts index c0fca6f5da1f..217ceeddc299 100644 --- a/src/auto-reply/reply/agent-runner-execution.ts +++ b/src/auto-reply/reply/agent-runner-execution.ts @@ -3084,12 +3084,11 @@ async function runAgentTurnWithFallbackInternal( !shouldSurfaceToControlUi ? classifyProviderRequestError(err) : undefined; + // Typed overloaded failures stay out of the transient retry: they surface + // dedicated overloaded copy immediately instead of being retried silently. const isTransientHttp = isTransientHttpError(message) || - (isFailoverError(err) && - (err.reason === "timeout" || - err.reason === "server_error" || - err.reason === "overloaded")); + (isFailoverError(err) && (err.reason === "timeout" || err.reason === "server_error")); // Drain/restart aborts stay silent and defer to post-restart // main-session recovery, which resumes the interrupted turn (or emits its