Repository navigation
Description
Client or integration
Codex App (desktop) on Windows 11, sending POST /v1/responses to OpenCodex over loopback HTTP/SSE.
Area
Proxy / routing — upstream HTTP transport, connection-reset handling, providers.<name>.retryOnReset.
Summary
On v2.99.0 I have three providers configured with an identical, explicit opt-in:
"retryOnReset": { "enabled": true, "replacements": 2 }One is the canonical openai provider (adapter: "openai-responses", authMode: "forward"). The other two are key-auth openai-responses providers with a custom baseUrl (no authMode).
For the same kind of failure — the upstream closing the connection before any response byte, recorded as failureStage: "headers-only", failureCause: "transport-ambiguous" — the canonical provider spends the allowance and the key-auth providers never do:
| provider | 429 records today | sendCount |
recoveryKinds |
|---|---|---|---|
canonical openai (forward auth) |
41 | 3 (all 41) | ["connection-reset"] |
key-auth openai-responses A |
49 | 1 (48), 2 (1, ["transient-5xx"]) |
[] |
key-auth openai-responses B |
30 | 1 (all 30) | [] |
Canonical: 41/41 got both replacements. Key-auth: 78/78 got none. The terminal response is the same synthetic 429 upstream_reset_replay_refused in every case, so the client shows exceeded retry limit, last status: 429 Too Many Requests after ~16 s on a key-auth turn and after ~48 s on the canonical one.
This is not a complaint that the proxy refused an ambiguous resend — that fail-closed default is right. It is that an operator who opted in cannot tell why the opt-in did not apply on a non-canonical provider row.
Reproduction
Intermittent in production, deterministic in shape: any pre-header connection reset from a key-auth openai-responses provider reproduces it (0 of 78 such resets today spent a replacement).
The cleanest observation is a single conversationId that was retried alternately between the two provider kinds within 90 seconds, same client, same turn content:
18:24:27 key-auth A 429 sendCount=1 durationMs=15790 recoveryKinds=[]
18:24:43 canonical openai 429 sendCount=3 durationMs=47752 recoveryKinds=["connection-reset"]
18:25:16 key-auth A 429 sendCount=1 durationMs=15782 recoveryKinds=[]
Same conversation, same tool catalog, same body shape; only the provider row differs. Every one of the 120 429 records today has exactly one entry in attempts, so no other leg of the logical request could have spent the request's allowance.
What I verified in the code (so this is not "the config was not loaded")
Reading the installed 2.99.0 sources at D:\DevTools\npm-global\node_modules\@bitkyc08\opencodex and calling the shipped functions under the same bun runtime the service uses:
loadConfig()keepsretryOnReseton all three rows;routedProviderConfig()spreads the row (src/providers/routed-config.ts:113-144,:210+), so the field survives request-time resolution.resetReplayPolicyFor()(src/providers/key-failover.ts:672-682) returns{"enabled":true,"replacements":2}for all three providers — printed by calling it onroutedProviderConfig(name, config.providers[name]). It has no auth-mode gate.- The native Responses passthrough lane passes
claimAmbiguousResend: claimPreHeaderResendon the first send (src/server/responses/passthrough-dispatch.ts:1045-1055), andclaimPreHeaderResendroutes throughauthorizeResendForRecovery("pre-header", "connection-reset", ambiguousResend())(:787-798). fetchWithTransientRetry'sinnerResetOptions()is{...opts, attempts: remaining(), onSendsConsumed: undefined}(src/lib/upstream-retry.ts:846-851), so the callback does reachfetchWithResetRetry.- The send cap is the same for both kinds: neither row sets
transientRetryOn5xx, sotransientSendCapFor(undefined, …)returns the default andinitialSendAllowance()gives the same total;attempt + 1 >= attemptstherefore cannot be what ends the key-auth leg at the first attempt.
That leaves, inside authorizeResend (src/lib/request-resend-gate.ts:102-122), only ambiguous-request-not-replayable (selfContainedResponsesBody(parsed._rawBody) returning false, src/server/responses/reset-replay.ts:62-79) or a call site that ran without the callback installed. Both produce byte-identical telemetry, and src/lib/upstream-retry.ts:703 collapses an absent callback and a gate refusal into the same replayRefusalResponse():
if (attempt + 1 >= attempts || opts.claimAmbiguousResend?.() !== true) {
return replayRefusalResponse();
}Why this is not an existing issue
- [Bug]: Intermittent canonical OpenAI synthetic 429 upstream_reset_replay_refused on v2.91.0; request safe transport mitigation #7720 is the same synthetic 429 on the canonical OpenAI route; here the canonical route behaves as configured and the gap is specific to non-canonical rows.
- [Bug]: translated Responses→chat dispatch never wires claimAmbiguousResend — providers.<name>.retryOnReset cannot take effect and a pre-header reset always answers 429 #6510 was the translated Responses→chat lane never wiring
claimAmbiguousResend(closed, fixed). This is the native same-wire passthrough lane, where the wiring above is present, so the fix there does not cover this. - [Bug] retryOnReset does not replace a native prelude-only clean EOF #8231 is a prelude-only clean EOF, not a connection reset.
- [Bug] Intermittent pooled Codex upstream response.failed 502 surge after v2.80 install (Windows; transport/egress isolated) #6740 (502 surge) and [Bug]: Pooled native Codex requests do not retry or fail over on upstream server_is_overloaded / upstream_server_error before output #6969 (503 failover) are different failure classes.
The 503/502 evidence from the same window, for context
Today (2026-11-09, Asia/Shanghai): 1126 requests, 919 × 200, 120 × 429, 62 × 503, 20 × 502, 5 × 499.
- All 120 × 429 are synthetic
upstream_reset_replay_refused(no upstream 429 was received). - All 62 × 503 are genuine upstream
server_is_overloadedfrom the canonical provider (terminalSource: "upstream"), a separate and real upstream problem. - 20 × 502: 4 genuine upstream
protocol-prelude, 16 synthesized after a mid-stream break (failureStage: "semantic-output"). - Duration histogram of the 429s: 71 records in 12–20 s (single send), 37 in 44–52 s (three sends), each physical send ending at ~15.7–15.9 s.
Asks
- Record the refusal reason per attempt (and whether a callback was supplied), e.g.
resendRefusal: "ambiguous-request-not-replayable"/"ambiguous-no-policy"/"ambiguous-allowance-spent"on the attempt, or at minimum aservice.logline. Right nowgrepoverservice.logandusage.jsonlcannot distinguish "wired but judged not replayable" from "not wired", which is the whole question an operator has when their opt-in produces nothing. - Confirm the intended scope of
retryOnReset: should it apply to key-authopenai-responsesrows? If the body judgment is what refuses these turns, say which predicate failed (store !== false,previous_response_id,stream_id, hosted tool) so operators can shape their client accordingly. - Consider judging
selfContainedResponsesBodyon the outbound body rather thanparsed._rawBody, since this lane rebuilds the body anyway and the inbound one may carry client-only hints that never reach the origin.
Version
OpenCodex 2.99.0 (installed via npm, running src/cli/index.ts under bun 1.4.4). Codex App desktop client.
Operating system
Windows 11 x64
Provider and model
Canonical openai (authMode: "forward") versus two key-auth openai-responses providers with custom baseUrl (names and hosts redacted). Models: gpt-6.1-sol / gpt-6-sol / gpt-6-luna, inboundProtocol: "responses", protocolTrace.mode: "native", streamMode: legacy-tee.
Logs or error output
exceeded retry limit, last status: 429 Too Many Requests
[opencodex] upstream failure code=upstream_reset_replay_refused
Redacted usage.jsonl attempts, canonical versus key-auth, same day:
{"provider":"openai","status":429,"terminalSource":"synthetic","errorCode":"upstream_reset_replay_refused",
"failureStage":"headers-only","failureCause":"transport-ambiguous","durationMs":48950,
"attempts":[{"ordinal":1,"adapter":"openai-responses","sendCount":3,"recoveryKinds":["connection-reset"],
"errorCode":"upstream_reset_replay_refused","failureStage":"headers-only"}]}
{"provider":"<key-auth>","status":429,"terminalSource":"synthetic","errorCode":"upstream_reset_replay_refused",
"failureStage":"headers-only","failureCause":"transport-ambiguous","durationMs":15798,
"attempts":[{"ordinal":1,"adapter":"openai-responses","sendCount":1,"recoveryKinds":[],
"errorCode":"upstream_reset_replay_refused","failureStage":"headers-only"}]}Redacted configuration
{
"providers": {
"openai": {
"adapter": "openai-responses",
"authMode": "forward",
"retryOnReset": { "enabled": true, "replacements": 2 }
},
"<key-auth-provider-a>": {
"adapter": "openai-responses",
"baseUrl": "https://<redacted>",
"retryOnReset": { "enabled": true, "replacements": 2 }
},
"<key-auth-provider-b>": {
"adapter": "openai-responses",
"baseUrl": "https://<redacted>",
"retryOnReset": { "enabled": true, "replacements": 2 }
}
}
}Checks
- I searched existing issues and documentation.
- I removed secrets, tokens, account details, request credentials, and personal data.
Activity
fix(responses): let retryOnReset replace chained native turns (#8486)
fix(responses): report the WS frame that actually left to the replay …
docs(responses): document upload-reduction edges from the merge review