fix retry Codex and OpenAI fetches via proxy-aware helper (#720)

This commit is contained in:
guanjiawei
2026-04-16 21:42:14 +08:00
committed by GitHub
parent d6f5130c20
commit 2ff5710329
5 changed files with 145 additions and 9 deletions

View File

@@ -47,6 +47,7 @@ import {
type AnthropicUsage,
type ShimCreateParams,
} from './codexShim.js'
import { fetchWithProxyRetry } from './fetchWithProxyRetry.js'
import {
isLocalProviderUrl,
resolveRuntimeCodexCredentials,
@@ -1431,7 +1432,7 @@ class OpenAIShimMessages {
const maxAttempts = isGithub ? GITHUB_429_MAX_RETRIES : 1
let response: Response | undefined
for (let attempt = 0; attempt < maxAttempts; attempt++) {
response = await fetch(chatCompletionsUrl, fetchInit)
response = await fetchWithProxyRetry(chatCompletionsUrl, fetchInit)
if (response.ok) {
return response
}
@@ -1504,7 +1505,7 @@ class OpenAIShimMessages {
}
}
const responsesResponse = await fetch(responsesUrl, {
const responsesResponse = await fetchWithProxyRetry(responsesUrl, {
method: 'POST',
headers,
body: JSON.stringify(responsesBody),