@@ -51,6 +51,9 @@ const RETRYABLE_PROVIDER_ERROR_PATTERN = buildProviderErrorPattern([
|
||||
"connection.?lost",
|
||||
"other side closed",
|
||||
"fetch failed",
|
||||
"getaddrinfo",
|
||||
"ENOTFOUND",
|
||||
"EAI_AGAIN",
|
||||
"upstream.?connect",
|
||||
"reset before headers",
|
||||
"socket hang up",
|
||||
|
||||
@@ -10,6 +10,8 @@ const nvidiaNIMResourceExhaustedMessage = "ResourceExhausted: Worker local total
|
||||
const bunFetchSocketClosedMessage =
|
||||
"The socket connection was closed unexpectedly. For more information, pass `verbose: true` in the second argument to fetch()";
|
||||
const openAIResponsesEarlyEofMessage = "OpenAI Responses stream ended before a terminal response event";
|
||||
const wrappedDnsLookupError =
|
||||
"The pending stream has been canceled (caused by: getaddrinfo ENOTFOUND bedrock-runtime.us-east-1.amazonaws.com)";
|
||||
|
||||
describe("provider retry classification", () => {
|
||||
it("matches explicit provider retry guidance", () => {
|
||||
@@ -38,6 +40,15 @@ describe("provider retry classification", () => {
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it.each([
|
||||
wrappedDnsLookupError,
|
||||
"connect ENOTFOUND api.example.com",
|
||||
"EAI_AGAIN api.example.com",
|
||||
"getaddrinfo failed for api.example.com",
|
||||
])("matches DNS transport failure wording: %s", (errorMessage) => {
|
||||
expect(isRetryableAssistantError(fauxAssistantMessage("", { stopReason: "error", errorMessage }))).toBe(true);
|
||||
});
|
||||
|
||||
it("matches OpenAI Responses streams that end before terminal events", () => {
|
||||
expect(
|
||||
isRetryableAssistantError(
|
||||
|
||||
Reference in New Issue
Block a user