Repository navigation
fix(pi): address follow-ups from the Pi and Codex GDPVal reviews - #5076
Conversation
- Pi reports a timeout of a run that was still working and had not submitted as stop_reason: wall_time. - The Pi sandbox runner keeps the lines Pi writes just before it exits. - A finish tool that two MCP grants offer: an optional grant is left out, two required ones fail setup. - Tests for the grant-name rules and for Codex startup failures with a native transcript. - GDPVal README: Pi and Codex timeouts, Codex context-length errors, and why prepare_harness_neutral.py exists. Signed-off-by: Abhishree <[email protected]>
Drop the Pi sandbox_runner.py drain fix and its test: #5151 replaced that runner with harness_runner.sh, which reads Pi's stdout from a file to its end after Pi exits. Signed-off-by: Abhishree <[email protected]>
A `stop` reply whose input is above Pi's context_window makes Pi compact for an overflow after the run, but Pi never retries a `stop` reply. Count only an overflow compaction after a `length` reply as recovering, so a deadline during that compaction no longer reports wall_time. Also say that Pi 0.80.2 exits with code 1 after compacting for an empty `length` reply, and when a Codex timeout is retried. Signed-off-by: Abhishree <[email protected]>
|
/review |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP
LGTM — no concerns found.
Reviewed all eight changed files and traced the affected Pi timeout, MCP registration, sandbox cleanup, Codex observation, and GDPVal verification paths. The documentation and regression assertions match the inspected contracts.
Static review only; I did not execute tests or rollouts.
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.
|
/ok to test 60ed037 |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP
LGTM — no concerns found within this follow-up’s scope.
The latest bot review was clean at the exact current head. There are no subsequent changes or unresolved prior findings, so this completes the same-head follow-up without restarting whole-PR defect discovery.
Static inspection only; no tests or rollouts executed.
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 findings-only review. Request a full review with /review reset=true.
Picks up #5213, which keeps the Harbor manifest and image tests off Docker Hub. Those tests failed this PR's CI with HTTP 429. Signed-off-by: Abhishree <[email protected]>
|
/ok to test 7eb24d7 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/41003449896 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/41003779477 |
What does this PR do?
Follow-ups from the reviews of #4587, #4589, #4590 and #4591, which the reviewer marked non-blocking or optional, plus one of our own: a
gym_mcp.mjscomment with the wording #4588 fixed inoutcome.mjs. Pi'swall_timecloses the gap that #4589's README describes ("Pi does not set it yet").Pi agent
Timeouts: when
timeoutstops a run that was still working and had not submitted, the response now hasstop_reason: wall_time, as Stirrup's does. GDPVal masks such a run asagent_timeout, and--resumereruns it. Before, such a run was judged as an empty submission. Two kinds of run are still judged, because they had already submitted or ended:finishsuccessfully before the deadline. Unlike Stirrup, Pi can go on after a successfulfinish, for example while another tool from the same turn is still running;stoporlength) without a tool call. The deadline then stopped only Pi's compaction call after the run, unless the reply was an emptylengthreply at a full context window. Pi counts that as a context overflow and compacts to retry it (Pi 0.80.2 then exits with code 1, which fails the episode), so a deadline during that compaction is still a timeout. Pi never retries astopreply, even above the context window.Two more cases now count as timeouts, as they do for Stirrup: a deadline while Pi waited to retry a failed model call, and a sandbox exec limit that expires after the supervisor confirmed the deadline. Before, both failed the episode.
Finish tools on more than one grant (feat(pi): use MCP tool grants in sandbox sessions #4587 review):
finish_tool_namesare matched without the grant, so another grant's tool with the same name would also end the run. Now, as for grant names that overlap, an optional grant that offers a listed tool another grant also offers is left out (anmcp_server_skippedgap), and two required grants that offer the same listed tool fail setup. No config in the repo grants two such servers, so there is no new setting.Tests for the grant-name rules (feat(pi): use MCP tool grants in sandbox sessions #4587 review), beyond two required grants: a required and an optional grant, two optional grants, names that share a prefix without
_, and the 62/63-character boundary.gym_mcp.mjscomment: the same corrected wording asoutcome.mjs. Pi's JSON mode replaces onlyprocess.stdout.write, whichconsole.logcalls, and the stream write can pass lines Pi has queued.Codex agent
agent_startup_failedgap (feat(codex): use MCP tool grants in sandbox sessions #4590 review).GDPVal docs (
benchmarks/gdpval/README.md,prepare.py)prepare_script_args(birdbench does), but it is one mapping thatgym eval preparepasses to every dataset'sprepare(). So a dataset cannot pass its own arguments, and the file must still be the dataset'sjsonl_fpath.propagate_upstream_http_status_codes: [400], a context-length error is judged on the lastfinishorabandon_task_finish, not skipped.Not in this PR: the Stirrup baseline asked for on #4589 (same checkpoint, judges and references). Those runs are generated; their numbers will go on #4589's thread once they are judged. An earlier revision of this PR also fixed a race in Pi's
sandbox_runner.py, which could drop the lines Pi wrote just before it exited. #5151 has since replaced that runner withharness_runner.sh, which writes Pi's stdout to a file and reads it to the end after Pi exits, so the fix and its test were dropped when mergingmain.No issue: these are review follow-ups. Related: #4549 tracks harness validation across benchmarks, GDPVal included.
Validation
In a venv from
uv sync --frozenwhose versions matchuv.lock. The Pi suite,test_gym_mcp.mjsand pre-commit ran at 60ed037. The Codex, GDPVal and environment-server suites ran at the merge commit 961c503 (this branch withmainde868b7 merged); the fix after it changes only Pi's timeout rule, its test, and comments and README sentences:pytest responses_api_agents/pi_agent/testswith Pi 0.80.2 and Node 24 onPATH: 343 passed.pytest responses_api_agents/codex_agent/testswithCODEX_TEST_BINset to Codex 0.144.4: 471 passed, 1 skipped (it needs Python 3.8).node --test responses_api_agents/pi_agent/tests/test_gym_mcp.mjs: 17 passed.test_app.pyruns it too.pytest resources_servers/gdpval/testsin the server's own venv: 900 passed, 1 skipped (it needs Stirrup).pytest environment_servers/single_agent_turn/testsandenvironment_servers/single_agent_turn_legacy/tests: 123 and 23 passed.pre-commit run --all-files: clean.endedcases now have an earlier tool turn and catch it. The Codex test fails if the native-transcript path drops the stderr tail or its gap, records the gap twice, or is never taken.tool_execution_endwithdetails: {terminal: true}.Rollouts
Smoke of this PR's code before the merge with
main, when Pi still ran under the Python runner, on a GPU cluster, with the internal checkpoint of #4589's runs served with vLLM. It used the README'sgym eval prepareandgym eval runcommands forgdpval/piwith--limit 3. As in #4589's smoke, a localenv.yamlran the task sandboxes under Apptainer with the GDPVal image and turned judging off, and the Tavily key was a placeholder.timeoutlowered to 180 s (++gdpval_pi_agent.responses_api_agents.pi_agent.timeout=180), 2 runs were stopped while still working, without afinish. Both responses areincompletewithstop_reason: wall_time, and GDPVal wrote them as maskedagent_timeoutrows. The third run calledfinishwithin 180 s, so it has nostop_reason, and/verifysaved its files as before (judging was off). All 42 model calls returned HTTP 200.finish, with nostop_reasonand no failure rows. All 71 model calls returned HTTP 200.incompletewith nostop_reason, so it was judged as an empty submission rather than masked.Compatibility and benchmark impact
timeoutwhile still working, without a submission, is now anagent_timeoutrow: left out of the score and rerun by--resume, up toNEMO_GYM_MAX_ROLLOUT_ATTEMPTS. Before, it was judged as an empty submission. Stirrup stops atagent_max_turnsand is judged, but Pi has no turn limit, so a Pi run that keeps calling tools without submitting now drops out of the score instead of counting as 0, which can raise Pi's score. For a comparison on the same basis,+count_failure_classes_as_zero=[agent_timeout]counts these runs as 0 in rubric mode; the README says so. None of the 220 runs reported in feat(gdpval): run Pi in place of Stirrup #4589 timed out, so its numbers do not change. Compare only runs started after this change: resuming an older run keeps its earlier timeouts judged and masks the later ones.--resume(orretry_inprocess) reruns it. One still missing in the final stage withholdscomparison/eval_elounlesspartial_completionaccepts the coverage, as for Stirrup. Before, it counted as a loss.stop_reason, so elsewhere a timed-out response only gains the key. Two cases change for every Pi benchmark: a deadline while Pi waits to retry a failed model call, and a sandbox exec limit that expires after a confirmed deadline. Both used to fail the episode, which--resumereran. Both now return anincompleteresponse, which each benchmark handles like any other Pi timeout (GDPVal masks it when the run was still working). For Pi,wall_timemeans the deadline stopped a run that had neither ended nor submitted, which is narrower than Stirrup's "the deadline stopped the run"; the Pi README says so.Checklist
pre-commit run --all-files) (so CI lint/format checks pass).git commit -s) (so the DCO check passes).