Repository navigation
fix(swe_agents): mask verified runtime startup failures - #4034
linj-glitch wants to merge 8 commits into
Conversation
c5e79f9 to
dd530f8
Compare
When the OpenHands action-execution server (the process that runs the agent's commands inside the container) exits under the agent, OpenHands' local runtime raises "Server process died" and the episode ends with an error such as "AgentRuntimeDisconnectedError: Server process died". _classify_agent_error bucketed that as "other", so the rollout was scored as a genuine task failure (reward 0, not masked) although the policy did nothing wrong. It is an infrastructure failure like the OOM kills and timeouts that are already masked. In one internal GRPO run it hit 5 of 256 rollouts in a single step and none in the neighbouring steps, i.e. bursts of spurious zero rewards. Classify it as "runtime_died" and add it to the mask_sample condition. Signed-off-by: Lin Jia <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
dd530f8 to
cff8bc5
Compare
|
/ok to test cff8bc5 |
|
does your cover #4002 ? or we still need separate? |
alexandery-nvidia
left a comment
There was a problem hiding this comment.
Approving from the training-consumer side; this is the one Lin flagged for Ananth's eligibility call.
Masking an infrastructure death instead of scoring it matches how the trainer treats infra failures, and I traced the flow at the head: the flag lands on the top-level mask_sample of the verify response (the BaseVerifyResponse contract field) with the instance_config copy kept for one release, which is exactly the pair NeMo RL's collector reads. Ran responses_api_agents/swe_agents/tests/test_app.py at the PR head locally: 188 passed, 0 failed, including the three new tests. Two notes: the branch now conflicts with main in app.py and tests/test_app.py (merged #4002 extended the same masking condition), so it needs a rebase that merges the two condition lists; and one training-side consideration inline.
|
Thanks, masking genuine runtime crashes makes sense. One concern: the agent runs under - @claude |
Signed-off-by: Lin Jia <[email protected]>
|
Addressed the timeout-classification concern in 7d41829: a runtime-death error at or after swebench_agent_timeout now stays On the #4002 question: that PR is now merged, and this head retains its evaluator-launch-failure mask condition and regression coverage. Runtime death and evaluator launch failure remain distinct cases. The separate concern about an agent causing its own runtime death is still an eligibility-policy question; the timing guard does not establish causality. That thread remains open for Ananth’s review. No fresh live-model rollout was run for this update. |
Signed-off-by: Lin Jia <[email protected]>
Signed-off-by: Lin Jia <[email protected]>
Signed-off-by: Lin Jia <[email protected]>
|
/ok to test e8e96b7 |
Signed-off-by: Lin Jia <[email protected]>
|
/ok to test e635a6d |
Signed-off-by: Lin Jia <[email protected]>
|
/ok to test 1ac9354 |
Signed-off-by: Lin Jia <[email protected]>
|
/ok to test 65b550c |
giuliolovisotto
left a comment
There was a problem hiding this comment.
Re-reviewed the runtime-startup masking path. My earlier timeout-classification concern is addressed: reaching the agent budget does not establish a spontaneous runtime failure. The new mask requires host-observed pre-execution evidence; absent, disconnected, stale or post-execution evidence remains unknown.
Validation at 65b550c94b266035f85ecd54897be8e6611be153: 15 Linux observer subprocess tests passed, covering setup, signals, missing/stale observation, retries and capture-overlay preservation. Application tests: 216 passed; two process-kill tests could not run successfully on macOS because they require /proc. The changed timeout/masking and forged-metrics tests passed.
No new live Apptainer/model rollout or full CI run. Existing timeout/OOM masking policy is unchanged and remains separate follow-up work.
— @codex
What does this PR do?
Mask only verified OpenHands runtime startup failures.
Server process diedalone cannot distinguish infrastructure faults from agent commands that kill or exhaust the runtime.For the pinned OpenHands revision
54d2a95edc666551b854a7e5d4205ec69e60ff23, a host-owned observer tracks the controller and every runtime process by run nonce, peer PID, and process start time. Controller/runtime audit hooks acknowledge executable setup before it runs; policy actions are acknowledged before dispatch. Once execution starts, retries cannot reset that state. Eligibility crosses Ray as trusted return metadata; agent-writable metrics cannot forge it.A normal Python startup/import failure before any executable setup or action can receive
runtime_death_cause: pre_executionand be masked. Missing or disconnected observation, stale identities, unobserved retries, refused instrumentation, SIGKILL/segfault, other OpenHands revisions, and every post-execution death remainunknownand scored unless an independent mask applies. Broader post-action attribution would require trusted OS/provider termination evidence that this runtime does not expose. The deadline guard and existing timeout/OOM/evaluator masks remain unchanged. There is no broad runtime-death masking option.No separate issue is needed: this addresses the review's concern that automatic masking could discard negative policy feedback. Compared with unconditional runtime masking, more ambiguous episodes remain in training; benchmark rewards are unchanged.
Validation
Head
65b550c94b266035f85ecd54897be8e6611be153additively merges main166af7d0d2aeeb2c645019b88c9210f25405199eto include the upstream colored R2E assertion repair. All six PR-specific files are byte-identical to1ac9354a583c0a0cde33c02afd86a7527ee97e8e; the remaining merge changes match main. Python 3.13.14 imports were asserted to resolve to this checkout for Gym, SWE, and AnySWE.PY_COLORS=1 python -m pytest -q -o addopts= --import-mode=importlib responses_api_agents/swe_agents/tests responses_api_agents/anyswe_agent/tests: 325 passed, including the colored R2E regression. The runner disables editable-package redirects before asserting source paths.detect-secrets==1.5.0over all six changed files: passed; the prior finding was the public OpenHands revision constant, now annotated on that line only, with no scanner configuration or baseline change. The Python AST is unchanged.pre-commit run --all-files, complete PR-diff/body guardword scans, and PR-diff whitespace checks against main: passed. An inherited main fixture has a trailing blank line when comparing the merge against the old branch; it is unchanged from main and outside this PR diff.Rollouts
The earlier bounded real Apptainer/OpenHands/Qwen3-1.7B smoke, using the runtime-entrypoint fix published as
e635a6d7e291d42b5f9fa58ef8e6553e97369504, onpsf__requests-1766authenticated both controller and runtime, observed both coverage-ready events and executable setup, and completed one genuine model call. It retainedruntime_death_cause: unknown; the existing one-turn limit caused the normalmax_iterationmask. No patch was produced, so this is lifecycle/model wiring evidence, not patch-grading evidence. The separate lifecycle regressions execute real local Python processes and include the positive pre-execution-failure case. The live smoke was not repeated for this main merge; the six PR-specific files are unchanged from the prior head.Checklist
Required current-head CI and maintainer approval remain merge gates.