Skip to content

feat(harbor): parameterized tasks, in-sandbox Python verifiers, answer.md and publish --harbor (M31) - #4865

Merged
adil-a merged 2 commits into
mainfrom
adasif/harbor-m31-authoring
Oct 28, 2026
Merged

adil-a merged 2 commits into
mainfrom
adasif/harbor-m31-authoring

Conversation

@adil-a

@adil-a adil-a commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Gym's authoring extensions on top of Harbor's task folder (RFC M31, shrunk 14 Oct): parameterized tasks rendered into plain task folders at prepare, Python verifiers run inside the sandbox through a test.sh shim (no verifier code on the host), solution/answer.md the oracle writes to the working directory and submits as its response, and gym dataset publish --harbor, which expands the rows, writes the test.sh and solve.sh wrappers and runs Harbor's own task loader over the result. Chris Wing's six example environments (#3653) are added under environments/hello_*, each with a solution/, and run through gym dataset validate.

What changes

  • nemo_gym/tasks/harbor/parameterized.py (new): a template folder is a task folder with tasks.jsonl beside task.toml; a task_id is a single folder name of at most 255 bytes that is neither a file the rendered dataset root keeps (dataset.toml, tasks.jsonl, the records and their lock files) nor hidden (a longer one, like every other malformed row, is refused by tasks.jsonl line, not by an OSError from mkdir naming the staging path; a {{ that never closes, as in {{ a }{{ q }}, is refused like any other leftover placeholder); render_template_folder writes one task folder per row (<stem>.template<suffix> files rendered with {{ task_data.key }} / {{ key }}, everything else copied, hidden files under environment/, tests/, solution/ and steps/ included since the task digest covers them, only what the digest skips and the template root's hidden entries and README.md left out, two entries that would land under one name refused naming both, a task_data.json or task_data.template.json at the template root refused up front (the rendered task's task_data.json is written from its row), the row's fields as task_data.json, and the rendered task.toml carrying its own [task].name, <org>/<task_id>, since Harbor keys a dataset on that name and harbor add keeps one folder per name; a template name that is not org/name, a name spelled other than name = "..." under [task], or a task_id Harbor would refuse in a name fails prepare naming the row), deterministically, with dataset-level files beside them. prepare_target renders a template target into results/harbor/<taskset>/rendered/ first (gym dataset validate too, through a render_root separate from its results/harbor/validation/ output root: the rendered folder is the dataset root prepare records into, so one render, one manifest and one built image serve both commands), so the manifest, images, loader, rows and servers read files; a re-render is rendered beside the output and swapped in entry by entry (an unchanged task folder stays in place, a changed one is replaced by rename, a stale one removed, a failed render changes nothing) and keeps prepare's records there (manifest.toml, compose-images.json, built-images.json), so a template's built image is reused rather than rebuilt and pushed on every run and a server still seeding from an earlier prepare never meets a folder being rewritten. gym dataset init --parameterized scaffolds the shape.
  • nemo_gym/verifiers/ (new, standard library only, held to Python 3.8: no 3.9+ syntax or string methods, since it runs under whatever python3 the task image has; the shim's test.sh checks that floor and exits 127 naming the version found, instead of letting verify() die in a SyntaxError or AttributeError with no reward): final_text, exact_match, numeric_match; files.read_text, file_exists, text_file_equals; runner.py, the in-sandbox runner that ranks the vendored nemo_gym first on sys.path however it was started (the shim's test.sh runs it as a plain script, so a nemo_gym shipped in, or planted into, the task's own tests/, or on the image's PYTHONPATH, never replaces the helpers), loads verify, passes the arguments it declares (workspace, task_data, response, state; an async def verify is awaited) and writes reward.txt / reward.json. A verify that requires response where there is none (every published Harbor task) is a contract error with no reward, not a call with response=None. The shim's test.sh removes any reward.json/reward.txt already in /logs/verifier before the runner starts, and the runner again before verify runs: Harbor shares that folder with the agent's container for the whole run and reads reward.json first, so a planted file would otherwise be a published task's verdict (Gym's server empties the folder before every upload; Harbor does not).
  • nemo_gym/tasks/harbor/python_verifier.py (new): tests/verifier.py grades a task that has no tests/test.sh (test.sh wins whenever it exists: on the hub a tests/verifier.py beside it is the helper test.sh runs, the shape of 466 of the 12,704 tasks in the 15 Oct hub scan sample, whole datasets among them, so such a task is a plain test.sh task and the module an ordinary test file); a dataset-root verifier.py grades tasks without tests/ and enters their digest and, with task_data.py, the dataset identity (manifest.toml gains dataset_files_digest when a dataset ships either file; datasets without them hash as before). write_shim builds the /tests overlay (test.sh, .ng/run_verifier.py, vendored nemo_gym/verifiers, task_data.json, response.json, the module when dataset-level); declared_arguments reads verify's parameters from source without importing.
  • environment_servers/harbor: the server uploads the shim over /tests after the task's own tests/ in shared and separate mode and runs it under the usual wrapper with the session workdir as the workspace; the agent's final response reaches the shim; a dataset-level verifier.py travels with the task snapshot.
  • responses_api_agents/harbor_oracle_agent: a task with solution/answer.md and no solve.sh has the oracle write the file's text to answer.md in the working directory, as the task user, with the command the published solve.sh runs under Harbor's oracle (publish.answer_write_command, one source for both), and submit the same text as its response (oracle_solution: answer). The file is read as bytes (base64 over the sandbox exec, decoded on the host), never as raw exec stdout: OpenSandbox's foreground exec (its default) rebuilds stdout from per-line messages, which drops a trailing newline, doubles blank lines and loses CRs, and the file and the response must be the answer byte for byte. A workdir that refuses the write, an image without base64 and an answer.md that is not UTF-8 text are oracle: failed with oracle_error_type: answer. A verifier that reads workspace / "answer.md" therefore grades identically in Gym and under Harbor (the publishable shape); a response reader is Gym-only. HarborTask.has_solution counts the file.
  • nemo_gym/tasks/harbor/publish.py (new) and gym dataset publish --harbor TARGET --output DIR: expanded rows checked against the dataset's task_data.py first (the check prepare runs), written into a staging folder beside the output and moved there once every task published (a refused publish leaves nothing behind), Python verifiers wrapped with the module under tests/.ng/verifier.py so the published folder holds one grader and loads back into Gym, answer.md wrapped in a solve.sh that writes it to answer.md in the workdir, dataset.toml written without its [gym] table (Harbor's own tables byte for byte, as the RFC has it; what remains needs a [dataset] table with an org/name name, refused otherwise with or without the harbor package, Harbor's DatasetManifest reads the published text as part of the format check, and a file that held [gym] alone is not published, the report saying so, since harbor add takes the dataset branch whenever the file exists), Gym-only files left behind, a task folder holding a symbolic link refused naming the link (publish does not follow links; the loader, renderer and hub fetcher refuse them too). Refused with the task named: a verifier reading response, and a Python verifier whose task grades in Harbor's separate verifier mode (environment_mode = "separate" or a [verifier.environment] table), because Harbor uploads nothing into a separate verifier container and the shim could never run there (Gym's server uploads it in both modes, so such a task stays Gym-only). Harbor's Task loader checks every folder in the staging folder when harbor is installed (not a dependency; the report says how to install it; a harbor that does not import, or a module of that name that is not Harbor, is an error naming the problem rather than a skipped check, and nothing is published), and the folders move into --output only once every task passed, so a publish refused by Gym or by Harbor leaves nothing behind and a retry into the same folder works; the CLI exits 1 for a folder Harbor refuses, 2 for a publish error. Re-publishing an already-published folder keeps the shim's tests/.ng/task_data.json. A multi-step task ([[steps]]) is copied as it is with no shim, even under a dataset-level verifier.py, as Gym never grades one by a Python verifier; two folders sharing a [task].name are refused naming both.
  • environments/hello_world, hello_dataset, hello_mcp_tool, hello_python_verifier, hello_verifier_reuse, hello_parameterized_tasks from design(environments): prototype Harbor task authoring #3653, each with solution/solve.sh (the parameterized one ships solution/answer.template.md, the reference answer rendered per row, with its verifier reading /workspace/answer.md; it also gains task_data.py and dataset.toml) and a "Validate it" section; prepare's records under environments/ are gitignored. gym dataset init --parameterized scaffolds the same answer shape: template placeholders are inserted verbatim, so a reference answer is a rendered text file, never a value inside a quoted shell literal of a solve.sh.
  • Docs: harbor README "Authoring Gym datasets", the Harbor tasks page (parameterized tasks, Python verifiers including the separate-mode [verifier] artifacts requirement for a workspace-reading verifier, answer.md and its publishable shape, publish --harbor, worked examples, --parameterized), the CLI reference.

Test plan

  • tests/unit_tests/test_harbor_authoring.py (73 new): rows and placeholders, deterministic rendering, prepare over a template (and the template's TaskData refusing a row), the example template, verifier detection and the dataset verifier in the digest, the shim layout and test.sh, the runner in a fresh interpreter started as test.sh starts it (a plain script, no -I; workspace grading, response and metric dicts, contract errors), helper functions, answer.md as a solution, every example's solution, publish (expansion, wrappers, refusals, CLI, a published task loading back and grading through its shim), positional-only verify parameters, the example's typed rows, the parameterized scaffold end to end, a second prepare of a template reading the records the first left, and the answer.md round trip (publish, Harbor's loader, the published solve.sh leaving answer.md, the published shim scoring 1.0, the oracle's command leaving the same bytes). Also: an identical re-render leaving every rendered inode in place (and a failed render changing nothing), publish refusing a TaskData-violating template with prepare's message, a tests/task_data.json kept while the root one stays behind, a refused publish leaving no output and a retry succeeding, a module named harbor that is not Harbor reported as an error, and the re-published shim grading 1.0 with its own task fields; hidden task files rendered with their modes (and a hand-written twin digesting the same), a rendered-name collision refused naming both files, the published dataset.toml holding Harbor's tables only (read by Harbor's DatasetManifest), a Harbor-refused publish leaving nothing under --output with the retry into the same folder succeeding; every rendered and published parameterized task carrying its own [task].name (Harbor's Task(...).name distinct, the unreachable spellings and a bad task_id refused), two plain folders sharing a name refused, a [[steps]] task published without a shim and loading back as the source does; planted reward.json/reward.txt (files, a folder, a link) never surviving the shim's test.sh order or the runner (an honest 0.0 is what Harbor's read order yields, a raising verify leaves nothing); a [gym]-only dataset.toml publishing no manifest with the report saying so, a bare or .. [dataset].name and a missing [dataset] table refused without harbor, Harbor's DatasetManifest refusing a published manifest (reported under dataset.toml, alone and beside a refused task, nothing published, the retry succeeding), and a symbolic link in tests/ (outside the dataset or inside the task) refused naming the task and the link while a link under an ignored name is not a task file; test_harbor_manifest.py gains the dataset-level verifier.py / task_data.py digest test. Core files together: 1000 passed (plus the two env.yaml-dependent validation tests, 34 passed without it).
  • environment_servers/harbor/tests/test_python_verifier.py (9 new): the shim is uploaded over the task's tests and graded as test.sh with the response and workspace, in shared and separate mode (including a verifier image that bakes its own /tests/test.sh); a dataset-level verifier travels in the shim and the snapshot; an edited one is refused by the digest; a test.sh task uploads no shim; no shim folder outlives its upload. Oracle: answer.md read as base64 and written to the workdir as the task user with the published wrapper's command and submitted as the response, byte for byte under a provider that re-joins exec stdout line by line (4 answers x 2 re-joins), a workdir that refuses it, an image without base64 or a non-UTF-8 answer a failed oracle naming the reason, a lost sandbox on the probe or the read not scored. Env server + oracle suites: 465 passed (428 + 37).
  • Also covered: publish refusing a separate-mode Python verifier (explicit and implied) while a shared-mode one and a separate-mode test.sh task publish; Harbor's loader refusing a folder without instruction.md (report, ok is False, CLI exit 1; exit 0 once fixed; skipped without harbor); reserved and hidden task_ids named by line; the runner's response contract error (def and partial), a defaulted response, and an async def verify; the scaffold with a reference answer containing an apostrophe, graded 1.0 by Gym's oracle command and by the published solve.sh + shim.
  • ruff check, ruff format --check, pre-commit over the changed files.
  • Live on OpenSandbox with the oracle (gym dataset validate): all six examples (hello_mcp_tool through an arm64 buildah build pushed to the GitLab registry and run on an arm64 pod; Python verifiers graded in the sandbox by the shim in shared mode and, for a separate-mode copy of hello_python_verifier, in a fresh container from another image; the parameterized template rendered and typed), a published hello_verifier_reuse loaded back and graded through its published shim, and the answer.md round trip: a dataset whose verifier reads workspace / "answer.md" scores 1.0 under Gym's oracle (which now leaves the file), publishes (Harbor 0.22.0's loader accepts it) and scores 1.0 again from the published solve.sh and shim; a response-reading answer dataset still scores 1.0 in Gym and is refused by publish.
  • Repair-round-4 repros on the fixed code: a published hello_parameterized_tasks published again keeps tests/.ng/task_data.json and its shim grades 1.0 (and the twice-published copy validated live on OpenSandbox); a TaskData-violating copy of the template exits 2 naming the task with no output; a refused dataset leaves no output and the retry succeeds; two prepares of the template keep every rendered task folder's inode; a dataset-level grader edit changes the dataset digest and rewrites the manifest naming the file.
  • Repair-round-6 repros on the fixed code: a scaffolded parameterized dataset renders and publishes local/hello-1, local/hello-2 (Harbor 0.22.0's Task(...).name and its harbor add --scan merge keep both, where before both folders were local/hello and merged into one); two copies of hello_world are refused with both named, exit 2, nothing under --output; a [[steps]] task under a dataset-level verifier.py publishes without a shim and loads back with no Python verifier; the scaffolded dataset and its published copy validated live on OpenSandbox with the oracle.
  • Repair-round-7 repros on the fixed code: a hub-shaped dataset (two tasks whose tests/test.sh runs tests/verifier.py, plus a [dataset] key named gym and a [gym] table in dataset.toml) loads with python_verifier unset, is discovered whole, publishes verbatim (tests/ byte-identical, no shim, Harbor format check: 2 task(s) valid, the [dataset].gym key kept while the [gym] table goes) and loads back; a scaffolded template with {{ task_data.question | upper }} in instruction.template.md fails prepare naming hello-1 and the file, with nothing rendered. Live on OpenSandbox: the hub-shaped dataset and its published copy both oracle solved 1.0 through their own test.sh.
  • Repair-round-10 repro on the fixed code, live on OpenSandbox under the provider's foreground exec path (++sandbox.opensandbox.operations.background_exec=false, the default and what an env.yaml block without operations gives): a dataset of two answer.md tasks (b"72\n" and b"first\n\n\nlast line\r\nend\n") whose verifiers compare the bytes of the answer.md the oracle leaves scored 0.0 on both at the previous code (submitted '72' and 'first\n\n\n\n\nlast line\nend') and 1.0 on both after the fix (the exact bytes), and 1.0 again under the shipped background_exec: true setting.
  • Repair-round-9 repros on the fixed code: gym dataset validate over a template holding {{ a }{{ question }} and over one with a 300-byte task_id both exit 2 naming the task or the tasks.jsonl line (no traceback, no staging path, nothing rendered); the vendored nemo_gym.verifiers and the whole runner run under a real CPython 3.8.20 (every argument path, async, dict rewards, the contract errors) where text_file_equals used to raise AttributeError, and the shim's check line refuses a fake 3.6 with the version named. Live on OpenSandbox: hello_parameterized_tasks validated with both tasks 1.0 and rendered into results/harbor/hello_parameterized_tasks/rendered, then prepared again by the eval-run path into the same folder with the manifest, the recorded images and every task folder's inode kept; hello_python_verifier and its published copy (whose test.sh carries the Python-floor check) both 1.0.
  • Repair-round-11 repro on the fixed code, live on OpenSandbox: a dataset of two Python-verifier tasks whose tests/verifier.py imports exact_match from nemo_gym.verifiers, one of them shipping a tests/nemo_gym/verifiers/__init__.py whose exact_match returns 42.0, scored 42.0 on that task at the previous code (the runner, started by test.sh as a plain script, searched /tests before the vendored /tests/.ng; the verifier log names /tests/nemo_gym/verifiers/__init__.py) and 1.0 on both after the fix, the verifier log naming /tests/.ng/nemo_gym/verifiers/__init__.py. The runner tests now start it the way test.sh does (no -I), and a new test plants tests/nemo_gym/ beside a task-level and a dataset-level module.
  • gym dataset publish --harbor on hello_parameterized_tasks (answer shape: answer.md -> solve.sh, verifier -> shim, dataset.toml without [gym]; the published folder validated live by Gym again, both tasks 1.0), hello_verifier_reuse, hello_python_verifier, hello_world and the workspace-reading answer dataset: Harbor 0.22.0's loader accepts every published folder; a response-reading verifier and the separate-mode Python verifier that was validated live under Gym are refused with the task named; a dataset with a folder Harbor refuses exits 1 naming it and leaves nothing under --output.

🤖 Generated with Claude Code

@adil-a

adil-a commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test d7135be

@copy-pr-bot

copy-pr-bot Bot commented Oct 21, 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 added this pull request to stack #4793 October 21, 2026 16:26
@svcnvidia-nemo-ci svcnvidia-nemo-ci added area:data Datasets, preparation, task formats, and materialization feature New capabilities, enhancements, or enablement work waiting-on-maintainers Waiting on maintainers to respond labels Oct 21, 2026
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team October 21, 2026 16:40
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

@adil-a

adil-a commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 665f3e4

@adil-a

adil-a commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 9082e48

@adil-a

adil-a commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 3490e96

@adil-a

adil-a commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 148f4f0

@adil-a

adil-a commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 944962a

@adil-a

adil-a commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test f31da4e

yuhezhang-ai
yuhezhang-ai previously approved these changes Oct 26, 2026

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

Thanks, Adil—I rechecked the current head against #4864. The three priority findings are resolved, and the fixes for rendering coordination, linked roots, long answers, and line endings look good.

The missing-tests case is fixed in shared mode here. Separate mode still reproduces on #4865, but I confirmed the correction and regression test in #4951. I consider that addressed for the combined stack, provided #4951 ships with it.

I’m satisfied with these review fixes. Before merge, please link the representative model smoke-run evidence; the documented oracle runs exercise the reference solutions.

@adil-a

adil-a commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 731e5bd

@adil-a

adil-a commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 9a0a78a

ffrujeri
ffrujeri previously approved these changes Oct 26, 2026

@ffrujeri ffrujeri 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, thanks.

@adil-a

adil-a commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test ced78fb

@adil-a

adil-a commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test a8023b9

yuhezhang-ai
yuhezhang-ai previously approved these changes Oct 26, 2026

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

Thanks for addressing the review findings. Rechecked this revision against the current #4864 parent: the authoring patch is unchanged from the reviewed version, and I found no new compatibility issue in the relevant inherited changes.

Approving as part of the combined stack including #4951, which contains the verified separate-verifier missing-tests correction. This is code-review approval; CI still has tests in progress and a nonblocking harness-conformance failure.

ffrujeri
ffrujeri previously approved these changes Oct 26, 2026

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

@adil-a

adil-a commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 5925bab

@adil-a

adil-a commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 3db66f4

@adil-a

adil-a commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 743df1d

@adil-a

adil-a commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 7852a18

ffrujeri
ffrujeri previously approved these changes Oct 27, 2026

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

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

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

@adil-a

adil-a commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 90a15c9

yuhezhang-ai
yuhezhang-ai previously approved these changes Oct 27, 2026

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

Rechecked the latest revision against the current #4864 stack base. The authoring patch is unchanged from the previously reviewed version, and I found no new blocking issue in the relevant inherited changes.

The earlier findings remain addressed across this PR and #4951, which still contains the separate-verifier missing-tests correction. Approving for the combined stack. Core/server tests and lint pass; the Kilo harness-conformance failure remains labeled nonblocking.

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

…r.md and publish --harbor (M31)

Gym's authoring extensions on top of Harbor's task folder, all rendered to
plain files before any server reads them:

- Parameterized tasks: a template folder (task.toml with tasks.jsonl beside
  it) is rendered at prepare into one task folder per row under the taskset's
  output folder; `<stem>.template<suffix>` files take the row's fields through
  `{{ task_data.key }}`, everything else is copied (hidden files under
  environment/, tests/, solution/ and steps/ included, as the digest covers
  them; what the digest skips, the template root's hidden entries and its
  README.md are not), two entries that would land under one name are
  refused naming both, any other `{{ ... }}` left in a rendered file (a misspelt
  placeholder) is refused naming task and file, and the row becomes the task's task_data.json (typed
  by the template's task_data.py), with its own [task].name, <org>/<task_id>
  (Harbor keys a dataset on that name and `harbor add` keeps one folder per
  name; a template name that is not org/name, a name spelled other than
  `name = "..."` under [task], or a task_id Harbor would refuse in a name
  fails prepare naming the row). Deterministic. A task_id is at most 255
  bytes (a folder name's limit; a longer one is refused by line like any
  other malformed row, not by mkdir naming the staging path), and a `{{`
  that never closes (`{{ a }{{ q }}`) is refused like any other leftover.
  A template renders into results/harbor/<taskset>/rendered under
  `gym dataset validate` as under `gym eval run` (validate keeps its rows
  and results under validation/): the rendered folder is the dataset root
  prepare records into, so one render, one manifest and one built image
  serve both commands.
  A re-render is rendered beside the output and swapped in entry by entry
  (an unchanged task folder stays in place, so a server still seeding from an
  earlier prepare never meets a folder being rewritten) and keeps prepare's
  records in the rendered folder (manifest.toml, compose-images.json,
  built-images.json), so a template's built image is reused, not rebuilt and
  pushed on every run.
  A task_id that names a file the rendered dataset root keeps (dataset.toml,
  the records and their lock files) or is hidden is refused by line.
  `gym dataset init --parameterized` scaffolds the shape, with the reference
  answer as solution/answer.template.md: placeholders are inserted verbatim,
  so an answer is a rendered text file, never a quoted shell literal.
- Python verifiers: tests/verifier.py grades a task that has no tests/test.sh
  (test.sh wins whenever it exists: on the hub a tests/verifier.py beside it
  is the helper test.sh runs, the shape of whole datasets, so such a task is
  a plain test.sh task and the module an ordinary test file); a dataset-root verifier.py grades tasks without tests/ and
  enters their digest and, with task_data.py, the dataset identity
  (manifest.toml's dataset_files_digest, written only when present).
  verify() declares what it reads (workspace, task_data,
  response, state; positional-only parameters are passed by position) and
  returns a number or a dict with `reward`. No verifier code runs on the host:
  the environment server uploads a shim over /tests (test.sh, the runner, a
  vendored stdlib-only nemo_gym.verifiers held to Python 3.8 (the shim
  refuses an older interpreter with the version named, exit 127, no reward,
  instead of a SyntaxError or AttributeError inside verify()), the task's
  fields, the agent's
  response) from a folder that lives for the upload only, and runs it under
  the usual wrapper with the session workdir as the workspace, in shared or
  separate mode (a verifier image's own test.sh is not the grader of such a
  task, so its tests/ and the shim go over it; in separate mode a workspace
  reader needs `[verifier] artifacts` to carry the workdir, as documented).
  A verify() that requires `response` where there is none (every published
  task) is a contract error with no reward, not a call with None; an
  `async def verify` is awaited. The shim removes any reward.json/reward.txt
  already in /logs/verifier before the runner starts, and the runner again
  before verify() runs: Harbor shares that folder with the agent's container
  for the whole run and reads reward.json first, so a planted file would
  otherwise be a published task's verdict (Gym's server empties the folder
  before every upload; Harbor does not).
- solution/answer.md: for a task verified by its answer the oracle writes the
  text to answer.md in the working directory, as the task user, with the very
  command the published solve.sh runs under Harbor's oracle
  (publish.answer_write_command), and submits it as the response; a verifier
  reading workspace/answer.md grades the same in Gym and under Harbor (the
  publishable shape), a `response` reader is Gym-only. has_solution counts it.
  The oracle reads the file as bytes (base64 over the sandbox exec, decoded
  on the host), never as raw exec stdout: a provider that rebuilds stdout
  from per-line messages (OpenSandbox's foreground exec, its default) drops
  a trailing newline, doubles blank lines and loses CRs, and the file and
  the response must be the answer byte for byte. An image without base64 or
  an answer that is not UTF-8 text is a failed oracle naming the reason.
- gym dataset publish --harbor TARGET --output DIR: expanded rows checked
  against the dataset's TaskData first (prepare's check), Python verifiers
  wrapped in tests/test.sh with the module under tests/.ng/ (one grader per
  published task, so the folder loads back into Gym and publishes again with
  its task fields), answer.md wrapped in solution/solve.sh, dataset.toml
  written without its [gym] table (Harbor's tables byte for byte; what
  remains needs a [dataset] table with an org/name name, refused otherwise
  with or without the harbor package, and a file that held [gym] alone is not
  published, as `harbor add` takes the dataset branch whenever the file
  exists), Gym-only files left behind, Harbor's own Task loader run over
  every folder and its DatasetManifest over the published dataset.toml in
  the staging folder when the `harbor` package is installed (not a
  dependency; a harbor that does not import is an error, not a skipped
  check), a task folder holding a symbolic link refused naming the link
  (publish does not follow links), and the
  folders moved into the output only once every task published and passed:
  a publish refused by Gym or by Harbor leaves nothing behind and the CLI
  exits 1 for a folder Harbor refuses. Refused with the task named: a verifier reading
  `response`, and a Python verifier whose task grades in Harbor's separate
  verifier mode, since Harbor uploads nothing into a separate verifier
  container and the shim could never run there (Gym-only shapes); two
  folders sharing a [task].name (Harbor would keep one). A [[steps]] task is
  copied as it is, with no shim even under a dataset-level verifier.py: Gym
  grades its steps by test.sh alone.
- environments/hello_* (Chris Wing's six examples, #3653), each with a
  solution/ that gym dataset validate plays; the parameterized one ships
  task_data.py, dataset.toml and solution/answer.template.md with a verifier
  reading /workspace/answer.md; prepare's records under environments/ are
  gitignored.
- Docs: harbor README "Authoring Gym datasets", the Harbor tasks page and
  the CLI reference.

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

adil-a commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test b637590

content_hash refused any link under the task folder that pointed outside it, before narrowing to
the files it hashes. A task root holding an author's `.venv/` (whose interpreter is a link to the
host Python) or `.git/` could therefore not be digested, although neither is part of the task and
publish already leaves both behind. test_publish_copies_only_what_the_digest_covers failed on
this: content_hash(task) raised "Task symlink escapes the task folder: .venv/bin/python".

The link check now walks the top-level task files and the environment/, tests/, solution/ and
steps/ folders, the paths the digest reads. Links inside them are refused as before.

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

adil-a commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 6c0fbfe

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

Rechecked against the current main base after #4864 merged. The original authoring patch is unchanged, and the added digest symlink-scoping fix passed 15 focused filesystem checks. No new blocking findings.

Approving for the combined stack, including #4951's separate-verifier missing-tests fix. The earlier findings remain addressed across these PRs. Current core tests, all server test shards, and lint pass; the Kilo harness-conformance failure remains labeled nonblocking.

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

This branch was previously deployed

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

Labels

area:data Datasets, preparation, task formats, and materialization feature New capabilities, enhancements, or enablement work QA_verified waiting-on-maintainers Waiting on maintainers to respond

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants