fix(ai): retry Cloudflare 520 responses

closes #9627
This commit is contained in:
David Brailovsky 2026-09-17 10:39:48 +02:00
parent 1283afd0d0
commit e5d18382a2
3 changed files with 8 additions and 0 deletions

View file

@ -24,6 +24,7 @@
- Fixed Mistral-hosted GLM-5.2 reasoning requests to use `reasoning_effort` instead of the ignored `prompt_mode` ([#9375](https://github.com/earendil-works/pi/issues/9375)).
- Fixed OpenAI-compatible Responses errors to identify the actual provider instead of always labeling them as OpenAI errors ([#9298](https://github.com/earendil-works/pi/issues/9298)).
- Fixed Baseten requests to send session-affinity headers from `sessionId` for automatic prompt-cache routing ([#9629](https://github.com/earendil-works/pi/issues/9629)).
- Fixed retry classification for Cloudflare 520 responses ([#9627](https://github.com/earendil-works/pi/issues/9627)).
## [0.85.1] - 2026-09-05

View file

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

View file

@ -80,6 +80,12 @@ describe("provider retry classification", () => {
expect(
isRetryableAssistantError(fauxAssistantMessage("", { stopReason: "error", errorMessage: "overloaded_error" })),
).toBe(true);
// Regression for #9627.
expect(
isRetryableAssistantError(
fauxAssistantMessage("", { stopReason: "error", errorMessage: "520 status code (no body)" }),
),
).toBe(true);
expect(
isRetryableAssistantError(
fauxAssistantMessage("", { stopReason: "error", errorMessage: "524 status code (no body)" }),