fix(ai): retry Cloudflare 524 timeouts
Some checks are pending
CI / build-check-test (push) Waiting to run

closes #6239
This commit is contained in:
Vegard Stikbakke 2026-07-03 23:03:35 +02:00
parent 8133c94db9
commit d53b567601
3 changed files with 7 additions and 0 deletions

View file

@ -11,6 +11,7 @@
- Fixed Amazon Bedrock prompt-cache points for Claude Fable 5 and Claude Sonnet 5 ([#6235](https://github.com/earendil-works/pi/issues/6235)). - Fixed Amazon Bedrock prompt-cache points for Claude Fable 5 and Claude Sonnet 5 ([#6235](https://github.com/earendil-works/pi/issues/6235)).
- Fixed DS4 server context overflow detection for `Prompt has ... tokens, but the configured context size is ... tokens` errors ([#6262](https://github.com/earendil-works/pi/issues/6262)). - Fixed DS4 server context overflow detection for `Prompt has ... tokens, but the configured context size is ... tokens` errors ([#6262](https://github.com/earendil-works/pi/issues/6262)).
- Fixed OpenAI Codex WebSocket sessions to rotate cached connections before the backend's 60-minute limit, avoiding connection-limit failures on long sessions ([#6268](https://github.com/earendil-works/pi/issues/6268)). - Fixed OpenAI Codex WebSocket sessions to rotate cached connections before the backend's 60-minute limit, avoiding connection-limit failures on long sessions ([#6268](https://github.com/earendil-works/pi/issues/6268)).
- Fixed retry classification for Cloudflare 524 timeout responses ([#6239](https://github.com/earendil-works/pi/issues/6239)).
### Added ### Added

View file

@ -33,6 +33,7 @@ const RETRYABLE_PROVIDER_ERROR_PATTERN = buildProviderErrorPattern([
"502", "502",
"503", "503",
"504", "504",
"524",
"service.?unavailable", "service.?unavailable",
"server.?error", "server.?error",
"internal.?error", "internal.?error",

View file

@ -33,6 +33,11 @@ describe("provider retry classification", () => {
expect( expect(
isRetryableAssistantError(fauxAssistantMessage("", { stopReason: "error", errorMessage: "overloaded_error" })), isRetryableAssistantError(fauxAssistantMessage("", { stopReason: "error", errorMessage: "overloaded_error" })),
).toBe(true); ).toBe(true);
expect(
isRetryableAssistantError(
fauxAssistantMessage("", { stopReason: "error", errorMessage: "524 status code (no body)" }),
),
).toBe(true);
expect(isRetryableAssistantError(fauxAssistantMessage("not an error"))).toBe(false); expect(isRetryableAssistantError(fauxAssistantMessage("not an error"))).toBe(false);
}); });
}); });