Skip to content

fix(pi): address follow-ups from the Pi and Codex GDPVal reviews - #5076

Merged
yaoyu-33 merged 4 commits into
mainfrom
athitten/gdpval-harness-followups
Oct 30, 2026
Merged

yaoyu-33 merged 4 commits into
mainfrom
athitten/gdpval-harness-followups

Conversation

@athitten

@athitten athitten commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

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.mjs comment with the wording #4588 fixed in outcome.mjs. Pi's wall_time closes the gap that #4589's README describes ("Pi does not set it yet").

Pi agent

  • Timeouts: when timeout stops a run that was still working and had not submitted, the response now has stop_reason: wall_time, as Stirrup's does. GDPVal masks such a run as agent_timeout, and --resume reruns 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:

    • a run that called finish successfully before the deadline. Unlike Stirrup, Pi can go on after a successful finish, for example while another tool from the same turn is still running;
    • a run whose last reply stopped (stop or length) without a tool call. The deadline then stopped only Pi's compaction call after the run, unless the reply was an empty length reply 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 a stop reply, 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_names are 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 (an mcp_server_skipped gap), 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.mjs comment: the same corrected wording as outcome.mjs. Pi's JSON mode replaces only process.stdout.write, which console.log calls, and the stream write can pass lines Pi has queued.

Codex agent

GDPVal docs (benchmarks/gdpval/README.md, prepare.py)

  • Why there are two prepare scripts (feat(gdpval): run Pi in place of Stirrup #4589 review). The reason differs from the one in the review: a benchmark YAML can set prepare_script_args (birdbench does), but it is one mapping that gym eval prepare passes to every dataset's prepare(). So a dataset cannot pass its own arguments, and the file must still be the dataset's jsonl_fpath.
  • How a Codex timeout and a Codex context-length error are scored (feat(gdpval): run Codex in place of Stirrup #4591 review). With propagate_upstream_http_status_codes: [400], a context-length error is judged on the last finish or abandon_task_finish, not skipped.
  • The Pi timeout note now matches the new behavior, including its effect on scores (below).

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 with harness_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 merging main.

No issue: these are review follow-ups. Related: #4549 tracks harness validation across benchmarks, GDPVal included.

Validation

In a venv from uv sync --frozen whose versions match uv.lock. The Pi suite, test_gym_mcp.mjs and pre-commit ran at 60ed037. The Codex, GDPVal and environment-server suites ran at the merge commit 961c503 (this branch with main de868b7 merged); the fix after it changes only Pi's timeout rule, its test, and comments and README sentences:

  • pytest responses_api_agents/pi_agent/tests with Pi 0.80.2 and Node 24 on PATH: 343 passed.
  • pytest responses_api_agents/codex_agent/tests with CODEX_TEST_BIN set 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.py runs it too.
  • pytest resources_servers/gdpval/tests in the server's own venv: 900 passed, 1 skipped (it needs Stirrup).
  • pytest environment_servers/single_agent_turn/tests and environment_servers/single_agent_turn_legacy/tests: 123 and 23 passed.
  • pre-commit run --all-files: clean.
  • Each new or changed test fails when the code it guards is broken. Before the merge, all 29 one-at-a-time changes were caught, some of them in the runner fix the merge dropped. On the merged code, a reviewer repeated 16 changes to the timeout rule and the supervisor-overrun path. All were caught but one, reading the first reply instead of the last; the ended cases 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.
  • With real Pi 0.80.2 under refactor(agent_utils): run sandboxed harnesses with only bash in the task image #5151's bash runner and supervisor, 22 scripted runs passed, 17 of them stopped by a deadline, covering each case of the timeout rule. One is a final answer above the configured context window, which makes Pi compact for an overflow after the run; that run is now judged rather than masked. The pinned-Pi finish test also checks the event the rule reads: the finish call's tool_execution_end with details: {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's gym eval prepare and gym eval run commands for gdpval/pi with --limit 3. As in #4589's smoke, a local env.yaml ran the task sandboxes under Apptainer with the GDPVal image and turned judging off, and the Tavily key was a placeholder.

  • With Pi's timeout lowered to 180 s (++gdpval_pi_agent.responses_api_agents.pi_agent.timeout=180), 2 runs were stopped while still working, without a finish. Both responses are incomplete with stop_reason: wall_time, and GDPVal wrote them as masked agent_timeout rows. The third run called finish within 180 s, so it has no stop_reason, and /verify saved its files as before (judging was off). All 42 model calls returned HTTP 200.
  • With the default 10,800 s, all 3 runs ended on finish, with no stop_reason and no failure rows. All 71 model calls returned HTTP 200.
  • In a smoke of an earlier revision, one run's last reply hit the 32,768-token output limit without a tool call. It was incomplete with no stop_reason, so it was judged as an empty submission rather than masked.

Compatibility and benchmark impact

  • GDPVal with Pi (scores): a run that reaches timeout while still working, without a submission, is now an agent_timeout row: left out of the score and rerun by --resume, up to NEMO_GYM_MAX_ROLLOUT_ATTEMPTS. Before, it was judged as an empty submission. Stirrup stops at agent_max_turns and 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.
  • GDPVal multi-stage ELO with Pi: a timed-out row now holds a calibration stage open until --resume (or retry_inprocess) reruns it. One still missing in the final stage withholds comparison/eval_elo unless partial_completion accepts the coverage, as for Stirrup. Before, it counted as a loss.
  • Other Pi benchmarks: GDPVal is the only resources server that reads 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 --resume reran. Both now return an incomplete response, which each benchmark handles like any other Pi timeout (GDPVal masks it when the run was still working). For Pi, wall_time means 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.
  • Pi configs: an optional grant that offers a finish tool another grant offers is now left out, and two such required grants fail setup. No config in the repo does either; GDPVal grants one server.
  • Codex: tests and docs only.

Checklist

  • I have read the contributing guidelines.
  • The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs.
  • Tests added or updated and pass locally, or N/A for docs-only / non-code changes (so CI unit/server checks pass when applicable).
  • Documentation added or updated, or N/A with justification.
  • Pre-commit checks pass locally (pre-commit run --all-files) (so CI lint/format checks pass).
  • New source files include the required Apache-2.0 SPDX header.
  • All commits have DCO sign-off (git commit -s) (so the DCO check passes).

- 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]>
@copy-pr-bot

copy-pr-bot Bot commented Oct 26, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added area:agent Agent harnesses and Responses API agent behavior bug Something isn't working labels Oct 26, 2026
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]>
@athitten

Copy link
Copy Markdown
Contributor Author

/review

@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.

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.

@athitten

Copy link
Copy Markdown
Contributor Author

/ok to test 60ed037

@athitten
athitten marked this pull request as ready for review October 29, 2026 16:59
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the needs-review PR is ready for code review and waiting on a reviewer label Oct 29, 2026

@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.

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]>
@athitten

Copy link
Copy Markdown
Contributor Author

/ok to test 7eb24d7

@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/41003449896

@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/41003779477

Merged via the queue into main with commit d950e94 Oct 30, 2026
48 of 51 checks passed
@yaoyu-33
yaoyu-33 deleted the athitten/gdpval-harness-followups branch October 30, 2026 05:13

This branch was previously deployed

1 inactive deployment
public — 7eb24d7b Deployed Oct 30, 2026 by copy-pr-bot[bot] via release / finalize / notify #8561
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:agent Agent harnesses and Responses API agent behavior bug Something isn't working needs-review PR is ready for code review and waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants