Repository navigation
Conversation
Harness-side model retries may cover only 408, 425, 429, 5xx and transport errors, with a bounded total wait. Codex 0.144.4 has no per-status setting: its turn-level retry resends every status but 400, 429 and 500 five more times (a scripted 401 was sent six times), a persistent 503 cost 30 requests and about 25 s, and it never reads Retry-After. Gym's forwarder already sits in front of Codex in every sandbox session and in host runs with a rollout and a model server, so it now owns the rule: - request_max_retries and stream_max_retries default to 0 there (an explicit value still wins); - the forwarder (transport.py on the host, sandbox_launcher.mjs in the sandbox) resends a 408, 425, 429 or 5xx and a refused or dropped connection at most twice, waiting Retry-After capped at 10 s, else 1 s and 2 s; every other status reaches Codex on the first attempt; - the forwarders are renamed for what they now do. A stream that drops after its headers is no longer resent; Gym model servers send the whole stream at once. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
This was referenced Nov 10, 2026
Contributor
Author
|
/ok to test dd402e7 |
Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Contributor
Author
|
/ok to test cd81c82 |
Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Codex 0.144.4 has no per-status retry setting. Its turn-level retry (
stream_max_retries, default 5) resends failed requests for statuses other than 400 and 429, including 500. Its request-level retry (request_max_retries, default 4) also resends 5xx and transport errors. A persistent 401, 409 or 422 therefore costs six requests, while a persistent 500 or 503 can cost 30. It never retries a 429 or readsRetry-After.Gym's existing forwarders now own the harness retry rule:
nullCodex retry settings become 0/0; explicit values remain unchanged.Retry-Afterup to 10 seconds, otherwise wait 1 and 2 seconds.model_retry_proxyandmodelRetryProxy.The host path is retained, including its shorter recovery window described below. The review fixes also repair the renamed import in the core keepalive-report tests and add boundary coverage and pinned-CLI cleanup.
Issue: no separate issue is needed; this implements the team's retry rule across harnesses. Related retry PRs: #5910, #5911 and #5913. This preserves the Node launcher/attempt-record boundary introduced in #5153.
Score and compatibility impact
codexandcodex_deepseek_flash, now interpretnullretries as 0/0. They no longer inherit Codex's request/stream defaults.response.incompleteends the turn as gradedincomplete. Codex no longer resamples the model aftermax_output_tokens, which can change benchmark scores.response.failedevent is not resent by the forwarder. Gym model servers can emit failures inside 200 streams for non-HTTP failures or afterstream_keepalive_sopens the stream. The default session outcome policy retries the episode for infrastructure failures. The TB-Science DeepSeek keepalive preset can therefore repeat hours of preceding task work instead of resending one model request./run: it already sends an empty assistant response to verification when Codex fails, which can score 0. The shorter retry window can expose an outage of a few seconds to that behavior sooner. It has the shared client's connection timeout (from fix(client): bound retries between Gym servers and the TCP handshake #6013), but no per-request header/body idle deadline; the overall agent timeout still bounds the run. Session infrastructure-failure classification is preferred.++tbsci_codex_stream_max_retries=5restores Codex's turn resends, including rejected 4xx requests and output-cap resampling. Request retries above 0 multiply the forwarder's attempts.Validation
Workstation: Python 3.13.15, aiohttp 3.14.4, Node 22.22.2, Codex 0.144.4; dependencies synced with
uv sync --python 3.13 --frozenfrom the adapter directory (uv 0.13.7).CODEX_TEST_BIN=<pinned 0.144.4> RAY_TMPDIR=/tmp responses_api_agents/codex_agent/.venv/bin/python -m pytest responses_api_agents/codex_agent/tests tests/unit_tests/core/test_streamed_failure_reports.py -q: 644 passed, no skips, one dependency deprecation warning, 114.30 seconds. Includes output-cap forwarder/no-forwarder variants, actual HTTP transport and Retry-After tests, caller cancellation, and core keepalive failure-report propagation.pre-commit run --files <12 touched files>: passed.node --check responses_api_agents/codex_agent/sandbox_launcher.mjsandgit diff --check: passed.rate_limit_proxyorrateLimitProxyreferences.b06f0245b70939517f8897fcbd2eef0658e6a948was merged first; merge and repair commits have DCO sign-off. No rebase or force-push.Exact commands, logs, review dispositions and diff:
/home/yuya/Projects/pr-flow/runs/20261117-011429-pr5912-fix(machine-local). CI is requested separately for the pushed head; no full-repository CI pass is claimed.Smoke evidence and remaining gate
The earlier scripted-model conformance comparison used Codex 0.144.4, the outcome-ladder stack (#5873, #5877, #5875, #5879, #5880), and this PR together with the other retry PRs. These are historical results from 2026-11-09, not validation of this repaired head:
model_401model_503model_error(400)retry_429,retry_500context_overflowThat scripted endpoint used
Retry-After: 0and did not cover keepalive or output caps. Fresh real-model rollouts remain required at the smoke stage: session presets, output-cap outcomes, episode retries whose last model attempt was HTTP 200, and request counts per failed call. The PR remains a draft until that evidence is attached.