Skip to content

fix(deepswe): score tests that hit their time limit as unresolved - #6198

Merged
AdamRajfer merged 8 commits into
mainfrom
arajfer/deepswe-test-timeout-zero
Nov 17, 2026
Merged

AdamRajfer merged 8 commits into
mainfrom
arajfer/deepswe-test-timeout-zero

Conversation

@AdamRajfer

@AdamRajfer AdamRajfer commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

When a model's patch makes the DeepSWE tests hang, the verifier records no verdict, so the row stays masked and the run never completes; other SWE verifiers in Gym already score a hanging test command as unresolved. The verifier now runs the tests under GNU timeout inside the sandbox, with the task's limit. If timeout itself stopped the tests, the patch scores 0 and verifier_timeout_s records the limit; a timeout reported only by the sandbox provider, which may mean the command never ran, and a golden patch past the limit stay inconclusive. Unit tests cover each case, the command was checked in the DeepSWE base image, and the reference patches of the two affected tasks finish in under 40 s against the 1800 s limit. Re-verifying five saved model patches that hung real runs gave a graded 0 for all five, in one attempt each, with none masked.

A model patch that hangs the task's tests until the verifier limit was
reported as an inconclusive verifier_error: masked, ungraded, and the
run could not complete. The tests did not pass, so the task is not
resolved; other SWE verifiers in Gym (swe_rebench, swemer) already treat
a confirmed test-command timeout this way.

A sandbox-confirmed deadline on the model's patch now scores 0 and
records the limit in verifier_timeout_s. In golden-patch mode the same
timeout stays inconclusive, since the reference patch must finish.

Signed-off-by: Adam Rajfer <[email protected]>
@AdamRajfer AdamRajfer self-assigned this Nov 14, 2026
@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team November 14, 2026 22:14

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HOLD

One BLOCKER: the new grading branch also accepts provider request timeouts whose command outcome is unknown, turning infrastructure failures into valid zero scores.

I inspected all three changed files and traced how sandbox results become rollout grades. Two delegated reports were unavailable beyond completion status, so I inspected their assigned paths directly. This was a static review; I did not execute tests or replay checks.

Note: formal approval is not available for this request, so this review is posted as a comment only.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

Comment thread resources_servers/deepswe/app.py Outdated
log_dir.mkdir(parents=True, exist_ok=True)
combined_output = (command_result.stdout or "") + (command_result.stderr or "")

if command_result.error_type == "timeout" and not self.config.is_verifying_golden_patch:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BLOCKER: Distinguish command deadlines from provider request timeouts before grading.

With Daytona configured, an SDK error containing only "Failed to execute command:" becomes return_code=124, error_type="timeout", although the adapter explicitly says the command may not have run. See the conversion and its existing regression test. If this happens during bash /tests/test.sh, the new branch reports completion and the full task timeout, and response construction includes the zero in scoring without a failure kind. Previously this stayed masked. OpenShell's gRPC-timeout branch has the same ambiguity. The inherited verifier also exposes this change to DeepSWE external tasks.

Please distinguish confirmed command-budget exhaustion from unknown request outcomes at the sandbox boundary, then require the confirmed case here. Update Daytona's error conversion and OpenShell's RPC-exception path so they cannot satisfy the grading condition. Unknown outcomes must stay inconclusive with verifier_timeout_s=None; checking exit code 124 is insufficient. The shared result encoding needs a compatibility decision, so I cannot provide a safe drop-in patch.

Proposed acceptance checks, not executed: pass Daytona's existing empty-error result through model-mode verification and require evaluation_completed=False, mask_sample=True, and no recorded verifier limit. Cover OpenShell's RPC-deadline result similarly. Retain the new completed, unmasked zero for a confirmed OpenSandbox command deadline, including partial output and one attempt; keep golden deadlines masked. Preserve ordinary artifact-based 0/1 grades, missing-verdict handling, and propagation of unclassified TimeoutError.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, a provider's error_type="timeout" does not prove the tests ran. In 399b223 I no longer read it: test.sh now runs under GNU timeout --verbose with the task's limit, and the sandbox command gets 90 s more. The patch scores 0 only when timeout itself reports that it stopped the tests (exit 124, or 137 after KILL, plus its sending signal TERM notice) and there is no reward.json. A provider timeout, including Daytona's and OpenShell's unknown-outcome cases, stays inconclusive as on main, so I left the provider encodings unchanged. The new tests cover both paths.

@yaoyu-33
yaoyu-33 requested a review from marta-sd November 14, 2026 22:34
A provider's error_type="timeout" does not prove the tests ran: Daytona and
OpenShell report it for requests whose outcome is unknown. Run test.sh under
GNU timeout with the task's limit and score the model's patch 0 only when
timeout's --verbose notice and its exit status (124, or 137 after KILL) show
that it stopped the tests and no reward.json exists. A provider timeout, an
image without timeout and a golden patch past the limit stay inconclusive.

Signed-off-by: Adam Rajfer <[email protected]>
Keep main's provider-timeout case in the artifact test instead of a second
one, drop an unused helper argument, and shorten the README paragraph.

Signed-off-by: Adam Rajfer <[email protected]>

@giuliolovisotto giuliolovisotto left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One blocking issue: the new deadline-to-zero path bypasses configured verification policy and drops the structured failure observation. The inline comment includes a reproduced case.

Comment on lines +528 to +532
return VerifierResult(
evaluation_completed=True,
reward=0.0,
verifier_exit_code=command_result.return_code,
verifier_timeout_s=limit_s,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Apply the shared outcome policy before synthesizing a timeout zero

This branch has no reward.json verdict, but turns the confirmed verification deadline directly into a completed, unmasked zero. That bypasses this server's existing StageOutcomePolicyConfig: I exercised this path with outcome_policy.by_stage.verification.default_action="fail" and got reward=0, evaluation_completed=True, mask_sample=False, failure_outcome_action=None, failure_outcome_attribution=None, and an empty RequestFailureLog. _inconclusive_reason then skips policy selection because this result is already completed. The explicit fail configuration therefore cannot keep this failed verification attempt ungraded, and the counted zero loses its structured failure observation.

Please retain the GNU timeout evidence and provider/golden safeguards, but report the confirmed deadline at the verification boundary and apply an explicit shared policy decision before producing the zero. Extend the supported verification actions/configuration as needed so the intended zero treatment can be configured without hardcoding it in the evidence check. Preserve the applied action/classification and failure observation with the result, including when grading completes successfully. The existing policy documentation describes this separation.

Please cover the configured zero and explicit fail cases, retaining the same deadline observation in both and checking that save/reload preserves the selected action and classification. This does not require introducing a new timeout schema or changing provider error encodings.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Adam’s AI assistant

Fixed. The confirmed deadline is now observed as deepswe:test_deadline at the verification stage, classified as the model's, and the verification policy decides before the zero is produced. Counting it as a zero is this server's default for that kind, so the mean does not change, but those rows now carry the applied action and show up in counted_zeros_in_successful and counted_zero_kinds. Your configuration (by_stage.verification.default_action: fail, and likewise by_failure_class.model: fail) leaves it ungraded and masked, and a by_failure_kind.deepswe:test_deadline rule decides it over everything; retry for that kind is refused at load because a confirmed deadline is never run again. Your configuration is now a test, with the saved row read back from its JSON, and the evidence, failure event and verifier_timeout_s are the same in both cases.

Two small separate commits: the stage policy now accepts only the namespaced kinds a boundary declares (DeepSWE declares this one), and StageOutcomePolicyConfig.overlay keeps a boundary's default classification under a partial override.

…olicy override

StageOutcomePolicyConfig.overlay merged only the stage policies over a boundary's defaults, so an override that touched the classification dropped the boundary's own classification rules.

Signed-off-by: Adam Rajfer <[email protected]>
A model patch whose tests the in-sandbox timeout stopped at the task's limit is observed as the failure kind deepswe:test_deadline at the verification stage, classified as the model's. The verification policy decides: fail leaves the result ungraded and masked, any other action counts the zero. The result saves the applied action and attribution and the failure event either way.

Signed-off-by: Adam Rajfer <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>

# Conflicts:
#	resources_servers/deepswe/tests/test_app.py
@svcnvidia-nemo-ci svcnvidia-nemo-ci added bug Something isn't working area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers labels Nov 16, 2026
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team November 16, 2026 17:40
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the blocked Work cannot move forward until an external dependency is cleared label Nov 16, 2026
@github-actions github-actions Bot added the sla:review-overdue Review response is over the one-business-day SLA label Nov 16, 2026

@giuliolovisotto giuliolovisotto left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the additions at 6a56b44. The policy-bypass finding is addressed: explicit verification fail overrides leave confirmed deadlines ungraded, the counted-zero path retains its structured deadline observation and applied action/classification, and saved rows preserve those decisions. Provider-only timeouts and golden-patch deadlines remain inconclusive.

Validation: 415 tests passed across the DeepSWE and DeepSWE external app suites, shared outcome-policy tests, and rollout-record tests. No new blocking findings.

@AdamRajfer
AdamRajfer added this pull request to the merge queue Nov 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/44073831533

Merged via the queue into main with commit 7416367 Nov 17, 2026
79 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers blocked Work cannot move forward until an external dependency is cleared bug Something isn't working sla:review-overdue Review response is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants