Repository navigation
fix(critpt_custom_grader): masked verdicts, scored wall-clock stops, continue after out-of-memory - #6808
Conversation
… and grade wall-clock stops Unscored verdicts no longer write rollout collection's _ng_failure_* keys, which collection refuses in an Environment Server's result. They are masked results that name failure_kind and failure_reason and record failure_outcome_action: fail for a terminal category, retry otherwise. An episode stopped at the agent's wall-clock limit without an accepted answer is now a scored no-answer, like the turn limit. Signed-off-by: gwarmstrong <[email protected]>
…continue in a fresh sandbox An OpenSandbox container is OOM-killed as a unit, so one code_exec command that exceeds the execution sandbox's memory limit ends the sandbox. The grader reported that as an infrastructure failure (HTTP 503), Stirrup failed the episode, and recovery ran the episode again from the start. The provider confirms these deaths as provider_oom_killed, which Gym's agent outcome policy already treats as the model's result rather than a provider fault. The grader now answers such a command with an out_of_memory tool result, replaces the sandbox, and lets the episode continue; files from earlier commands are gone, and the message says so. Other execution failures still end the episode as before. Signed-off-by: gwarmstrong <[email protected]>
…etry ended-sandbox deletes Follow-ups to the masked-result and out-of-memory changes: - A no-answer at the agent's wall-clock limit stays scored as the model's result, but carries failure_kind agent_timeout and model attribution with no outcome action, as gdpval does. Gym's recovery can then run again a timeout whose window held a model-server, sandbox or tool-server fault, instead of counting it as a wrong answer. - A single finish the tool accepted before a wall-clock stop is graded. The stop can land while sibling calls of the finishing response still run. A turn-limit stop with an accepted finish is still contradictory evidence. - When deleting a sandbox the memory limit ended fails, the session keeps it and closing the session retries the delete, so its provider record is not left behind until its TTL. - README: the verify contract of scored rows, when resume keeps a response_incomplete row, that a verifier_error row stops resubmit --recover, and that --rerun-masked-without-artifact also re-runs provider_unavailable rows. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Igor Gitman <[email protected]>
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
HOLD
I found one BLOCKER and three RISKs across the seven changed files and their callers. The collector-field change fixes the reserved-key rejection, but the wall-clock scoring change can silently score an accepted finish as a no-answer. Inline findings cover that defect, OOM cancellation handling, and the recovery example.
RISK: Add the required before/after reward profile
Could you add comparable reward-profile numbers for the CritPt v2 settings exercised here? The PR reports 5,250 episodes, nine wall-clock stops and 49 OOM-affected episodes, but no before/after mean pass@1 or scored/masked denominators. The wall-clock scoring change changes zero-score assignment, and OOM continuation changes which trajectories get resampled. Event counts show those paths ran; they do not show whether reward shifts are limited to the intended cases.
Please provide representative per-setting before/after mean pass@1 and scored/masked counts on comparable task/repeat identities, with model settings and limits stated. Separate the intended timeout/OOM deltas from unaffected outcomes and include the follow-up accepted-finish behavior. This supplies the fixed-benchmark reward evidence required by the review rubric without changing the intended scoring policy.
Validation
- I reviewed all changed files with three delegated reviews and checked the reported findings against source and local probes.
- Runtime:
766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:54800b761ceea0f1b3b7d1a62b4008046207395b, a successful prior default-branch CI image. No head image was present, and the admitted base's build jobs were skipped. I installed Stirrup dependencies in a throwaway virtual environment outside the checkouts. pytest resources_servers/critpt_custom_grader/tests: 2,053 passed, four failed, two skipped. The four failures were an OpenAI dependency mismatch introduced by review-environment setup. After pinning Gym'sopenai==2.45.0in a separate environment, I reran exactly those four tests: four passed. Combined coverage was 2,057 passing tests; I did not rerun the entire suite after that repair. The two remote-only modules stayed skipped.- Base/head collector probes confirmed that base rejects the unscored reserved fields and head collects the replacement masked results. Timeout probes confirmed that clean timeouts and recorded infrastructure faults remain distinguishable. I reproduced the accepted-finish loss, OOM cancellation state and recovery-config mismatch described inline.
- Head CI:
Lint check, DCO, copyright, secrets detection and lock freshness passed;requestwas skipped. No head core/server-test results were available.Autobot PR risk #6808failed withrisk:unknown: grading failed; that is not a repository-test verdict.
I did not run live model rollouts or remote sandbox tests. The reward-profile counts above are author-reported, not independently reproduced.
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/stirrup_agent/sandbox_runner.pyline 432: BLOCKER: Preserve the accepted finishing turn before scoring wall-clock no-answers. This cancellation path saves_completed_turns(), which reads the snapshot from the start of the current turn. Stirrup 0.1.12 can executefinishsuccessfully and then block in a sibling tool call before appending that turn to history. The newwall_timescoring branch therefore turns lost submission evidence into a scored zero.I reproduced this with the actual runner/Stirrup loop, real
/finishand/verifyASGI endpoints, and fake model/tool transport:/finishreturned 200, a latercode_execblocked, and cancellation producedsaved_output_items=[]. Verification returnedcandidate_no_answer,scored=true,reward=0,mask_sample=false, with zero grader calls. Base kept that same response unscored. This affects episodes whose accepted finishing turn is interrupted during a sibling call, not genuine no-answer timeouts.Could you preserve the current turn's assistant call and completed finish acknowledgement in the cancellation report, including the bound answer bytes? Until that evidence is available, do not treat a lost accepted submission as a clean no-answer. Add an integration test that accepts
finish, blocks a sibling, cancels the real runner and verifies that the grader receives the accepted source. Keep a separate timeout with no accepted finish scoring zero. The new tests construct an intact finishing transcript, so they miss this producer path.Reproducer:
python /workspace/review-probes/scoring-submission-1/runner_probe.py. -
resources_servers/critpt_custom_grader/agentic_tools.pyline 414: RISK: Abort the OOM replacement if its deletion wait is cancelled.CancelledErrorbypassesexcept Exceptionhere and escapes from insideexecute's exception handler, so_abortnever runs. The shielded delete can finish whilestate.usablestays true andstate.stop_taskstays unset, with no replacement sandbox.I paused deletion, cancelled the command, then let deletion finish using the real
AsyncSandboxfacade and a fake provider. The provider had no live sandbox, but replaying the seed succeeded; the next command failed withexecution_provider_failed. Withmax_sessions=1, a different episode receivedexecution_capacity_exceeded. A disconnected request can therefore leave dead capacity occupied until another command, explicit close or expiry.Could the whole replacement operation retain ownership of the old stop task before its first await, mark the session unusable and perform the existing abort cleanup on cancellation before re-raising? Preserve normal OOM continuation and deferred retry of ordinary failed deletes. Test cancellation during old-sandbox deletion: seed replay must not advertise a usable dead sandbox, and another episode must reclaim capacity once cleanup completes. Also keep delayed-create cancellation and failed-delete retry coverage green.
Reproducer:
python /workspace/review-probes/oom-lifecycle-1/cancel_delete_probe.py. -
resources_servers/critpt_custom_grader/README.mdline 562: RISK: Select finish-tool grading in the agentic recovery example. The rewritten instructions now select masked agentic rows, but this inherited command loadscritpt_custom_grader.yaml, whose default isanswer_source: output_text. Its validator rejects the saved agentic input's tools, so the advertised recovery cannot grade those answers.I built a payload from a saved acknowledged finish with the actual
_build_verify_payloadand sent it through/verify: output-text mode returned HTTP 422 without grading; finish-tool mode returned HTTP 200 and passed the exact submitted source to the grader. The command/config mismatch already existed on base; this PR changes the surrounding workflow to direct masked agentic results through it, rather than introducing a new parser defect.Could the recovery command retain the producing run's grading settings and explicitly select
answer_source: finish_tool, through a recovery config or override? Do not remove tools to bypass validation, because that can select assistant text instead of the acknowledged answer. Check that a saved agentic rollout reaches the grader withfinish.answerand that aggregation substitutes its recovered identity exactly once.Reproducer:
python /workspace/review-probes/docs-tests-contracts-1/readme-reverify.py; observedoutput_text: 422,finish_tool: 200.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
…a cancelled OOM replacement Hosted review of #6808: - Stirrup's runner reports the history as of the start of the running turn when it is stopped. A stop that lands after the finish tool accepted an answer, while other calls of that response still run, loses the accepted turn. The runner now records accepted finish calls and the agent server sets metadata.finish_accepted_unreported for such a stop; the grader keeps that episode unscored (response_incomplete, retry) instead of scoring a no-answer. - A request cancelled while the OOM-ended sandbox is being deleted leaves the session unusable with that delete as its stop, so a replayed seed cannot revive the dead sandbox and the reaper or a close releases its capacity once the delete finishes. - README: the agentic recovery command selects answer_source finish_tool, and the lost-finish case is documented. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Igor Gitman <[email protected]>
|
Thanks for the review. Addressed in e7d4b68:
Tests: |
|
/ok to test e7d4b68 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/46288532657 |
#5010 merges main a6f6362, which brings #6808's finish-accepted report into the Stirrup runner and agent. Two conflicts, both where this layer and #6808 changed the same lines: the response metadata in app.py, which now keeps this layer's stop_reason swap and #6808's finish_accepted_unreported flag, and the runner tests, which keep both sides' tests. The next commit adjusts #6808's test and the empty stopped report to this layer's stop report. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
…op report #6808 assumed that a stopped run reports the history as of the start of the running turn, so a finish that the tool accepted during that turn was missing from the output. With this layer, a stopped run reports the running turn's reply, so the finish call is in the output, but its answer is not. The CritPt grader accepts a finish only with its answer, so finish_accepted_unreported still applies, and graders still keep such an episode unscored. The runner comments now say that the answer is missing, not the turn. #6808's test checks that the finish call has no answer. The empty report for a run that a stop ended before any output carries finish_accepted: false, as the runner's report does. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
What does this PR do?
Two
critpt_custom_graderfixes for the agentic recipe (#5226), authored by @gwarmstrong, plus follow-ups from a pre-push review:Unscored verdicts are masked results. The grader stopped writing rollout collection's
_ng_failure_*keys, which collection refuses in an Environment Server result. An unscored verdict now namesfailure_kindandfailure_reason, and recordsfailure_outcome_action:failfor a terminal category,retryotherwise. An episode stopped at the agent's wall-clock limit without an accepted answer is now a scored no-answer, like the turn limit.A command that exhausts memory no longer fails the episode. An OpenSandbox container is OOM-killed as a unit, so one
code_execcommand over the execution sandbox's memory limit ended the sandbox. The grader reported that as an infrastructure failure (HTTP 503), and recovery re-ran the whole episode. The provider confirms these deaths asprovider_oom_killed, so the grader now returns anout_of_memorytool result, replaces the sandbox, and lets the episode continue. The message tells the model that files from earlier commands are gone. Other execution failures still end the episode.Follow-ups.
failure_kind: agent_timeoutwith model attribution and no outcome action, asgdpvaldoes, so recovery can still re-run a timeout whose window held an infrastructure fault.finishthe tool accepted before a wall-clock stop is graded.finishaccepted an answer, while sibling calls of that response still run, loses the accepted turn from Stirrup's saved history. The runner now flags this (metadata.finish_accepted_unreported), and the grader keeps such an episode unscored and retryable instead of scoring a no-answer.answer_source: finish_tool.verifier_errorrow stopsresubmit --recover, and that--rerun-masked-without-artifactalso re-runsprovider_unavailablerows.On current
main, 371 of the server's own tests fail. The masked-result change brings them back to green.Validation
pytest resources_servers/critpt_custom_grader/testsin a freshuv sync --frozenenvironment of the server:main: 371 failed, 1680 passed;pytest responses_api_agents/stirrup_agent/tests, in an environment synced from this branch: 218 passed. This includes a runner test that acceptsfinish, blocks a siblingcode_exec, and cancels the run.ruff checkandruff format(v0.9.9, the pre-commit pin) on the changed files.58bda25fand thene7d4b6859532f4758bd5856add085601d89d32bc, which addresses the hosted review's BLOCKER and RISKs. Verdict SHIP.mainmoved during the last round; that move touched none of this PR's files. Advisory notes left open:gym eval submit) run.agent_timeout.This does not replace hosted review or CI.
Rollouts
The agentic recipe at George's two commits (before the follow-ups) produced complete CritPt v2 runs for 15 model settings, open-weight and API models through
vllm_modelandopenai_model: 70 problems × 5 repeats each, 5,250 episodes in all, with a 2-hour agent limit.Reward profile, per model setting (70 problems × 5 repeats; temperature 1.0; 2-hour agent limit; 16 GiB execution sandbox; reward as graded during the run). "After" scores all 350 episodes. "Before" leaves out the affected episodes, which the base code masks: unscored wall-clock stops, and OOM episodes it fails and re-runs.
Every shift is within 0.7 points. Wall-clock no-answers score 0. OOM episodes that continued score 12.2% pooled, against 28.8% overall; for three settings they score above that setting's average. These runs used the profile's 2-hour agent limit and 16 GiB sandboxes, overriding the recipe defaults of 6 hours and 8 GiB. They predate the
finish_accepted_unreportedflag.Compatibility and benchmark impact
agent_timeout. Before, it was unscored, so runs that hit the limit will report lower scores with complete coverage.finish_accepted_unreported, marks a stop that lost an acceptedfinishturn. The CritPt grader keeps such a row unscored (response_incomplete, retry). Other Stirrup consumers ignore the key._ng_failure_*.Checklist
pre-commit run --all-files) (so CI lint/format checks pass).git commit -s) (so the DCO check passes).🤖 Generated with Claude Code