diff --git a/internal/gateway/codex_backend.go b/internal/gateway/codex_backend.go index 0f984fa30..5b76cbd04 100644 --- a/internal/gateway/codex_backend.go +++ b/internal/gateway/codex_backend.go @@ -1205,6 +1205,19 @@ func (s *Server) codexUpstreamOn(w http.ResponseWriter, r *http.Request, rest st sent = provider.CodexCompressed(req, body) if res, err = s.client.Do(req); err != nil { msg := "OpenAI: " + err.Error() + if overload && busyAgain < lastRetries && droppedUnanswered(r.Context(), err) { + // the connection closed with nothing of a reply (a + // proxy's or ChatGPT's front's "EOF" on a fresh + // connection, which Go doesn't send again by itself): + // asked again after a moment on a new one, as the + // accounts loop asks its last account again after the + // same 502 (aetrox333 on Discord: gpt-6-luna failed + // in 43ms every time, auto/gpt-6-luna never) + if !askAgain(502, msg, retryPause<