Skip to content

feat(healthbench): add HealthBench and HealthBench Professional - #5775

Merged
adil-a merged 14 commits into
NVIDIA-NeMo:mainfrom
cparisien:healthbench-professional-dco
Nov 12, 2026
Merged

adil-a merged 14 commits into
NVIDIA-NeMo:mainfrom
cparisien:healthbench-professional-dco

Conversation

@jin-nvidia

@jin-nvidia jin-nvidia commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Add HealthBench (Full, with optional Consensus and Hard subsets) and HealthBench Professional as manifest-backed Gym benchmarks. Both preserve the original conversations and rubric points, use the simple-agent harness, and share a rubric-grading resources server. Add preparation, verifier tests, documentation, and example NVIDIA gateway configurations for Nemotron Lightning, Nemotron Ultra, and Claude Opus 5.

This is benchmark onboarding work. No issue is linked because the onboarding request was coordinated directly with the benchmark collaborators.

Draft status: implementation and live runs are available for review; the onboarding exit checks listed below still need agreement or follow-up. Run artifacts are evidence in this PR description and are not committed to Gym. The full datasets and nv.env are excluded from the diff.

Code provenance

The grader prompt in resources_servers/healthbench_rubric/prompts/grader.txt is copied from OpenAI simple-evals/healthbench_eval.py at commit 652c89d0ca9df547706735883097e9537d40dc47, under MIT. The source license is retained at resources_servers/healthbench_rubric/prompts/LICENSE. The verifier implementation is Gym code.

Validation

  • python -m pytest benchmarks/healthbench/tests/test_prepare.py resources_servers/healthbench_rubric/tests/test_app.py -q — 62 passed on this branch.
  • pre-commit run --all-files — passed on this branch (the private guardword catalog was unavailable, so that hook reported a skip).
  • git diff --check — passed; both commits have DCO sign-off.
  • The earlier implementation validation in benchmarks/healthbench/validation.md records gym env validate and gym env test for both benchmarks, 388 focused tests, and live smoke runs. It predates this branch's latest upstream sync; it is background evidence, not a claim that these commands were rerun today.

Rollouts and reference-score evidence

Full-size Claude Opus 5 runs used policy aws/anthropic/bedrock-claude-opus-5 at max reasoning effort, judge aws/anthropic/bedrock-claude-opus-4-8 at medium reasoning effort, both via https://inference-api.nvidia.com/v1, with 32 parallel rollouts. The saved redacted resolved-config.yaml, quality_summary.json, aggregate metrics, failure sidecars, and model-call captures are retained outside Git under the run folders below.

Benchmark Run folder under results/ Attempts / scored Raw score Length-adjusted score Anthropic Opus 5 reference
HealthBench Full healthbench/claude-opus-5/opus48-medium-chat-32-1x/ 5,000 / 4,998 67.89% 58.46% (post-run calculation) 67.1% raw; 57.8% adjusted
HealthBench Professional healthbench_professional/claude-opus-5/opus48-medium-chat-32-5x/ 2,625 / 2,616 73.64% 60.20% (Gym metric) 73.4% raw; 59.8% adjusted

Reference: Anthropic Claude Opus 5 System Card, HealthBench sections 8.15.1–8.15.2. Anthropic reports five trials, adaptive thinking at max effort, and an Opus 4.8 grader. Our Professional run used five repeats; the complete HealthBench run used one. Anthropic does not specify the grader effort in the cited conditions, so our medium setting is recorded rather than asserted to match. The HealthBench adjusted value applies OpenAI's published 2.99-point-per-500-character adjustment, with empty final answers held at zero; this run's Gym aggregate does not emit that metric. These are approximate reproductions, not identical evaluation conditions or publishable model numbers.

Run health and missing attempts:

  • HealthBench: 4,935 healthy, 63 unhealthy, 0 unobserved among the 4,998 scored rollouts. All 63 unhealthy rollouts were policy responses marked content_filter by the routed endpoint. Two additional attempts (tasks 1514 and 4897) were masked and excluded: on each, the Opus 4.8 judge returned finish_reason=content_filter with zero output on all three retries for a rubric item. Task 1514 also had a partial policy response marked content_filter; task 4897 had a completed policy response and 15 successful rubric judgements before the judge filtering. Neither attempt was scored. The 63/4,998 unhealthy fraction is 1.26%, above the onboarding guide's proposed 0.1% limit; this is disclosed for reviewer assessment, not represented as a passing check.
  • Professional: 2,616 healthy, 0 unhealthy, 0 unobserved among scored rollouts. Nine attempts were dropped from scoring: task 82 (one repeat), task 206 (all five), and task 455 (three). Each exhausted three policy-model attempts after the NVIDIA gateway returned HTTP 408 at its 360-second timeout; the local agent then surfaced HTTP 500. These are policy inference timeouts, not judge failures. The missing attempts leave 524 of 525 tasks represented in the aggregate.
  • Professional per-repeat length-adjusted means were 59.24%, 60.43%, 59.67%, 60.67%, and 60.98% (sample standard deviation about 0.72 percentage points). Repeat counts differ slightly because of the nine timeouts. This supports a provisional variance discussion; the formal EC-3 tolerance still needs agreement.

Onboarding exit checks to resolve

  • EC-1: Review the explained HealthBench content-filter failures and the Professional inference timeouts against the proposed health limit; do not hide or recode them as successes.
  • EC-2: gym-p0/v1 inspection has now been run on both full-size saved bundles, with tool checks inapplicable. On HealthBench (4,998 scored rollouts), TE-1, TE-2, TE-3, TE-4, TE-6, and TE-7 pass all 4,998; TE-8 and TE-9 pass only 67/4,998. Those 67 have empty final answers and no judge call. On Professional (2,616 scored rollouts; inspection November 3, 2026), the same six TE groups pass all 2,616; TE-8 and TE-9 pass only 4/2,616. The failing assertions are ownership.call_owner and steps.attempt_accounting: captured judge calls lack policy invocation/step ownership. Reports are retained outside Git in each run folder under ec2-conformance/. Resolve the judge-call evidence gap with the harness/observability owners and rerun the checker.
  • EC-3: Agree a score tolerance based on repeat-run variance and record a formal comparison to the system-card reference. The table above is supporting evidence, with conditions and missing attempts disclosed.
  • EC-4: Both run folders contain a redacted resolved-config.yaml.
  • EC-5: A second harness is not required at initial onboarding by the current guide.
  • EC-6: Confirm the reused simple-agent harness's committed capability-matrix evidence with its owner.
  • EC-7: Add the Config Management Repo binding and leaf, resolve the recipe, and run Evergreen dry-run against the final metric key. This is a proposed guide exit check; the Config Management MR is separate from this Gym PR.

Compatibility and benchmark impact

Adds two experimental benchmarks and one verifier resources server; existing benchmarks are unchanged. The Gym reward is bounded to [0, 1], while overall_score preserves the raw rubric score for headline comparisons. Professional also reports overall_score_length_adjusted. The model configs are examples; production runs must supply credentials via NVIDIA_API_KEY and record their actual settings.

Checklist

  • Read the contributing guidelines.
  • Focused change with tests and documentation.
  • Relevant focused tests and pre-commit run --all-files passed locally.
  • New authored source files include NVIDIA SPDX headers; copied MIT grader prompt provenance is documented above.
  • Both commits have DCO sign-off.
  • Onboarding exit checks and reference tolerance accepted; draft remains open until then.

Proposed labels: feature, area:evaluation. The PR author cannot apply labels in this repository.

jin-nvidia and others added 2 commits October 27, 2026 13:07
Squash the original HealthBench commits into one signed-off commit to meet Gym's DCO requirements. The staged tree matches the original healthbench-professional branch.

Co-authored-by: Chris Parisien <[email protected]>
Signed-off-by: Jin Li (Worldwide Field Ops) <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Nov 6, 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.

@nemo-automation-bot nemo-automation-bot Bot added the community-request Issue reported or requested by someone from the community label Nov 6, 2026
@jin-nvidia
jin-nvidia marked this pull request as ready for review November 7, 2026 00:06
@adil-a

adil-a commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

/review

@adil-a

adil-a commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

/ok to test 230206a

@adil-a

adil-a commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

/review

@nemo-automation-bot
nemo-automation-bot Bot requested review from a team November 7, 2026 00:15
@svcnvidia-nemo-ci svcnvidia-nemo-ci added feature New capabilities, enhancements, or enablement work area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers benchmark-onboarding Self-contained benchmark onboarding needs-review PR is ready for code review and waiting on a reviewer labels Nov 7, 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.

HOLD — one BLOCKER silently scores supported refusal answers as empty. Six RISKs affect schema validation, judge-failure completion, grading evidence, preparation, tests, and multi-worker startup.

I inspected all 32 changed files and traced the affected preparation, configuration, verification, aggregation, and reporting paths. This was a source-only review: I didn't execute tests or inspect the external run bundles. Two delegated report texts weren't returned, so I inspected those topics directly.

NOTE — Add published-site documentation for both benchmarks. The new READMEs explain the protocols, but the published benchmark guide doesn't mention either benchmark. The review rubric requires user-facing benchmark documentation under Fern. Could you add a concise section there covering preparation, model/judge configuration, subset selection, experimental status, and the two headline metric keys, with links to the detailed READMEs? Retain the warning that mean/reward isn't the published-score metric and that masked attempts reduce scored coverage. Proposed acceptance: verify that both names and their prepare/run examples appear in the published page, that HealthBench uses overall_score and Professional uses overall_score_length_adjusted, and run the Fern documentation and link checks. This is a documentation suggestion, not an observed runtime failure.

The inline comments contain the failure evidence, correction, preservation requirements, and proposed acceptance checks for each code finding. Suggested code is source-reviewed, not tested; please verify it before adopting it.

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

for output in reversed(body.response.output):
if getattr(output, "type", None) != "message" or getattr(output, "role", None) != "assistant":
continue
return "".join(item.text for item in output.content if getattr(item, "type", None) == "output_text")

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 — Grade refusal content instead of treating it as an empty answer.

A supported final message containing {"type":"refusal","refusal":"Please seek emergency care; I cannot diagnose this remotely."} becomes an empty string here. verify() then assigns zero without judging even a positive criterion such as “Advises seeking emergency care.” This silently mis-scores answers in both benchmarks. Gym's response contract supports refusal content, and the policy converter preserves it.

Could you replace this return statement with:

Suggested change
return "".join(item.text for item in output.content if getattr(item, "type", None) == "output_text")
return "".join(
item.text if getattr(item, "type", None) == "output_text" else item.refusal
for item in output.content
if getattr(item, "type", None) in {"output_text", "refusal"}
)

This retains the last-assistant-message rule, content order, exact whitespace, and exclusion of reasoning. Truly empty or whitespace-only answers must still receive zero without a judge call or length bonus.

Proposed acceptance: send a refusal-only final message with the example criterion and a scripted true judge verdict; assert that the judge receives the refusal text, overall_score == 1, and grades is nonempty. Cover mixed text/refusal content in order. Retain the exact-whitespace/last-answer and empty-answer assertions in the verifier tests. I traced the suggestion through these cases but didn't execute it.

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.

Suggestion applied.


class HealthBenchRubricVerifyRequest(BaseVerifyRequest):
model_config = ConfigDict(extra="allow")

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.

RISK — Supply the resources server's task-data schema.

The new server has no task_data.py. The existing schema-presence check therefore fails, and collation skips task-field validation even in error mode. For example, a prepared row missing rubrics can pass collation before policy inference and then fail this required verifier contract. Both benchmarks and the committed examples use this owner.

Could you extract the task fields and their validators into a dependency-light resources_servers/healthbench_rubric/task_data.py exporting TaskData, reuse the shared contract in HealthBenchRubricVerifyRequest, and validate preparation output against it? Declare the emitted provenance fields, including uuid, so valid rows don't become unknown-field failures. Add enforcement between the schema and runtime model rather than maintaining unrelated declarations. The invariant is that preparation, collation, and /verify agree on required fields and validation.

Preserve signed finite rubric points, rubric extras/tags, metadata, native conversations ending in a user turn, and the current extra="allow" policy.

Proposed acceptance: the existing schema-presence and committed-row checks pass; rows produced by both preparers validate unchanged. Removing source_id, conversation, or rubrics, supplying boolean/nonfinite points, or removing all positive points must fail both schema and runtime validation before paid calls. Retain the existing preparation-preservation assertions. This is source reasoning; I didn't run the checks.

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.

Suggestion applied.

conversation = _conversation_text(body.conversation, response_text)
try:
grades = [await self._grade_rubric(conversation, rubric) for rubric in body.rubrics]
except JudgeError as error:

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.

RISK — Handle the typed failures emitted by the real judge helper.

HTTP and connection failures from call_judge raise NgFailureEvent, not JudgeError; see its exception contract. They bypass this branch. The shared failsafe masks them but doesn't add evaluation_completed=false, so an ordinary new request returns a failure row without the completion boolean required by the conformance consumer. The current tests mock only JudgeError and TimeoutError.

Could you import JUDGE_FAILURES and is_judge_failure from nemo_gym.verification and replace the exception header with:

        except JUDGE_FAILURES as error:
            if not is_judge_failure(error):
                raise

Keep the existing incomplete/masked response fields, and merge FailureReportRow.fields(report_for_current_request(error)) from nemo_gym.core into the typed failure response so its selected event and HTTP cause survive. Don't swallow unrelated Gym failures or convert unavailable grades into valid false criteria.

Proposed acceptance: exercise the registered /verify route with the real helper over stubbed HTTP 401 and exhausted retryable failures. Assert evaluation_completed is False, masking, retained policy response, and a selected judge failure preserving the HTTP cause. Retain malformed-grade masking, valid-false grading, signed scores, and successful-reverification assertions. No tests were executed.

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.

Suggestion applied.

)
conversation = _conversation_text(body.conversation, response_text)
try:
grades = [await self._grade_rubric(conversation, rubric) for rubric in body.rubrics]

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.

RISK — Record the judge grading that produced the returned score.

With observability enabled, successful nonempty answers record judge calls but no grading operation: this path never uses observe_llm_judge_grading or record_parsed_judge_verdict. The verification wrapper deliberately doesn't infer programmatic grading after model calls, and grades isn't a recognized grading artifact. Consequently, normally scored trials remain unobserved at the current evaluation-health gate, withholding a pass for both benchmarks. This is distinct from the historical call-ownership gap disclosed in the PR.

Could you instrument the complete score-producing calculation with the existing grading-observation contract? A successful operation must bind the returned policy response and bounded reward to the actual judge dependencies; mark a parsed verdict only after validating boolean criteria_met. Don't label the final arithmetic alone as model-free grading. The malformed-reply retry loop needs care: blindly wrapping it can leave an eventually accepted grade unknown. I haven't established a small safe patch for that arrangement; the required invariant is a completed, correctly bound grading record for each accepted result without hiding failed attempts.

Proposed acceptance: through the registered route and real helper over stubbed transport, cover true/false grades, multiple signed rubrics, both judge endpoints, and malformed-then-valid recovery. Assert completed judge-grading evidence, actual response IDs, and a binding matching the returned response/reward; the trial must no longer be unobserved for missing grading. Preserve empty/no-judge zeros, masked incomplete failures, raw negative scores, Professional's length adjustment, and clamp-after-averaging. These checks weren't executed.

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.

Additions applied.

if other != subset:
Path(destination).write_text("do not overwrite\n")
with patch("huggingface_hub.hf_hub_download", return_value=str(local_source)) as download:
_multiprocess_benchmark_prepare_fn((datasets[0], "benchmarks.healthbench.prepare", args))

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.

RISK — Pass the current preparation worker's four-element input.

Each of the six subset/config-order cases calls the worker with three elements, but the current worker immediately unpacks four. These tests therefore raise ValueError: not enough values to unpack (expected 4, got 3) before preparing a row, so the advertised focused suite can't pass at this head and doesn't exercise its cross-subset overwrite assertions.

Could you supply None for the non-isolated interpreter, matching the production in-process branch?

Suggested change
_multiprocess_benchmark_prepare_fn((datasets[0], "benchmarks.healthbench.prepare", args))
_multiprocess_benchmark_prepare_fn((datasets[0], "benchmarks.healthbench.prepare", args, None))

Retain all six Full/Consensus/Hard and config-order cases, selected filenames and destinations, subset metadata, and the assertions that other subset files remain untouched.

Acceptance: run this parametrized test and assert that all six cases reach the existing output/content assertions, with the mocked download selecting the expected source filename and all nonselected destinations unchanged. Also retain the atomic-failure and direct-subset preparation cases. The failure and suggestion follow directly from the inspected signatures; I didn't execute pytest.

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.

Suggestion applied.


BENCHMARK_DIR = Path(__file__).parent
DATA_DIR = BENCHMARK_DIR / "data"
OUTPUT_FPATH = DATA_DIR / "healthbench_professional_benchmark.jsonl"

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.

RISK — Write the default Professional dataset under the caller's working directory.

Outside the checkout, gym eval prepare --benchmark healthbench_professional uses this absolute module-relative destination, because its config supplies no output override. In a wheel installation that targets the installed package tree, preparation either fails on permissions or writes there and then fails the worker's cwd-relative destination check. The standard command should write the path declared by the benchmark in the user's writable working directory, not modify the installation.

Could you make the default destination match that contract?

Suggested change
OUTPUT_FPATH = DATA_DIR / "healthbench_professional_benchmark.jsonl"
OUTPUT_FPATH = Path("benchmarks/healthbench_professional/data/healthbench_professional_benchmark.jsonl")

This keeps the repository-root workflow's destination unchanged and leaves explicit output arguments, local/ZIP/Hugging Face loading, revision pinning, limits, and atomic replacement intact.

Proposed acceptance: change into a temporary directory, prepare one local synthetic record using the default output, and assert that only the declared path beneath that directory is written and that the returned path matches the worker's expected absolute path. Exercise the standard prepare command from outside a read-only wheel installation. Retain explicit-output and atomic-failure assertions in the shared preparation tests. No commands were executed.

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.

Suggestion applied.

)


if __name__ == "__main__":

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.

RISK — Export the application when Uvicorn imports a worker.

Setting this resources server's inherited num_workers to 2 makes the shared launcher start resources_servers.healthbench_rubric.app:app. In a worker import, __name__ isn't __main__, and this module never defines app, so the workers can't start and either benchmark times out during server startup. The server doesn't declare multi-worker operation unsupported.

Could you import is_nemo_gym_fastapi_entrypoint from nemo_gym.utils and use the same worker entrypoint branch as the existing model/agent servers? Replace this final block with:

if __name__ == "__main__":
    HealthBenchRubricResourcesServer.run_webserver()
elif is_nemo_gym_fastapi_entrypoint(__file__):
    app = HealthBenchRubricResourcesServer.run_webserver()  # noqa: F401

Preserve single-worker/script startup and ordinary imports used by tests and verifier fixtures; those imports must not start a server.

Proposed acceptance: start the resources server with two workers and stubbed judge transport, then check /reverify_mode and a synthetic /verify request. Both workers should serve successfully. Retain single-worker behavior and verify that importing the module normally still performs no startup. I traced this patch against the launcher and worker predicate but didn't run it.

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.

Suggestion has been applied

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.

Applied.

@yaoyu-33 yaoyu-33 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 config suggestion: move the HealthBench environment server off the legacy_agent relay.

Comment on lines +40 to +44
legacy_agent:
entrypoint: app.py
agent_server:
type: responses_api_agents
name: healthbench_rubric_simple_agent

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.

resources_servers/healthbench_rubric/configs/healthbench_rubric.yaml:40

Could this pairing use single_agent_turn_legacy instead of the legacy_agent relay? The relay sends the whole episode to simple_agent's /run as one request, so a crash repeats the whole episode; single_agent_turn_legacy runs it in steps and is the documented target for simple_agent (Move a simple_agent Off the Relay; arena_judge does the same). scripts/add_legacy_agent_environment_servers.py --switch-simple-agent produces exactly this change, and the benchmark configs need no edit: through the _inherit_from rename it still resolves to both benchmark agents and to Professional's own resources server, and gym env validate --server-types environment_servers passes for Full, Consensus, Hard and Professional. A small before/after reward check would be good to include.

Suggested change
legacy_agent:
entrypoint: app.py
agent_server:
type: responses_api_agents
name: healthbench_rubric_simple_agent
single_agent_turn_legacy:
entrypoint: app.py
agent_server:
type: responses_api_agents
name: healthbench_rubric_simple_agent
resources_server:
type: resources_servers
name: healthbench_rubric
resources_tool_transports:
- direct_http

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.

Hi @yaoyu-33, the suggested change has been applied to PR, please take a look thank you

@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-maintainers Waiting on maintainers to respond label Nov 9, 2026
Signed-off-by: Jin Li (Worldwide Field Ops) <[email protected]>
@svcnvidia-nemo-ci svcnvidia-nemo-ci removed the waiting-on-maintainers Waiting on maintainers to respond label Nov 10, 2026
Signed-off-by: Jin Li (Worldwide Field Ops) <[email protected]>
@jin-nvidia

Copy link
Copy Markdown
Contributor Author

/review reset=true

@jin-nvidia

Copy link
Copy Markdown
Contributor Author

Hi @adil-a @yaoyu-33, after addressing the review generated by codex, and the one comment by @yaoyu-33, I tried to do /review reset=true but it didn't trigger another review. Perhaps due to my lack of access to this repo. How should I proceed from here? Thank you!

@adil-a

adil-a commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

/review reset=true

@adil-a

adil-a commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

/ok to test ae8f3a0

@adil-a

adil-a commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

/review reset=True

@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 — no qualifying findings.

The latest review's two RISKs are fixed: parser and local-timeout failures receive canonical failure IDs, and template substitution preserves conversation and criterion text. The added regression tests cover both concrete failures.

I assessed all 47 changed files and traced the affected preparation, configuration, verification, aggregation, validation, and recovery paths. All three delegated inspections reached terminal status. One report wasn't returned, so I directly inspected its preparation, schema, configuration, dependency, and documentation assignment.

This was source-only inspection. I didn't execute tests, install dependencies, or inspect the externally retained rollout bundles. This approval doesn't certify the disclosed onboarding exit checks or reference-score parity.

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

adil-a
adil-a previously approved these changes Nov 12, 2026
@adil-a
adil-a enabled auto-merge November 12, 2026 00:00
kajalj22
kajalj22 previously approved these changes Nov 12, 2026
auto-merge was automatically disabled November 12, 2026 17:29

Head branch was pushed to by a user without write access

@jin-nvidia
jin-nvidia dismissed stale reviews from kajalj22 and adil-a via b4a31bc November 12, 2026 17:29
@kajalj22

Copy link
Copy Markdown
Contributor

/ok to test b4a31bc

@nemo-automation-bot
nemo-automation-bot Bot requested review from a team November 12, 2026 17:53
@adil-a
adil-a enabled auto-merge November 12, 2026 18:43
@adil-a
adil-a added this pull request to the merge queue Nov 12, 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/43283012855

Merged via the queue into NVIDIA-NeMo:main with commit 90e91aa Nov 12, 2026
72 of 73 checks passed
weijiac0619 added a commit that referenced this pull request Nov 12, 2026
Main's #5775 validates a resources server that only manifest workloads use through its committed verifier
fixtures (manifest_workloads_for_server, validate_environment(validate_datasets=False)). That covers what
eb66804 added for AutomationBench, so nemo_gym/cli/env.py and nemo_gym/environment/validation.py take main's
version, and the tests for the replaced path (require_all_datasets, setup_config reuse, the indic stubs it
needed) are dropped. AutomationBench's VERIFIER_FIXTURE and verifier_cases.jsonl stay; main's path runs them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: weijia chen <[email protected]>
ananthsub pushed a commit that referenced this pull request Nov 12, 2026
#5775 left the benchmarks/healthbench_professional/prepare.py entry unterminated, so detect-secrets cannot read the baseline and the secrets-detector check fails on every PR. Restore the missing is_secret field and closing brackets.

Signed-off-by: Chris Wing <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
yaoyu-33 pushed a commit that referenced this pull request Nov 12, 2026
#5775 left the benchmarks/healthbench_professional/prepare.py entry unterminated, so detect-secrets cannot read the baseline and the secrets-detector check fails on every PR. Restore the missing is_secret field and closing brackets.

Signed-off-by: Chris Wing <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
(cherry picked from commit b2a2791)
Signed-off-by: yaoyu-33 <[email protected]>
khazic pushed a commit to khazic/Gym-lao that referenced this pull request Nov 13, 2026
…box (NVIDIA-NeMo#5003)

* feat(environment): bind the agent's resources server when single_agent_turn names none

A legacy_agent relay names no resources server: the agent's /run uses its
own. A single_agent_turn_legacy server that replaces the relay had to pin
one, and a pinned name breaks a benchmark that reaches the server through
an _inherit_from rename of the agent. The rename also renames the
resources server, and Gym follows renames only for agent references, so
the pinned name dangles (for example indic/math_500 through
math_with_judge's server).

resources_server is now optional. Unset, the server binds the resources
server the bound agent names, as the relay did, so it follows the agent
rename. A server that sets none in front of an agent that names none
fails at startup instead of on the first episode.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* feat(scripts): switch simple_agent relays to single_agent_turn_legacy

About 307 configs reach simple_agent through a legacy_agent relay, so a
crash repeats the whole episode. Under single_agent_turn_legacy, it
repeats only the current step, and simple_agent resumes inside its turn
(GYMINT-549).

add_legacy_agent_environment_servers.py gains --switch-simple-agent. It
replaces each relay in front of a simple_agent with a
single_agent_turn_legacy server of the same name, so rows keep their
routing. The server names no resources server, so it binds the agent's,
as the relay did, and follows an agent rename. It grants direct HTTP
access to the resources server's tools, the routes the agent's /run
called.

It resolves each config with its own config_paths, as Gym does, since
instance names are unique only within a run. A relay stays, listed with
its reason, when its agent binds no resources server, declares a grant
simple_agent sessions reject (a required MCP access or a second direct
HTTP access), binds a resources server whose seed_session takes only the
legacy body (19 relays today, read from the server's source so a server
passes once it migrates), or its run cannot load an include. A relay that inherits
another keeps inheriting it, and the script refuses to switch only one
of the two. The default mode is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* fix(scripts): keep relays the switch would split or cannot drive

The pairing guard only compared `_inherit_from` children that carry their own
`legacy_agent` key, so a run that merged a switched relay with a same-name
`legacy_agent` override (the hle and apex_shortlist opencode/pi recipes) or a
bare `_inherit_from` child exited 0 with two environment server types.

- Resolve every run after the planned switches. A relay that a run merges with
  a legacy_agent server stays on the relay; when the relay it inherits switches,
  the script refuses (exit 2) and names the config. Top-level nulls now remove
  instances, as in Gym.
- Keep relays whose resources server reads the row's rollout coordinates
  (genrm_compare), whose implementation is not under resources_servers/, or
  that set keys the switched stanza would drop.
- Build every rewrite before writing any file; a stanza that cannot be found
  exits 2 instead of raising StopIteration.
- Dedupe scanned paths after resolving them.
- Give the hle and apex_shortlist opencode/pi recipes a legacy_agent server of
  their own, so their benchmarks can switch.
- Fix the docstring and docs examples, document the new stay reasons, note how
  to inherit the single_agent_turn templates, and test the legacy adapter with
  resources_server unset.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* fix(scripts): keep every same-name declaration of a split relay

When two files of a run declare the same relay (a base and a partial
override of it) and a later config merges it with a legacy_agent server,
split_servers found two switching entries for the instance itself and looked
for a different inherited relay that was not there, raising StopIteration.
Every declaration of the instance now stays on the relay; the script still
refuses (exit 2) only when a different relay the instance inherits switches.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* fix(config): preserve benchmark relay names in harness overrides

Signed-off-by: yaoyu-33 <[email protected]>

* chore(configs): move simple_agent configs off the legacy_agent relay

Runs scripts/add_legacy_agent_environment_servers.py --switch-simple-agent
over the repository (GYMINT-549). 287 relays in front of simple_agent in
279 config files become single_agent_turn_legacy servers of the same
name, so a crash repeats only the current step instead of the whole
episode, and simple_agent resumes inside its turn.

20 relays stay, as the script reports:
- 19 whose resources server seeds only the legacy body (workplace_assistant,
  openenv, newton_bench, indirect_prompt_injection,
  example_session_state_mgmt, and the SWE example configs); they move
  once their servers accept the typed seed.
- benchmarks/nemotron_3_ultra/benchmarks_no_external.yaml, whose include
  benchmarks/ruler/config_nemotron_3_256k.yaml does not exist on main.

Tests and docs that read these configs follow the new key. The
super35 container build now covers single_agent_turn_legacy too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* fix(configs): keep genrm_compare on the relay and soften the docs claim

Regenerated with the fixed --switch-simple-agent: genrm_compare's /verify needs
the row's _ng_rollout_index and cohort keys, which single_agent_turn_legacy does
not forward, so both genrm servers stay on legacy_agent. hle and apex_shortlist
still switch now that their opencode/pi recipes declare their own relay. The
YAML is byte-identical to a fresh generator run: 278 files, 285 relays switched,
22 kept.

The docs said every shipped simple_agent config uses single_agent_turn_legacy;
22 stay on the relay, so say "most" and name why.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* test(super35): expect 16 core server environments after the switch

The switched configs add single_agent_turn_legacy to the core batch's resolved
server set, so the prebuilt dependency check now reports 16 environment paths.
CI on Linux showed "16 server environment paths checked" against the old
expectation of 15; macOS Bash 3.2 stops these shell tests before the count.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* fix(agent): report simple_agent session tool calls as observations

With model-call capture on, a simple_agent episode run through an
Environment Server (single_agent_turn, single_agent_turn_legacy) lost
its executed tool records: the session kept only the trajectory's
invocations and gaps, so the collected ng_trajectory had no tool_calls
and ng_perf.num_tool_calls was 0, while /run reported them.

The session now adds a ToolCallObservation for each executed tool call
to the agent observations it returns at close. Rollout collection
already merges these into ng_trajectory.tool_calls and rejoins each
call's output from the invocation conversation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
(cherry picked from commit 2ef4896)
Signed-off-by: yaoyu-33 <[email protected]>

* fix(config): relay session-less agents swapped onto single_agent_turn_legacy

A `--agent-type` swap onto an environment fronted by single_agent_turn_legacy kept
that server type even when the incoming agent does not implement agent sessions,
so every episode failed with NotImplementedError from /v1/agent_sessions.
Composition now rewrites such a server to a legacy_agent relay that calls the
agent's own /run, keeping its entrypoint, agent_server and host/port.

AGENT_SESSION_AGENT_TYPES in global_config is the single list of session-capable
agent types; the legacy-relay migration script reads it instead of its own copy,
and a unit test keeps it in step with the agent apps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
(cherry picked from commit d156ef2)
Signed-off-by: yaoyu-33 <[email protected]>

* refactor(configs): retire tool_simulation_agent and non_executing_simple_agent into simple_agent

Both agents make one model call and pass its tool calls to the verifier
unexecuted. simple_agent with execute_tools: false does the same as an
agent session, so its configs run under single_agent_turn_legacy and
resume inside the turn after a crash (GYMINT-217, GYMINT-147).

14 configs move: image_tools_pivot, swe_pivot, structured_outputs_v4,
seven single_step_tool_use_with_argument_comparison configs and four
terminal_multi_harness configs. Each agent keeps its instance name and
becomes simple_agent with execute_tools: false; its relay becomes a
single_agent_turn_legacy server, which simple_agent needs since it
refuses /run without tool execution; allowed_agents gains simple_agent.

The pivot-dataset skill's template and reference config writer emit
the same pairing. Both agents stay, marked deprecated, so configs
outside the repository keep working until a later release removes them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* fix(configs): drop the unused tool grant from non-executing simple_agent configs

With execute_tools: false the agent never calls a tool, so the direct_http grant
on the 14 converted configs was unused, and the pivot skill's template already
omits it. It also made a silent mis-score possible: `--agent-type simple_agent`
is now allowed on these servers, composition does not carry execute_tools over,
and the swapped-in agent would execute tools through the grant against verifiers
that score one unexecuted call. Without the grant it fails loudly instead.

A repository test now asserts that no execute_tools: false simple_agent sits
behind a legacy_agent relay (its /run refuses) or gets a tool grant.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* fix(env): own resources bindings and resolve inherited renames

Signed-off-by: yaoyu-33 <[email protected]>

* fix(deepagents): close agent session gaps and run behind single_agent_turn_legacy

The DeepAgents agent inherited SimpleAgent's session seed, which accepted a
direct HTTP tool grant that its own responses() never used, and SimpleAgent's
resumable checkpoint support without SimpleAgent's activation tracking.

- Refuse a sandbox and any required tool grant at seed with a final 422;
  skip optional grants. The session holds no Resources cookie jar.
- Reject execute_tools=false at config load: the graph runs its own tools.
- Take part in checkpoints as restart-only (GYMINT-357 tracks resuming).
- On the session path, require the seeded session and stop mirroring
  request cookies; close reports observation gaps instead of nothing.
- Move the reasoning_gym and tavily_search DeepAgents configs from the
  legacy_agent relay to single_agent_turn_legacy with no tool grants.

Refs GYMINT-141.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* test(deepagents): expect single_agent_turn_legacy in the DeepAgents config test

The core config test still required the legacy_agent relay that this PR
replaces. Assert the new Environment Server, its Resources Server
reference and the empty tool-transport grant instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* docs(deepagents): note --agent-type transports and skip_verification, test the optional-grant jar

The README now says that an Environment Server this agent is swapped into with --agent-type must also send no
tool grant, and that skip_verification does not apply on the session path. The optional-grant test now closes
the session and checks that the grant's cookies never become the Resources cookie jar.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* fix(deepagents): preserve sessions across stack composition

Signed-off-by: yaoyu-33 <[email protected]>

* fix(configs): bind Resources Servers for environment servers switched on main

`resources_server` is now required on `single_agent_turn` servers, and four configs switched on main after this PR was generated did not set it: beam, mimo_music, and vision_arena_v1 in their Resources Server configs, and the vision_arena_v1 benchmark, which renames its Resources Server through `_inherit_from` while the parent stays loaded. Each binding is the Resources Server its agent already uses.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: weijia chen <[email protected]>

* test(deepagents): import sandbox access types from the nemo_gym.sandbox facade

test_public_api_facades requires code outside the library to import exported
names from the package's public API, not from nemo_gym.sandbox.access.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* fix(configs): bind renamed Resources Servers in benchmarks that compose

Five benchmark environment servers relied on the resolver to follow their
Resources Server rename. That works when the benchmark loads alone, but a run
that composes two benchmarks renaming the same Resources Server makes the
reference ambiguous, and the resolver refuses it with
AmbiguousResourcesRenameError. genrm_eval's test_mmrb composes genrm_mmrb1
and genrm_mmrb2 and fails this way. genrm_rewardbench2 and hle_diamond fail
the same way next to their sibling benchmarks, and indic/mbpp is bound for
consistency. Each binding is the Resources Server its agent already uses.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: weijia chen <[email protected]>

* test(config): import the binding test's parser from nemo_gym.config

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: weijia chen <[email protected]>

* refactor(deepagents): import agent session types from nemo_gym.agents

main moved nemo_gym.base_responses_api_agent to
nemo_gym.agents.base_responses_api_agent, and the agent session
conformance checks to nemo_gym.agents.testing. The old paths still
resolve but warn and go away in 0.10.0; nothing else on main imports
them.

Signed-off-by: weijia chen <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chore(configs): drop repeated timeouts from the DeepAgents configs

default_episode_timeout_seconds: 21600 and cleanup_timeout_seconds: 180
repeat the single_agent_turn_legacy server defaults. No other migrated
config spells them out, and the generator leaves them to the server
defaults, so drop them from the two DeepAgents configs. The composed
Environment Server configs still resolve to 21600 and 180.

Signed-off-by: weijia chen <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(deepagents): import agent session types from the nemo_gym.agents facade

Code outside nemo_gym/ imports exported names from the package's public
API; test_public_api_facades.py failed on the submodule imports of
AgentSeedRejectedError, AgentSeedSessionRequest, AgentCloseSessionRequest
and check_agent_seed_rejected, all of which nemo_gym.agents exports.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* feat(deepagents): run Deep Agents in a borrowed task sandbox

When the Resources Server lends its task sandbox (sandbox_access), the seed
connects to it as a borrower and builds the session's graph with a deepagents
backend that runs the execute tool and the file tools in that sandbox through
AsyncSandbox. deepagents' own files stay in graph state. Without
sandbox_access the graph runs in process as before.

A session runs one activation as a task: identical retries join it, other
requests answer 409, and close cancels a running graph before disconnecting.
Close never stops a borrowed sandbox and reports a sandbox record with the
run's outcome.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* feat(deepagents): run the deepagents graph inside the task sandbox

Replace the tools-only sandbox backend with the sandboxed-harness pattern that Stirrup and Hermes use. A new
sandbox_agent.py entrypoint (SandboxedDeepAgent) installs a private deepagents runtime in the borrowed or started
task sandbox with SandboxPythonRuntime, stages sandbox_runner.py, and runs deepagents' own graph there under
SandboxSession and Gym's process supervisor. Model calls go from the sandbox to the rollout-prefixed Model Server
URL, so the agent now honors a task's agent_timeout_sec, supports rollout stops, needs no Python in the task
image, and confirms the harness stopped before close returns.

The in-process DeepAgentsAgent goes back to refusing sandbox_access and keeps its single-activation and
close-cancel handling. The LangChain chat model moves to a Gym-free module that both paths share.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* refactor(deepagents): unify agent server entrypoints

Signed-off-by: yaoyu-33 <[email protected]>

* fix(deepagents): preserve usage and session failure evidence

Signed-off-by: yaoyu-33 <[email protected]>

* fix(deepagents): reject unsupported response token budgets

Signed-off-by: yaoyu-33 <[email protected]>

* fix(langchain_deepagents_agent): retry every transient model status

The sandbox runner retried model calls only on HTTP 408, 429, 500, 502,
503 and 504. It now retries 408, 425, 429 and every 5xx, as well as
connection failures, and still never another 4xx. The bound is
unchanged: 3 attempts, each wait at most 30 s, so at most 60 s of
waiting per model call.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* fix(deepagents): preserve lifecycle cleanup and incomplete usage

Signed-off-by: yaoyu-33 <[email protected]>

* test(deepagents): validate lifecycle regressions on Linux

Signed-off-by: yaoyu-33 <[email protected]>

* fix(deepagents): type in-process model refusals and apply request fields

- Declare calls_model_from_sandbox on the app.py entrypoint class: its default builtin profile calls the Model
  Server from the task sandbox, and Harbor reads that literal from source.
- In-process search sessions now answer a Model Server refusal that another episode attempt would not change
  (a non-retryable 4xx) with a typed reply instead of an HTTP 500 that reruns the episode: a
  context_length_exceeded refusal ends incomplete and is verified, any other ends failed with
  model_request_error and its status. Retryable statuses, transport failures and legacy /run still raise.
- The in-process graph now applies the request's instructions, temperature and top_p to every model call, as
  the builtin profile does; it silently dropped them before.
- Document that concurrency bounds only sandbox runs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* fix(deepagents): settle sandbox deadlines from the supervisor receipt

- A wall_time stop counts only when the supervisor's receipt shows the deadline. A SIGTERM from inside the
  sandbox, such as a task command `pkill python3`, now ends the run failed with agent_run_error instead of a
  graded timeout.
- A deadline before any model reply now ends failed with model_transport_error, which the outcome policy
  retries, instead of grading the model's empty answer. A rollout stop stays a graded stop.
- The runner writes its report before closing its event loop and exits without joining deepagents' file-tool
  threads, which its own timeouts do not stop; a stop no longer outlasts the supervisor's grace period and
  leaves no report. A SIGTERM while the runner still imports deepagents leaves an empty stop report.
- The close record says cancelled only for a run that never launched; a launched run with no report is oom or
  unknown.
- Cap the runner's error, traceback and output-log text in activation errors.
- Tests: bounded waits on the sandbox episodes, the setup-failure test checks the lent sandbox is
  disconnected, and new tests for each ending above.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* chore(ci): refresh DeepAgents PR synchronization

Signed-off-by: yaoyu-33 <[email protected]>

* fix(ci): scope PR release rehearsals to changes against main

Signed-off-by: yaoyu-33 <[email protected]>

* fix(ci): repair the secrets baseline JSON (NVIDIA-NeMo#6083)

NVIDIA-NeMo#5775 left the benchmarks/healthbench_professional/prepare.py entry unterminated, so detect-secrets cannot read the baseline and the secrets-detector check fails on every PR. Restore the missing is_secret field and closing brackets.

Signed-off-by: Chris Wing <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
(cherry picked from commit b2a2791)
Signed-off-by: yaoyu-33 <[email protected]>

---------

Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: weijia chen <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: Chris Wing <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: weijia chen <[email protected]>
Co-authored-by: Chris Wing <[email protected]>
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 benchmark-onboarding Self-contained benchmark onboarding community-request Issue reported or requested by someone from the community feature New capabilities, enhancements, or enablement work 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.

5 participants