Skip to content

examples: make the agent-server trial timeout configurable - #2228

Merged
Shi-Dong merged 1 commit into
mainfrom
shi/swe-agent-client-timeout
Aug 6, 2026
Merged

examples: make the agent-server trial timeout configurable#2228
Shi-Dong merged 1 commit into
mainfrom
shi/swe-agent-client-timeout

Conversation

@Shi-Dong

@Shi-Dong Shi-Dong commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Stacked on #1919 — base branch is shi/swe-agent-daytona-example, so review that
one first. This PR's own diff is 2 files, +24/-2.

swe_agent_function.run hardcoded a 3600 s ceiling on the agent-server /run
call, while both READMEs start the agent server with --agent-timeout 5400. The
httpx client is built with timeout=None, so that hardcoded 3600 was the
effective per-trial cap no matter what the server had been configured for — any
--agent-timeout above 3600 was dead configuration.

The inversion costs more than a mislabelled constant. For a trial that runs
between 60 and 90 minutes:

  • the trainer records it as aborted and returns None;
  • the agent server keeps running it, so its sandbox and one --max-concurrent
    slot stay occupied for up to another 30 minutes — on quota-limited sandbox
    backends that is exactly what pushes later trials into create failures;
  • the aborted-sample dynamic filter rejects the whole GRPO group the sample
    belonged to, not just that sample. At --rollout-batch-size 4 one late trial
    removes a quarter of the step's gradient signal.

The ceiling now comes from AGENT_TRIAL_TIMEOUT and defaults to 7200, above the
5400 the examples ship. The agent server's own --agent-timeout is therefore the
one 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-timeout generous.

No new launcher flag: ExecuteTrainConfig already forwards arbitrary env vars to
the 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 --check and isort --profile=black clean
  • AGENT_TRIAL_TIMEOUT unset resolves to 7200; =10800 to 10800; =3600 to
    3600
  • --extra-env-vars 'AGENT_TRIAL_TIMEOUT=10800' parses to
    {'AGENT_TRIAL_TIMEOUT': '10800'}, confirming the knob reaches the rollout
    actors without a dedicated flag
  • Not exercised end to end against a live agent server: reaching the timeout
    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.

Base automatically changed from shi/swe-agent-daytona-example to main August 6, 2026 21:53
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
Shi-Dong force-pushed the shi/swe-agent-client-timeout branch from 1246a63 to f59a73c Compare August 6, 2026 21:53
@Shi-Dong
Shi-Dong merged commit 7cfa842 into main Aug 6, 2026
5 checks passed
@Shi-Dong
Shi-Dong deleted the shi/swe-agent-client-timeout branch August 6, 2026 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants