Repository navigation
fix(openclaw_agent): report Gym-enforced timeouts as not finished naturally - #4234
Draft
giuliolovisotto wants to merge 2 commits into
Draft
giuliolovisotto wants to merge 2 commits into
giuliolovisotto wants to merge 2 commits into
Conversation
…urally When the OpenClaw CLI hit setup_timeout (onboard) or timeout (agent run), the agent salvaged the partial session or padded an empty assistant message, so run() reported finished_naturally=True, the same as a normal finish. Carry the timeout from _run_openclaw to the response metadata (openclaw_agent_timed_out="true", only set on timeout) and have run() report finished_naturally=False plus an explicit agent_timed_out flag. The salvaged/padded output, what gets verified and the reward are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Giulio Lovisotto <[email protected]>
…nse key Replace the openclaw_agent_timed_out response metadata with an internal _ng_agent_timed_out key, set only when setup_timeout or timeout fired. run() pops it from the /v1/responses JSON before calling /verify, so the verify payload is the same as before this change, matching how opencode_agent carries its timeout. finished_naturally and agent_timed_out are reported as before. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Giulio Lovisotto <[email protected]>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
This branch has not been 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 does this PR do?
openclaw_agentruns theopenclawCLI as a subprocess under two Gym-enforced limits:setup_timeoutforopenclaw onboardandtimeoutforopenclaw agent. When either limit fires, the agent keeps the rollout scoreable: on an agent-run timeout it salvages the partial session from disk, and on a setup timeout it pads an empty assistant message. In both cases the output still ends in an assistant message, sorun()reportedfinished_naturally=True, which made a timed-out rollout look the same as a normal finish.This PR:
timed_outflag from_run_openclaw(set when the agent-runtimeoutfires) and sets it in_create_responsewhen the setup timeout propagates;/v1/responsestorun()as an internal response key,_ng_agent_timed_out, set only on timed-out runs. This follows how the agent already passes_ng_agent_observations, and matches the timeout fix foropencode_agent(fix(opencode): align timeout completion status #4233);run(), removes that key from the response before calling/verify, reportsfinished_naturally=Falsefor those runs and adds an explicitagent_timed_out: boolto the verify response. The name matchesanyterminal_agent,anyswe_agentandswe_agents.The salvaged or padded output, the
/verifypayload, and the reward are unchanged. OpenClaw's own internal idle watchdog is out of scope.Related: #2831, #3182 (rollout observability / error-recovery signals). No dedicated issue: this is a small reporting fix.
This will conflict with draft #3637 (OpenClaw in native task sandboxes); whichever lands second rebases.
Validation
pytest responses_api_agents/openclaw_agent/tests(worktree dev venv): 67 passed.ng_test +entrypoint=responses_api_agents/openclaw_agent(same command CI runs for changed servers): passed.TestTimeoutReportingtests driverun()end-to-end with a mocked subprocess (_run_exec) for a natural finish, an agent-run timeout and a setup timeout. They checkfinished_naturally,agent_timed_out, the unchanged reward, that the salvaged/padded output is what gets verified, and that/verifyreceives neither the internal key nor any timeout metadata. Without the fix, both timeout tests fail withfinished_naturally is True.pre-commit run --all-files: passed.Rollouts
N/A: this changes only how a timed-out run is reported (
finished_naturally,agent_timed_out). Agent behavior, the output items and the verifier are untouched. The timeout paths are covered with a mocked subprocess, because reproducing them against a real model would only mean waiting for a limit to expire.Compatibility and benchmark impact
finished_naturallychanges fromTruetoFalsefor rollouts that hitsetup_timeoutortimeout. Any aggregate offinished_naturallyfor OpenClaw runs drops by the timed-out fraction.agent_timed_out(defaultFalse)._run_openclaw(private) now returns a 4-tuple. No callers outside this module.Checklist
pre-commit run --all-files) (so CI lint/format checks pass).git commit -s) (so the DCO check passes).🤖 Generated with Claude Code