Repository navigation
Conversation
Harness-side model retries may cover only 408, 425, 429, 5xx and transport errors, with a bounded total wait. Claude Code 2.1.108 resends a failed model request ten times, 0.5 s to 32 s apart (160-200 s in all), and treats 401 and 409 like a 5xx: a scripted 401 was sent 11 times over about 180 s. It has no setting that leaves those statuses out, so both launch paths now set CLAUDE_CODE_MAX_RETRIES=0. The Model Server still retries its upstream, and the Environment Server retries the episode after a 408/425/429/5xx. 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 a559edf |
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
The team's rule for harness-side model retries: resend a failed model request only after a 408, 425, 429, 5xx or a transport error, never after any other 4xx, and keep the total wait bounded.
Claude Code 2.1.108 (read from its npm bundle) resends a failed model request ten times, waiting
min(500 ms × 2^(n−1), 32 s)plus jitter, 160–200 s in all. It treats 401 (meant for refreshing an OAuth token orapiKeyHelperkey, but unconditional) and 409 like a 5xx. A scripted-model smoke saw a persistent 401 sent 11 times over about 180 s, and a persistent 503 tried 11 times over about 192 s. The CLI has no setting that leaves statuses out:CLAUDE_CODE_MAX_RETRIESonly sets the count. So both launch paths (host/runand sandbox sessions) now setCLAUDE_CODE_MAX_RETRIES=0: each model request is sent once. The Model Server still retries its own upstream failures (a single upstream 503 is absorbed there; see the smoke), and the Environment Server retries the episode after a 408, 425, 429 or 5xx.One native resend remains, documented in the README: after a 404 when the stream is created, or a stream that fails midway, the CLI sends the request once more without streaming.
Not done here: the CLI honours an
x-should-retry: falseresponse header before its 401/409 rules. A Gym model server that sent that header on every 4xx other than 408/425/429 would let Claude Code (and every OpenAI/Anthropic SDK client) keep a few retries for 5xx while never resending a rejected request. That is a Model Server change and would be its own PR.Issue: no public issue; this implements the retry rule the team agreed for all harnesses. The other harness groups are in separate PRs (Codex; OpenCode and Kilo Code; NOOA, Hermes and Stirrup).
Related: #5910 (NOOA, Hermes, Stirrup), #5911 (Claude Code), #5912 (Codex), #5913 (OpenCode, Kilo Code).
Score and compatibility impact
Validation
claude_code_agent/testson a Linux workstation in the adapter'suv sync --frozenvenv: 197 passed. Both env tests now assertCLAUDE_CODE_MAX_RETRIES=0.pre-commit run --files <changed files>: passed. Commit signed off.Smoke evidence
Scripted-model smoke (no real model), Linux workstation, 2026-11-09. Claude Code is not in the conformance registry, so this uses the chain the outcome-ladder smokes used: a driver seeds and activates an agent session (local sandbox provider, pinned runtime 2.1.108) → Claude Code → a real Gym
vllm_model→ a scripted chat-completions endpoint. A = the outcome-ladder stack (#5873 with #5877, #5875, #5879 and #5880 merged), which carries #5877's Claude Code adapter; B = A plus this commit and the other three retry PRs' commits. The Environment Server action is computed withagent_response_action.model_request_rejected→ failmodel_request_rejected→ failvllm_modeltries), 207 s → failedmodel_request_error503 → retryvllm_modeltries), 1.5 s → samevllm_modelretries it; completed → verify (1.6 s)Real-model rollouts: not run yet; this PR stays a draft until they are.
🤖 Generated with Claude Code