Skip to content

feat(orchestration): run a Harbor task target from gym eval submit - #5978

Merged
adil-a merged 3 commits into
mainfrom
adasif/eval-prepare-harbor-target
Nov 19, 2026
Merged

adil-a merged 3 commits into
mainfrom
adasif/eval-prepare-harbor-target

Conversation

@adil-a

@adil-a adil-a commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

What changed

  • gym eval submit can run a Harbor task target. A benchmark under driver.benchmarks can set target, agent and sandbox. The Slurm and Kubernetes drivers put them first on the gym eval run line:
    gym eval run <target> --agent <agent> --sandbox <sandbox> +harbor_output_root=<job>/artifacts/harbor +output_jsonl_fpath=... <run settings>
  • +harbor_output_root=DIR moves a task target's rows, run config, skipped.json, images.json and verifier/ from the working-directory-relative results/harbor/<taskset>/ to DIR/<taskset>/. It works on the command line too. The oracle path (--agent harbor_oracle_agent) honours it, keeping its validation/ subfolder.
  • prepare: is unchanged from main. It runs exactly as configured, before the run. A dataset adapter can therefore write the task folders the target names: the adapter runs in prepare, then the run prepares and runs the target.
  • Validation refuses:
    • target without agent
    • agent or sandbox without target
    • an empty value
    • target with command
    • target with only_tasks, exclude_tasks or skip_unloadable under run. gym eval run reads those only as command-line flags, so it would ignore them.

Why

EFB launches benchmarks through gym eval submit, and on main a submitted job cannot run a Harbor task target:

  • run only carries +key=value tokens. They cannot express the positional TARGET or --agent/--sandbox.
  • The Harbor-backed benchmark config PR (feat(eval): run a benchmark config that names a Harbor target #5794) works through --benchmark NAME. It refuses a preset passed with +config_paths, and its own error message points to gym eval run <harbor_target> --agent <harness>. This PR is the submit form of that command.
  • command: cannot be combined with resumable.

main also writes a target's rows relative to the working directory. A submitted job's working directory is a fresh checkout on every allocation, and the rows path is part of the resume identity (datasets[].jsonl_fpath), so a continuation would be refused. +harbor_output_root keeps those files in the job directory.

No issue is filed. This came from an EFB user moving BioMysteryBench off the deprecated harbor_agent_general onto the task-folder path.

Changes since the earlier version of this PR

This PR was rebuilt on main after the Harbor-backed benchmark config PR (#5794) merged. It drops:

  • gym eval prepare TARGET and the preparation refactor. main's _prepare_for_agent covers the shared part.
  • Passing the target to prepare. That made prepare do Harbor preparation and skip a configured dataset adapter.
  • The resume fix for a task folder that moves between allocations. It will be its own fix(rollouts) PR. An absolute target on shared storage does not need it.

Validation

  • pytest tests/unit_tests/{orchestration,cli,data/tasks/harbor,rollouts,environment} -n 8: 7397 passed, 15 failed. The same 15 fail on unmodified main with the same venv: they need mlflow or jinja2, which are not installed there, or a different OpenTelemetry version. CI runs the full suite.
  • New tests:
    • test_slurm_script.py: target rendering, prepare unchanged, quoting, Hydra round trip of the output root, and validation
    • test_kubernetes_executor.py: target rendering
    • test_harbor_tasks.py::TestHarborOutputRoot: the same run config from two working directories, a quoted root, an invalid root, and the oracle path. The oracle test fails without its fix.
  • pre-commit run on the changed files: passed. Commits are signed off.

Rollout evidence

I submitted a real job with gym eval submit on an internal Slurm cluster. It ran the first commit (1d856c451, before the rebase). The second commit changes only the oracle path and validation, which this run does not use.

  • Benchmark: BioMysteryBench, with the EFB user's unchanged adapter config (gym_benchmark.yaml) in prepare.
  • Run: target: /data, agent: opencode_agent, sandbox: opensandbox.
  • Models: a hosted policy and a hosted judge.
  • Tasks: 2 tasks × 2 repeats. The adapter read a 2-task local source in place of the gated Hugging Face snapshot.

What happened:

  • Allocation 1: prepare ran the adapter into the empty mounted /data (Adapted 2 tasks to /data). The run wrote its run config, rows and verifier logs under <job>/artifacts/harbor/data/. A 25-minute walltime ended the allocation with 3 of 4 rows saved.
  • Allocation 2: it ran on a different node with a fresh checkout. prepare skipped the cached dataset, the run kept the 3 saved rows and collected the remaining one, and the chain ended with "the Store covers all 4 expected rollouts".
  • Rewards: 0, 0, 0 and 1. All four are judge verdicts on real answers, with no failed rows.

Compatibility

  • A benchmark without target renders and saves exactly as before: the serializer omits the unset fields.
  • Gym readers older than this version refuse a saved submit config with target, because benchmark configs are extra=forbid. A launcher must run this version or later to submit or recover such a job.

🤖 Generated with Claude Code

@copy-pr-bot

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

@adil-a
adil-a marked this pull request as ready for review November 10, 2026 23:31
@adil-a

adil-a commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 27cd525

@adil-a

adil-a commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

/review

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

@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 WITH CARE — two RISK findings in the submitted Harbor target workflow.

The automatic preparation can reject a correctly configured run, and resumable Slurm jobs using gym_install can reject unchanged tasks after the checkout location changes.

I inspected all 11 changed files and traced the affected CLI, configuration, rendering and resume contracts. This was a read-only source review; I didn't execute tests or cluster jobs. The acceptance checks below are proposed, not reported results.


Inline comments (escaped v1):

  • nemo_gym/orchestration/executors/slurm_script.py line 1117: RISK — The forced preparation ignores settings that make the target runnable.

    For a minimal case, use a valid task dataset declaring allowed_agents = ["hermes_agent"], then submit target: /data/tasks, agent: opencode_agent, prepare: {} and run: {allow_unsupported_pairing: true}. The generated preliminary command lacks the waiver, so preparation rejects the harness and set -e prevents the permitted run from starting. A direct target run receives the waiver through _prepare_target_run and passes the admission check. Run-only registry credentials, volume mappings and build settings can encounter the same configuration split.

    The smallest correction is to run a separate preparation only when explicitly configured; run_target already prepares with its effective run settings. Restore this condition here and at the equivalent Kubernetes branch:

        if benchmark.prepare:
    

    This preserves explicit non-empty preparation, target/agent/sandbox forwarding, and ordinary benchmarks' separate prepare/run settings. It removes only the extra, less-configured step. Update the empty-prepare test accordingly.

    Proposed acceptance: for both executors, render and exercise the waived-pairing setup above. With empty prepare, no separate preparation command should run, and the target run should pass admission. Without the waiver, admission must still reject the harness. Retain explicit non-empty preparation, quoted target arguments and unchanged no-target rendering. Verify the suggested change before adopting it; these checks weren't executed.

  • nemo_gym/data/tasks/harbor/materialize.py line 261: RISK — Generated dataset paths prevent submitted target runs from resuming across fresh checkouts.

    The new Slurm target invocation supports resumable: true, but driver.gym_install creates and enters a new /tmp/gym-install-XXXXXX/gym checkout for each allocation in render_driver_entrypoint. Harbor preparation writes its rows relative to that checkout, and this line embeds their absolute location in the generated agent's datasets list.

    After a partial run in checkout A, the next allocation prepares identical tasks in checkout B. Its datasets[].jsonl_fpath therefore differs. The collector retains that list in its configuration identity, and _is_semantic treats changes beneath datasets as semantic. The continuation is refused as incompatible configuration instead of retaining completed work and running the unfinished tasks. This affects automatic continuation and manual resubmission with a fresh installed checkout.

    Could you give submitted Harbor preparation a stable, benchmark-specific location under the mounted job directory, or narrowly normalize this generated row location during identity comparison while retaining content and dataset-contract checks? The exact patch depends on that placement decision. Don't make all dataset differences operational or enable unsafe resume: genuine task and dataset changes must remain protected.

    Preserve: standalone target preparation's documented output location; the submit job's absolute rollout output; isolation between benchmarks using the same taskset; rejection of changed task digests, selection, repeats and semantic dataset settings.

    Proposed acceptance: save a partial two-task target run from checkout A, then continue identical tasks/settings from checkout B. Resume should retain the successful rollout and dispatch only unfinished work. Change a task digest and assert refusal before dispatch. Also retain the assertion that changing num_repeats from 4 to 8 raises a semantic-drift error in the existing regression test. This finding is based on source tracing, not an executed cluster run.

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

@adil-a
adil-a force-pushed the adasif/eval-prepare-harbor-target branch from 27cd525 to 01dd931 Compare November 11, 2026 00:02
@adil-a

adil-a commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 01dd931

@adil-a

adil-a commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

/review reset=True

1 similar comment
@adil-a

adil-a commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

/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 WITH CARE — three RISK findings in submitted Harbor target runs.

Both failures from the previous review remain in the current source: automatic preparation can reject a permitted run, and fresh installed checkouts prevent unchanged Slurm runs from resuming. Submitted targets also leave verifier evidence outside durable job storage, including on non-resumable runs.

I inspected all 11 changed files and traced the affected CLI, configuration, rendering, storage and resume contracts. This was a read-only source review; I didn't execute tests or cluster jobs. The acceptance checks below are proposed, not reported results.


Inline comments (escaped v1):

  • nemo_gym/orchestration/executors/slurm_script.py line 1117: RISK — The forced preparation ignores settings that make the target runnable.

    The first finding from review 5851387697 remains unresolved. For a minimal case, use a valid task dataset declaring allowed_agents = ["hermes_agent"], then submit target: /data/tasks, agent: opencode_agent, prepare: {} and run: {allow_unsupported_pairing: true}. This branch emits a preliminary preparation without the waiver, so admission rejects the harness, and the entrypoint's set -e prevents the permitted run from starting. Run-only registry credentials, volume mappings and build settings encounter the same configuration split.

    Could you run separate preparation only when explicitly configured? run_target already prepares with its effective run settings. Replace this condition, and the equivalent Kubernetes condition, with:

        if benchmark.prepare:
    

    This removes only the implicit, less-configured step. Preserve explicit non-empty preparation, target/agent/sandbox forwarding, shell quoting, and ordinary benchmarks' separate prepare/run settings. Update the empty-prepare test, which currently requires the failure-producing command.

    Proposed acceptance: for both executors, render and exercise the waived-pairing setup above. With empty prepare, no separate preparation command should run, and the target run should pass admission. Without the waiver, admission must still reject the harness. Retain explicit non-empty preparation, a target containing spaces, and unchanged no-target rendering. Verify the suggested change before adopting it; these checks weren't executed.

  • nemo_gym/data/tasks/harbor/materialize.py line 261: RISK — Submitted targets still cannot resume across fresh installed checkouts.

    The second finding from review 5851387697 remains unresolved. Submit a two-task target at a stable mounted /data/ds with driver.gym_install, resumable: true and run: {reuse_existing_data_preparation: true}; let allocation A save one completed rollout. Each allocation creates and enters a fresh temporary checkout. The new submitted target invocation prepares rows relative to that checkout, and this line embeds their absolute location in datasets.

    Allocation B generates identical rows at another path. The collector retains the selected agent's datasets in configuration identity, treats datasets as semantic, and refuses continuation. Without input reuse, the persisted split metrics also retain the old dataset path and can reject preparation earlier. Unchanged tasks should instead retain completed work and dispatch only unfinished work.

    Could you give submitted preparation a stable, benchmark-specific root under mounted job storage? prepare_target already accepts output_root; that placement needs plumbing through _prepare_target_run and the submitted commands. Fetched and rendered task folders also need stable placement or narrowly defined location normalization: their generated tasksets.*.folder otherwise changes too. The interface choice isn't clear enough for a safe exact patch. Don't make all dataset/taskset differences operational or enable unsafe resume.

    Preserve: standalone preparation's documented location; submit's absolute rollout output; isolation between benchmarks sharing a target; and rejection of changed task digests, selection, repeats and semantic dataset settings.

    Proposed acceptance: save one of two tasks from checkout A, then continue identical settings from checkout B, both with and without reuse_existing_data_preparation. Retain the completed rollout and dispatch only the unfinished task. Repeat for fetched and parameterized targets. Changed task digests or selection must still refuse before dispatch; retain the existing assertion that changing repeats from 4 to 8 raises semantic drift. These checks weren't executed.

  • nemo_gym/data/tasks/harbor/materialize.py line 315: RISK — Completed submitted targets leave verifier evidence in the disposable checkout.

    This also affects non-resumable runs. Submit a target available inside the driver container with driver.gym_install and complete one episode. Installation changes into a temporary checkout, while preparation uses the relative results/harbor default. This generated artifacts_dir therefore points into /tmp/gym-install-…/gym/results/harbor/<taskset>/verifier, not the durable benchmark directory.

    The server downloads verifier rewards and logs there and records the absolute directory in the result. Slurm automatically mounts the benchmark directory, while Kubernetes mounts the output PVC. The rollout JSONL survives, but verifier files, prepared rows and the generated run config remain outside that storage. Their saved summary paths stop resolving after the container is discarded, removing evidence needed to inspect a wrong reward or verifier failure.

    Could you place submitted preparation outputs and the generated Harbor artifacts_dir under the mounted benchmark directory in both executors? A target-specific preparation-root contract through _prepare_target_run and prepare_target can do this without changing standalone defaults. Keep the generated config, result paths and summary pointing to the durable files; copying only the rollout JSONL isn't sufficient. The placement interface needs a decision, so I haven't supplied an exact patch.

    Preserve: standalone target preparation/run locations, separate output directories for benchmark leaves sharing a target, unique per-verification folders, collected artifacts, and submit's existing absolute rollout output.

    Proposed acceptance: complete one target episode through each executor, retain only mounted output storage, and assert that the saved summary's rows, run-config and verifier paths still resolve. Verify that the verifier directory retains reward.txt or reward.json, test-stdout.txt and trajectory.json; include a separate-verifier task and retain its collected artifacts/. Two benchmark leaves using one target must not replace each other's evidence. Retain the summary regression's concrete file/path assertions. These checks weren't executed.

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

@adil-a
adil-a force-pushed the adasif/eval-prepare-harbor-target branch from 01dd931 to 608e2c8 Compare November 11, 2026 00:51
@adil-a

adil-a commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 608e2c8

@adil-a

adil-a commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

/review reset=True

@svcnvidia-nemo-ci svcnvidia-nemo-ci added feature New capabilities, enhancements, or enablement work area:cli Command-line interfaces and user-facing command behavior needs-review PR is ready for code review and waiting on a reviewer labels Nov 16, 2026
adil-a and others added 2 commits November 17, 2026 15:54
A submitted benchmark can set `target`, `agent` and `sandbox`. The driver
passes them to `gym eval run` as its TARGET, `--agent` and `--sandbox`,
ahead of the `run` overrides, and adds `+harbor_output_root=<job>/artifacts/harbor`
so the rows, run config and verifier logs stay in the job directory rather
than the fresh checkout of each allocation. `prepare` still runs exactly as
configured, so a dataset adapter can write the task folders the target names.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
…nd refuse settings a target ignores

- `gym eval run TARGET --agent harbor_oracle_agent` prepares through the validation path; it now reads
  `+harbor_output_root` too, so a submitted oracle run does not write into the checkout.
- A submitted `target` refuses `only_tasks`, `exclude_tasks` and `skip_unloadable` under `run`:
  `gym eval run` reads them only as command-line flags, so they would be ignored.
- An empty `target`, `agent` or `sandbox` is refused at submit time.
- `render_target_args` takes its same-typed settings as keyword arguments.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
@adil-a
adil-a force-pushed the adasif/eval-prepare-harbor-target branch from 428c463 to b633ea3 Compare November 18, 2026 00:51
@adil-a adil-a added the area:orchestration Job submission, deployment, services, and lifecycle management label Nov 18, 2026
@adil-a adil-a changed the title feat(cli): run Harbor task targets from gym eval prepare and gym eval submit feat(orchestration): run a Harbor task target from gym eval submit Nov 18, 2026
@adil-a

adil-a commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test b633ea3

@adil-a

adil-a commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

/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 — LGTM; no concerns found.

I inspected all 12 changed files and traced configuration validation and serialization, CLI preparation, executor rendering, durable storage and resume identity. Two delegated reports weren't available, so I covered their CLI/preparation and executor topics directly.

The documented resume contract requires the target folder to stay stable across allocations. Within that contract, prepared rows and verifier artifacts use benchmark-local storage, while separate preparation keeps its configured adapter settings. The oracle path also uses the selected output root.

This was a read-only source review. I didn't execute tests or cluster jobs, so I haven't independently reproduced the validation and Slurm continuation reported in the PR.

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

@athitten

Copy link
Copy Markdown
Contributor

@giuliolovisotto can you help review this ? Thanks

@giuliolovisotto giuliolovisotto left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

Resolve tests/unit_tests/orchestration/test_slurm_script.py: keep main's
planned_log_sources tests and append this branch's task-target tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
@adil-a

adil-a commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test aea7be1

@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team November 19, 2026 19:18
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the risk:high Autobot PR risk: high label Nov 19, 2026

@giuliolovisotto giuliolovisotto left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-reviewed the merge of main at aea7be1. The conflict resolution preserves both the planned log-source tests and the task-target tests. All 35 focused tests passed. No new findings.

— @codex

@adil-a
adil-a added this pull request to the merge queue Nov 19, 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/44602267361

Merged via the queue into main with commit 6edf4be Nov 19, 2026
106 of 109 checks passed
@adil-a
adil-a deleted the adasif/eval-prepare-harbor-target branch November 19, 2026 20:05
wprazuch added a commit that referenced this pull request Nov 23, 2026
Main's `_omit_unset_target` (#5978) and this branch's `_omit_unset_node_local`
were both model_serializers on BenchmarkRunConfig. Pydantic keeps only one,
so saved configs gained `target`, `agent` and `sandbox` set to None. One
serializer now omits all four unset fields.

Signed-off-by: Wojciech Prazuch <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:cli Command-line interfaces and user-facing command behavior area:orchestration Job submission, deployment, services, and lifecycle management feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer risk:high Autobot PR risk: high sla:review-overdue Review response is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants