What happens#
The OpenAI models poll fails outright whenever GET https://api.openai.com/v1/models answers 504 once. PostHog ingest_failed (job models-poll, providerId openai, error fetch failed: https://api.openai.com/v1/models → 504 Gateway Timeout: error code: 504) on 2026-11-17 at 09:00, 10:15, 13:00, 14:15 and 14:45 UTC: 5 of ~24 polls in 6h. Polls in between succeed, so it is a transient upstream 504, not a moved endpoint.
Cause#
listModels in src/server/providers/openai.ts:84 reads the listing with plain fetchJson, no retry. Replicate (#662) and FAL already read their listings through fetchWithRetry (src/server/providers/types.ts:891), which retries RETRYABLE_STATUSES, network failures and timeouts with backoff and still throws after the last attempt (never a partial result).
Fix#
Read the OpenAI listing through fetchWithRetry (same as replicate.ts:542), keeping the Authorization header in the per-attempt init. Still fail loud after the last attempt. Add a test: a 504 then a 200 yields the models; 504 on every attempt throws with the URL.
Fixed by #687 (merged c601bbf), deployed as version 515be829 at 15:17 UTC.