examples: make the agent-server trial timeout configurable - #2228
Merged
Conversation
nblintao
approved these changes
Aug 6, 2026
7 tasks
swe_agent_function.run hardcoded a 3600s ceiling on the /run call while the agent server is started with --agent-timeout 5400, so 3600 was the effective per-trial cap no matter what the server had been told. The httpx client is built with timeout=None, so nothing else bounded the call. The inversion is expensive. A trial running between 60 and 90 minutes is recorded as aborted by the trainer while the agent server keeps working on it: its sandbox and one --max-concurrent slot stay occupied for up to another 30 minutes, and because the aborted-sample filter rejects the whole group, one late trial discards its entire GRPO group rather than just itself. Read the ceiling from AGENT_TRIAL_TIMEOUT and default it to 7200, above the 5400 the examples ship, so the agent server's own timeout fires first and tears the trial down itself. The client ceiling is now only a backstop for a server that has become unreachable. No new launcher flag is needed: ExecuteTrainConfig already forwards arbitrary env vars to the rollout actors via --extra-env-vars.
Shi-Dong
force-pushed
the
shi/swe-agent-client-timeout
branch
from
August 6, 2026 21:53
1246a63 to
f59a73c
Compare
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.
Summary
Stacked on #1919 — base branch is
shi/swe-agent-daytona-example, so review thatone first. This PR's own diff is 2 files, +24/-2.
swe_agent_function.runhardcoded a 3600 s ceiling on the agent-server/runcall, while both READMEs start the agent server with
--agent-timeout 5400. Thehttpx client is built with
timeout=None, so that hardcoded 3600 was theeffective per-trial cap no matter what the server had been configured for — any
--agent-timeoutabove 3600 was dead configuration.The inversion costs more than a mislabelled constant. For a trial that runs
between 60 and 90 minutes:
None;--max-concurrentslot stay occupied for up to another 30 minutes — on quota-limited sandbox
backends that is exactly what pushes later trials into create failures;
belonged to, not just that sample. At
--rollout-batch-size 4one late trialremoves a quarter of the step's gradient signal.
The ceiling now comes from
AGENT_TRIAL_TIMEOUTand defaults to 7200, above the5400 the examples ship. The agent server's own
--agent-timeoutis therefore theone that fires first, and it tears down its own trial and releases the sandbox;
the client ceiling is only a backstop for a server that has become unreachable.
The README records that ordering requirement, which it previously contradicted by
telling users to keep
--agent-timeoutgenerous.No new launcher flag:
ExecuteTrainConfigalready forwards arbitrary env vars tothe rollout actors, so the knob is reachable as
python examples/swe-agent/run.py ... --extra-env-vars 'AGENT_TRIAL_TIMEOUT=10800'The mismatch was reported by nblintao while reviewing #1919.
Test plan
black==24.3.0 --line-length 119 --checkandisort --profile=blackcleanAGENT_TRIAL_TIMEOUTunset resolves to 7200;=10800to 10800;=3600to3600
--extra-env-vars 'AGENT_TRIAL_TIMEOUT=10800'parses to{'AGENT_TRIAL_TIMEOUT': '10800'}, confirming the knob reaches the rolloutactors without a dedicated flag
path now requires a trial longer than two hours. The default is a strict
relaxation of the previous hardcoded value, so existing runs can only stop
aborting trials they used to abort.