Repository navigation
fix(tb4): score a killed mini-SWE agent as 0 - #5194
Conversation
A mini-SWE run that exits nonzero with a saved trajectory but no exit status was killed mid-run, by the agent's own command or by the per-process OOM killer. The harness reports it as a killed termination, and TB4 scores it 0 without the verifier instead of treating it as an infrastructure error. Signed-off-by: Frederic Lafrance <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
/ok to test 29028a1 |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
HOLD — one BLOCKER and one validation RISK remain.
RISK — Supply benchmark comparison and real-rollout evidence
This changes fixed-benchmark reward and denominator semantics in the killed-agent finalizer, shared by TB4 and Terminal-Bench Science. The PR supplies no before/after profiling numbers and explicitly marks real-model rollout evidence N/A. The deterministic CLI test is useful, but does not establish the aggregate scoring impact or validate the complete model→agent→resources path. The pinned rubric requires profiling evidence for fixed-benchmark reward changes, and the trusted AGENTS quality bar requires representative real smoke rollouts.
Correction: Add matched before/after profiling evidence to the PR: task/model/repeat configuration, mean reward and reward distribution, counted versus excluded rollout totals, and killed-attempt counts. Explain any shift attributable to the intended reclassification. Also provide a representative real-model smoke rollout with inspected agent, verifier, and cleanup artifacts; the live model need not reliably kill itself.
Preservation and acceptance: Normal completed, timeout, and nonzero-exit attempts must retain official verification; true startup/provider failures must remain excluded. Retain the deterministic saved-step kill→completed unmasked zero and no-saved-trajectory→infrastructure cases, and verify that the profiling comparison shows no unexplained changes outside the killed cohort. These are requested checks, not results obtained during this review.
All eight changed files and their directly affected harness, scoring, cleanup, and Harbor episode paths were inspected. Review was source-only; no tests or profiling runs were executed.
Note: formal approval is not available for this request, so this review is posted as a comment only.
Inline comments (escaped v1):
-
responses_api_agents/miniswe_sandboxed_agent/app.pyline 473: BLOCKER — Preserve a confirmed kill when post-exit collection crosses the deadlineA process killed shortly before its execution deadline can still be relabeled
timeouthere.MiniSWEHarness.execute()performs process cleanup and artifact downloads before returning the newkilledoutcome. If those operations finish afterdeadline, this assignment overwrites that outcome. TB4 then takes the ordinary timeout-verification path rather than the unconditional killed-agent zero. For example, an agent can leave a passing artifact, be killed just before its budget expires, and receive a positive verifier reward solely because artifact retrieval was slow. This silently violates the new scoring contract for near-deadline kills.Could you exempt the confirmed
killedoutcome from this post-return timeout normalization? The smallest correction at this condition is:if monotonic() >= deadline and termination.reason != "killed":The invariant is that collection latency cannot turn an already-established kill into a verifier-eligible timeout. This preserves the existing deadline normalization for every other outcome; do not change genuine execution-timeout handling or the no-trajectory infrastructure classification.
Proposed acceptance checks (not executed): In the existing agent/resources integration fixture, have the harness return
HarnessOutcome(reason="killed", exit_code=-9)while advancing a patched clock past the execution deadline, representing delayed post-exit collection. Assert termination remainskilled, reward is0.0, evaluation is completed without an infrastructure marker, and the grader is not awaited. A completed outcome returned after the deadline must still becometimeoutand be verified; retain the existing ordinary-outcome grading assertions and both saved/no-saved-trajectory kill cases.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
The harness reads a kill from an exit code the sandbox returned before the agent deadline. Closing processes and downloading artifacts afterwards can still cross it, which relabeled the kill as a timeout and sent it to the verifier. Signed-off-by: Frederic Lafrance <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Frederic Lafrance <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
/ok to test 95b989a |
|
/review |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP — no remaining eligible findings in this follow-up.
- Prior BLOCKER resolved: deadline normalization now preserves a confirmed
killedoutcome after delayed collection. The new regression test asserts killed → completed zero without verification, while a completed outcome crossing the deadline still becomes a verified timeout. The resources finalizer retains the killed-zero contract and unconditional cleanup. - Prior validation RISK resolved: the PR description now reports matched four-task base/head model runs, per-task outcomes, counted/excluded totals of 3/1 → 4/0, unchanged mean reward of 0.0, one forced-kill attempt per run, and inspected verifier and cleanup behavior. These are author-reported results, not independently reproduced here.
Compared the fixes with the previous-review tree and traced their directly affected execution, scoring, and regression-test paths. No qualifying introduced regression found within the follow-up scope. Review was source-only; no tests or profiling runs were executed.
Review generated by codex. This was a findings-only review. Request a full review with /review reset=true.
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/41143411852 |
When the mini-SWE process is killed mid-run, TB4 now scores the rollout 0 instead of reporting an infrastructure error. The kill can come from a command the agent ran (for example
pkill -f python) or from the kernel's per-process OOM killer (#4650). Until now the harness reported these asinfrastructure_error: mini-SWE produced no trajectory, so they were left out of the pass-rate denominator and retried even though the agent ended its own attempt.exit_statusis reported astermination.reason: killed, with the command's exit code. mini-SWE records an exit status whenever its loop ends, even on an exception, so only a kill leaves a trajectory without one. A run with no saved trajectory (killed before its first step, or failed at startup) is still an infrastructure error. A kill is not relabeled as a timeout when collecting its artifacts runs past the agent deadline: the exit code it is read from came back before the deadline.killedtermination recordsNonZeroAgentExitCodeErrorand a completedreward: 0.0withverifier_result.source: agent_killed. It skips the verifier, as the sandbox resource-limit grade from fix(tb4): grade sandbox resource exhaustion as zero #4733 does.Harbor runs the verifier after a nonzero agent exit. TB4 doesn't for
killed: once the process is gone, a self-kill can't be told apart from a per-process OOM kill, and an OOM is scored 0 without verification, as #4733 does for a sandbox that exceeds its memory limit.Benchmark impact: TB4 and Terminal-Bench Science rollouts that ended with a killed agent now count as 0 in the pass rate instead of being excluded as infrastructure errors.
Compatibility: on the episode-session path (Harbor environment server), a
killedturn is answered instead of refused with a 503, so the environment server verifies it rather than masking it.Issue: none; follow-up to #4650 and #4733.
Rollout evidence: a live TB4 smoke of this PR's head and its base commit, with the same settings: Qwen3.6-35B-A3B through an OpenAI-compatible Responses endpoint, OpenSandbox CPU sandboxes, four CPU tasks with one attempt each, and a 50-step / 1200-second agent cap. A model can't be made to kill itself on demand, so for
html-js-filteronly, a test-only instruction (not part of this PR) was appended to the task prompt: runecho smoke-start, thenkill -9 $PPID. The model followed it in both runs, so mini-SWE saved one step and was then killed.html-js-filter(forced kill)infrastructure_error: mini-SWE produced no trajectory; verifier ran (1/2 tests); excluded from the scorekilled(exit 9); verifier skipped (agent_killed); counted as 0interleaved-vigenerenonzero_exit(step limit); verified, 3/6 tests; 0nonzero_exit(step limit); verified, 1/6 tests; 0telecom-entity-resolutionnonzero_exit(step limit); verified, 5/10 tests; 0completed; verified, 4/10 tests; 0vpp-loss-divergencenonzero_exit(step limit); verified, 4/5 tests; 0nonzero_exit(step limit); verified, 4/5 tests; 0The only classification change is the killed rollout. The other rollouts differ only in what the model did, and each was verified as before. Every session closed its agent, verifier, and log-helper sandboxes with no cleanup errors. The new harness test also runs the real mini-SWE 2.4.6 CLI and has the model's command kill the agent process, both after a saved step and before any step was saved.
🤖 Generated with Claude Code