listModels in src/server/providers/openai.ts read GET /v1/models with plain fetchJson, so one upstream 504 failed the whole OpenAI models poll (5 of ~24 polls on 2026-11-17).
It now reads the listing through fetchWithRetry, as Replicate and FAL do: retryable statuses, network failures and timeouts are retried with backoff (default 5 attempts), the Authorization header is built per attempt, and it still throws with the URL after the last attempt.
Tests in openai.test.ts: a 504 then a 200 yields the models; a 504 on every attempt throws fetch failed after 5 attempts: <url> → 504 Gateway Timeout.
No changeset: nothing under packages/* changed.
Summary by CodeRabbit#
- Bug Fixes
- Improved reliability when retrieving available models from OpenAI: temporary gateway timeouts are retried before the request fails.
- When repeated timeouts prevent model retrieval, the resulting error now includes the models endpoint and the final response status.
No actionable comments were generated in the recent review.
Walkthrough
The OpenAI provider now fetches the models listing with
fetchWithRetry, supplies bearer authorization, and parses the response asOpenAiModelList. Tests cover a successful retry after a 504 response and an error after five consecutive 504 responses.Changes: OpenAI model listing
src/server/providers/openai.ts,src/server/providers/openai.test.tslistModelsusesfetchWithRetrywith the bearer authorization header and parses the listing response. Tests verify that a 504 is retried with authorization on both attempts, and that five consecutive 504 responses produce an error containing the models URL and final status.Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Merge Risk:
Minimal · up to
d40a3This change makes the OpenAI models listing retry after transient gateway timeouts. No actionable merge-blocking risk was found, and the new tests cover both the successful retry and the repeated-failure case.
Pre-merge checks:
4
Full details: Title check
Explanation
The title states the main change: the OpenAI models listing now retries on a transient 504. The raw summary confirms listModels switched from fetchJson to fetchWithRetry, and the new tests cover a 504 followed by success and repeated 504 failures. The title is specific and matches the changeset, so it passes.
Finishing Touches
Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Share
c967a0a2-801f-40ec-aa54-5a92d3734c86Reviewing files that changed from the base of the PR and between 921aa0f1a88f77c24d9b4607e87d7868b701a8c0 and d40a33720d9d9bf5c6b1e75872ee756fc767e0ad.
src/server/providers/openai.test.tssrc/server/providers/openai.tsIncluded review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.