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.
This commit is contained in:
Ayaan Zaidi
2026-07-12 07:30:18 +05:30
parent 57e0ea8f75
commit 0e154d0467
2 changed files with 3 additions and 8 deletions
@@ -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 }) => {
@@ -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