From dfbdbf2a67def12ecb45187dab30f91dac13e73f Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Wed, 12 Aug 2026 16:16:22 +0800 Subject: [PATCH] fix(provider-runtime): retry transient socket failures (#122535) * test: cover UND_ERR_SOCKET retry recovery Punchcard-Session: golden-cedar-brook-4q * fix(provider-runtime): retry UND_ERR_SOCKET failures Punchcard-Session: golden-cedar-brook-4q --- src/agents/run-wait.test.ts | 1 + src/infra/retryable-network-errors.ts | 2 +- src/provider-runtime/operation-retry.test.ts | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/agents/run-wait.test.ts b/src/agents/run-wait.test.ts index 344063256018..3385701f690f 100644 --- a/src/agents/run-wait.test.ts +++ b/src/agents/run-wait.test.ts @@ -838,6 +838,7 @@ describe("isRecoverableAgentWaitError", () => { "EHOSTUNREACH", "ENETUNREACH", "EAI_AGAIN", + "UND_ERR_SOCKET", ])("recovers from %s connection failures", (code) => { expect(isRecoverableAgentWaitError(`connect ${code} 127.0.0.1:443`)).toBe(true); }); diff --git a/src/infra/retryable-network-errors.ts b/src/infra/retryable-network-errors.ts index f048fab9bb9f..e619adbe22d2 100644 --- a/src/infra/retryable-network-errors.ts +++ b/src/infra/retryable-network-errors.ts @@ -55,7 +55,7 @@ const TRANSIENT_NETWORK_MESSAGE_SNIPPETS = [ ]; const RETRYABLE_CONNECTION_ERROR_CODE_RE = - /\b(?:ECONNRESET|ECONNREFUSED|ETIMEDOUT|EPIPE|EHOSTUNREACH|ENETUNREACH|EAI_AGAIN)\b/i; + /\b(?:ECONNRESET|ECONNREFUSED|ETIMEDOUT|EPIPE|EHOSTUNREACH|ENETUNREACH|EAI_AGAIN|UND_ERR_SOCKET)\b/i; function isWrappedFetchFailedMessage(message: string): boolean { if (message === "fetch failed") { diff --git a/src/provider-runtime/operation-retry.test.ts b/src/provider-runtime/operation-retry.test.ts index 3e12125f14cf..42ab8e9602ab 100644 --- a/src/provider-runtime/operation-retry.test.ts +++ b/src/provider-runtime/operation-retry.test.ts @@ -51,6 +51,7 @@ describe("executeProviderOperationWithRetry", () => { "EHOSTUNREACH", "ENETUNREACH", "EAI_AGAIN", + "UND_ERR_SOCKET", "ENOTFOUND", ])("retries %s network failures from structured errors", async (code) => { const cause = Object.assign(new Error("connect failed"), { code });