Repository navigation
Conversation
…el requests Harness-side model retries may cover only 408, 425, 429, 5xx and transport errors, with a bounded total wait. Three adapters broke that in loops Gym controls: - NOOA: CodeAct calls the model again after any error, up to its consecutive-error limit, so a 400 or 401 was sent ten times. Gym's model client now remembers a 4xx other than 408/425/429 and fails every later call of the rollout with it before sending anything. A context-window 400 is left alone: NOOA archives events and shrinks the reply budget, so its next request is smaller. - Hermes (pinned 26bb847a): its loop treats every OpenAI SDK 400 as a transient "generic 400" (it reads the message one level deeper than the SDK keeps it) and resends it three times; the SDK under it also resends 409. The SDK's own retries are off now, and a 4xx other than 408/413/425/429 reaches Hermes as a ValueError, which it does not retry. The sandboxed adapter (Hermes v0.21.1) sets agent.api_max_retries to 1. - Stirrup: the OpenAI SDK client resent a 409 and followed a Retry-After of up to 60 s per retry. Gym's client now resends only 408, 425, 429 and 5xx and waits at most 10 s before each of its two retries. 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 960f60f |
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. The Model Server already retries its own upstream, and the Environment Server retries the episode after a retryable failure. Scripted-model smokes found three adapters breaking the rule in retry loops that Gym controls:
19caab16) calls the model again after any error, up to its consecutive-error limit; onlyReasoningReplayErrorescapesgym_llmremembers a 4xx other than 408/425/429 and fails every later call of the rollout with the same error before sending anything. A context-window 400 is left alone: NOOA archives events and shrinks the reply budget, so its next request is smaller.hermes_agent, pinned26bb847a)_is_generic_400readsbody["error"]["message"], but the OpenAI SDK has already unwrapped the body, so every SDK 400 counts as a transient "generic 400"install_model_retry_policy: the SDK's own retries are off (max_retries=0, which every per-request client copies), and a 4xx other than 408/413/425/429 reaches Hermes asModelRequestRejected, aValueErrorthat keeps the SDK error's text, status, body and response. Hermes ends the run on aValueErrorafter its context-length and 413 compression checks, so those still compress and resend a smaller request. Installed on the host and sandbox paths and on delegated children.hermes_sandboxed_agent, Hermes v0.21.1)Retry-Afterhonoured up to 600 sagent.api_max_retries: 1(Hermes's own setting; 1 = one attempt). Compression restarts leave the retry loop and start a new count, so they are unaffected.Retry-Afterup to 60 smax_retries=2); Gym's client overrides Stirrup's own tenacity-wrappedgenerateAsyncOpenAIsubclass that resends only 408, 425, 429 and 5xx (and, as before, connection errors), and caps each wait at 10 s, so its two retries wait at most 20 s.The rule is Gym's existing
is_retryable_dependency_status(408, 425, 429, 5xx) wherenemo_gymis importable; Stirrup's in-sandbox runner and Hermes's stdlib-only helper spell out the same set.Issue: no public issue; this implements the retry rule the team agreed for all harnesses. The other harness groups are in separate PRs (Claude Code, Codex, OpenCode and Kilo Code).
Related: #5910 (NOOA, Hermes, Stirrup), #5911 (Claude Code), #5912 (Codex), #5913 (OpenCode, Kilo Code).
Score and compatibility impact
model_rejectedtermination for NOOA) is unchanged, so the Environment Server takes the same action, sooner.MODEL_REJECTED). A 408 or 5xx still recovers.Validation
Linux workstation, each adapter's own
uv sync --frozenvenv, from the repository root:nooa_agent/tests: 786 passed. 1 failed,test_runtime_installer.py::test_warm_check_uses_private_scratch_without_writing_read_only_runtime, only because the run'sTMPDIRwas on/dev/shm; withTMPDIRelsewhere that file passes (10 passed).hermes_agent/tests: 387 passed (the real pinned Hermes runtime: a 400, 401, 404, 409 and 422 each reach the model server once).hermes_sandboxed_agent/tests: 82 passed.stirrup_agent/tests: 190 passed (anhttpx.MockTransportcounts the requests: 400/401/404/409/422 sent once; 408, 425, 429, 500, 503 sent three times;Retry-After: 60waits 10 s).test_model_rejection_preserves_original_provider_error,test_model_rejection_obeys_environment_policy_and_closes,test_worker_result_and_checkpoint_preserve_model_status,test_successful_model_retry_clears_rejection(now split into a 408/503 recovery test and a 4xx sent-once test); Hermestest_sandbox_rejection_preserves_runtime_token_totals.pre-commit run --files <changed files>: passed. Commits are signed off.Smoke evidence
Scripted-model smoke (no real model), Linux workstation, 2026-11-09, with the harness-conformance runner, one job at a time:
model_error(persistent 400),model_401,model_503,retry_429(two 429s, then success),retry_500(one 500, then success),context_overflow. The scripted endpoint answers every error withRetry-After: 0.ng_agent_outcome→ Environment Server action.model_errormodel_request_rejected→ failmodel_401model_request_rejected→ failmodel_503model_request_error503 → retryretry_429,retry_500context_overflowmodel_errormodel_request_rejected→ failmodel_401model_request_rejected→ failmodel_503model_request_error503 → retryretry_429,retry_500retry_42910.1 s instead of 5.0 s: Hermes's own 2 s and 4 s waits replace the SDK's immediate resends)context_overflowEvery P0 check passes on B for NOOA, Hermes and Stirrup in all six scenarios.
hermes_sandboxed_agentis not in the conformance registry and was not smoked.Real-model rollouts: not run yet; this PR stays a draft until they are.
🤖 Generated with Claude Code