fix(ai): retry Bun socket drops

closes #6431
This commit is contained in:
Mario Zechner
2026-07-09 11:03:41 +02:00
parent 72d77b53de
commit 4285712bae
4 changed files with 13 additions and 0 deletions
+10
View File
@@ -6,6 +6,8 @@ const openAIExplicitRetryMessage =
"An error occurred while processing your request. You can retry your request, or contact us through our help center at help.openai.com if the error persists. Please include the request ID req_******** in your message.";
const bedrockExplicitRetryMessage =
'{"message":"The system encountered an unexpected error during processing. Try your request again."}';
const bunFetchSocketClosedMessage =
"The socket connection was closed unexpectedly. For more information, pass `verbose: true` in the second argument to fetch()";
describe("provider retry classification", () => {
it("matches explicit provider retry guidance", () => {
@@ -21,6 +23,14 @@ describe("provider retry classification", () => {
).toBe(true);
});
it("matches Bun fetch socket drop wording", () => {
expect(
isRetryableAssistantError(
fauxAssistantMessage("", { stopReason: "error", errorMessage: bunFetchSocketClosedMessage }),
),
).toBe(true);
});
it("keeps provider limit errors non-retryable", () => {
expect(
isRetryableAssistantError(