Skip to content

design(environments): prototype Harbor task authoring - #3653

Closed
cwing-nvidia wants to merge 2 commits into
mainfrom
feat/harbor-task-authoring-prototype
Closed

cwing-nvidia wants to merge 2 commits into
mainfrom
feat/harbor-task-authoring-prototype

Conversation

@cwing-nvidia

Copy link
Copy Markdown
Contributor

Summary

This PR prototypes a simpler way to author tasks in NeMo Gym by adopting Harbor's format for directory-based tasks, with proposed extensions for Python verifiers and parameterized task generation.

In the proposed common workflow, task authors do not write or configure an Environment Server, Agent Server, or Resources Server. NeMo Gym selects and composes those runtime components.

Review the six examples in this order:

  1. hello_world introduces one complete Harbor-compatible task.
  2. hello_dataset groups independently authored tasks into one dataset.
  3. hello_mcp_tool adds a task-provided MCP tool.
  4. hello_python_verifier expresses task-specific scoring in Python.
  5. hello_verifier_reuse composes scoring from curated NeMo Gym helpers and task-specific Python.
  6. hello_parameterized_tasks generates similarly structured tasks from JSONL records.

Each README stands alone and separates the general concept from the details of its small example.

Motivation

New NeMo Gym users should be able to understand what an agent must do, what the task needs, and how success is checked without first learning NeMo Gym's internal server topology.

Existing Harbor users should also be able to bring compatible task directories into NeMo Gym without translating them into a NeMo Gym-specific directory format. NeMo Gym can extend this foundation with authoring conveniences, such as Python verifiers and parameterized tasks, while preserving a portable and inspectable task artifact.

No issue is linked because this is a focused design prototype intended to gather early author and maintainer feedback.

Design under review

Canonical task directory

The minimal task directory follows Harbor 0.23.0 task schema 1.4:

task/
├── instruction.md
├── task.toml
├── environment/
│   └── Dockerfile
└── tests/
    └── test.sh

The task declares its environment requirements. The person running it selects the compatible agent, model, sandbox provider, and run-level resources.

NeMo Gym authoring extensions

Harbor task directories remain the portable output, but they are not always the most convenient authoring form. The examples explore two NeMo Gym extensions:

  • Authors can write tests/verifier.py to reuse existing Python validation code and libraries instead of translating their checks into shell. NeMo Gym generates the Harbor-compatible shell entry point and reward output.
  • Authors can maintain many similarly structured tasks as JSONL records instead of copying the same files into many directories. NeMo Gym renders each record into a complete, inspectable task directory before execution.

The proposed verifier contract rejects a task containing both tests/test.sh and tests/verifier.py, avoiding ambiguous scoring behavior.

Scope

This PR changes only the examples under environments/hello_*.

It does not implement or modify:

  • Environment Server behavior
  • HarborEnvServer
  • task discovery or materialization
  • generated Python verifier launchers
  • sandbox execution
  • gym eval run CLI behavior

Those runtime changes will be developed and reviewed separately.

Feedback requested

For task authors

  • After reading Hello World, can you explain what the agent must do, where it runs, and how success is checked without knowing NeMo Gym's server architecture?
  • Can you identify the minimum files needed for a task and which files you would change to create your own?
  • Can you choose when to use one task, a dataset of independently authored tasks, or parameterized tasks generated from JSONL records?
  • Is it clear which files follow Harbor's task format and which capabilities are proposed NeMo Gym authoring extensions?
  • Do the Python examples make it clear when to write a task-specific verifier, reuse a complete verifier, or build one from shared helpers?
  • Does the run command make it clear that the agent, model, and sandbox are selected at run time and can be replaced without changing the task?
  • Where does an example assume prior knowledge or introduce more than one new concept?
  • What exact output, fields, or artifacts would you need after a run to understand what happened and trust the score?

Validation

  • Harbor 0.23.0 validates the exact Harbor tasks against schema 1.4 and discovers both tasks in hello_dataset.
  • Focused source, verifier, shell, README link, Ruff, formatting, and pre-commit checks pass.
  • Rollout evidence: N/A because this authoring design prototype intentionally excludes the runtime needed to execute the proposed workflow.

Compatibility

This PR does not migrate or change existing NeMo Gym tasks, datasets, Resources Servers, request behavior, or reward behavior.

The proposed extensions are not yet stable public APIs. Their runtime contract, Harbor version policy, materialization behavior, verifier packaging, and trust boundaries must be resolved before they are presented as shipped functionality.

@copy-pr-bot

copy-pr-bot Bot commented Sep 23, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@hwolff99

Copy link
Copy Markdown
Contributor

After reading Hello World, can you explain what the agent must do, where it runs, and how success is checked without knowing NeMo Gym's server architecture?

Yes

Can you identify the minimum files needed for a task and which files you would change to create your own?

Yes, with the exception of I’m not sure how/if I can reuse artifacts like MCP tools.

Can you choose when to use one task, a dataset of independently authored tasks, or parameterized tasks generated from JSONL records?

Somewhat. I’d make one task when it’s not going to be a benchmark that needs to all be packaged
together for clarity and reusability of the whole set of tasks. I’d use a set of tasks especially when
they may share some verification logic, instruction formatting, or base runtime.

One question I have is what if I want different runtimes for the tasks in a taskset? Does that mean
this warrants a separate taskset? Right now the architecture makes me believe so. I’ve wanted to package a bunch of tasks together that have different base containers before, but I could see an
argument for everything in a taskset needing to share the same base runtime.

Is it clear which files follow Harbor's task format and which capabilities are proposed NeMo Gym authoring extensions?

Enough, but I don’t really care about this, I think.

Do the Python examples make it clear when to write a task-specific verifier, reuse a complete verifier, or build one from shared helpers?

Yes, but it took a little time and docs will definitely help with this. I now see the difference between
The two verifiers for extract-greeting task and uppercase-greeting task. The former reuses verification ootb with no bespoke verification requirements so it can be defined entirely in the yaml. The latter layers some custom verification in the verify.py file but reuses a general verification utility.

Does the run command make it clear that the agent, model, and sandbox are selected at run time and can be replaced without changing the task?

The sandbox selection is not clear. The rest of the components of the run command are clear.
I get not changing the task, but where one provides a sandbox is not clear - it should not be tied to
a harness?

Where does an example assume prior knowledge or introduce more than one new concept?

n/a

What exact output, fields, or artifacts would you need after a run to understand what happened and trust the score?

I would want full trajectories, I’d want a UI to view them in easily that has some first class support,
I would want to be able to inspect all artifacts/files created in the environment, and I’d want to see
trajectories also from the verification if it used an agent as a judge. I also need to be able to
share these artifacts.

@adil-a

adil-a commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Ran hello_world and hello_dataset end to end through the Harbor stack (#3673–#3677) with Hermes on OpenSandbox. The plumbing works unchanged, but both examples scored 0 twice: the model writes the file with printf '…!' > … and no trailing newline (it even checks wc -c = 20), while tests/test.sh does a byte-exact cmp against the text plus \n. With the compare below, which accepts the file with or without a trailing newline, all three tasks score 1.0.

diff -ru chris_orig/environments/hello_dataset/goodbye/tests/test.sh chris/environments/hello_dataset/goodbye/tests/test.sh
--- chris_orig/environments/hello_dataset/goodbye/tests/test.sh	2026-09-24 02:22:56.249625756 -0700
+++ chris/environments/hello_dataset/goodbye/tests/test.sh	2026-09-24 02:22:35.517558425 -0700
@@ -5,7 +5,9 @@
 set -u
 
 mkdir -p /logs/verifier
-if printf 'Goodbye from NeMo Gym!\n' | cmp -s - /workspace/goodbye-gym.txt; then
+expected='Goodbye from NeMo Gym!'
+# $(cat ...) drops trailing newlines, so the file may end with or without one.
+if [ -f /workspace/goodbye-gym.txt ] && [ "$(cat /workspace/goodbye-gym.txt)" = "$expected" ]; then
   printf '1\n' > /logs/verifier/reward.txt
 else
   printf '0\n' > /logs/verifier/reward.txt
diff -ru chris_orig/environments/hello_dataset/hello/tests/test.sh chris/environments/hello_dataset/hello/tests/test.sh
--- chris_orig/environments/hello_dataset/hello/tests/test.sh	2026-09-24 02:22:55.848624453 -0700
+++ chris/environments/hello_dataset/hello/tests/test.sh	2026-09-24 02:22:35.515558419 -0700
@@ -5,7 +5,9 @@
 set -u
 
 mkdir -p /logs/verifier
-if printf 'Hello from NeMo Gym!\n' | cmp -s - /workspace/hello-gym.txt; then
+expected='Hello from NeMo Gym!'
+# $(cat ...) drops trailing newlines, so the file may end with or without one.
+if [ -f /workspace/hello-gym.txt ] && [ "$(cat /workspace/hello-gym.txt)" = "$expected" ]; then
   printf '1\n' > /logs/verifier/reward.txt
 else
   printf '0\n' > /logs/verifier/reward.txt
diff -ru chris_orig/environments/hello_world/tests/test.sh chris/environments/hello_world/tests/test.sh
--- chris_orig/environments/hello_world/tests/test.sh	2026-09-24 02:22:55.428623090 -0700
+++ chris/environments/hello_world/tests/test.sh	2026-09-24 02:22:35.513558412 -0700
@@ -5,7 +5,9 @@
 set -u
 
 mkdir -p /logs/verifier
-if printf 'Hello from NeMo Gym!\n' | cmp -s - /workspace/hello-gym.txt; then
+expected='Hello from NeMo Gym!'
+# $(cat ...) drops trailing newlines, so the file may end with or without one.
+if [ -f /workspace/hello-gym.txt ] && [ "$(cat /workspace/hello-gym.txt)" = "$expected" ]; then
   printf '1\n' > /logs/verifier/reward.txt
 else
   printf '0\n' > /logs/verifier/reward.txt

Alternatively the instructions could say the file must end with a newline. Happy to open a PR onto your branch if you prefer.

🤖 Generated with Claude Code

@svcnvidia-nemo-ci svcnvidia-nemo-ci added area:data Datasets, preparation, task formats, and materialization feature New capabilities, enhancements, or enablement work labels Oct 20, 2026
adil-a added a commit that referenced this pull request Oct 21, 2026
…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 added a commit that referenced this pull request Oct 21, 2026
…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 added a commit that referenced this pull request Oct 21, 2026
…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 added a commit that referenced this pull request Oct 21, 2026
…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 added a commit that referenced this pull request Oct 21, 2026
…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 added a commit that referenced this pull request Oct 21, 2026
…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 added a commit that referenced this pull request Oct 21, 2026
…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 added a commit that referenced this pull request Oct 21, 2026
…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 added a commit that referenced this pull request Oct 21, 2026
…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 added a commit that referenced this pull request Oct 21, 2026
…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 added a commit that referenced this pull request Oct 22, 2026
…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 added a commit that referenced this pull request Oct 22, 2026
…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 added a commit that referenced this pull request Oct 22, 2026
…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 added a commit that referenced this pull request Oct 22, 2026
…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 added a commit that referenced this pull request Oct 23, 2026
…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 added a commit that referenced this pull request Oct 23, 2026
…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 added a commit that referenced this pull request Oct 23, 2026
…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 added a commit that referenced this pull request Oct 23, 2026
…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 added a commit that referenced this pull request Oct 24, 2026
…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 added a commit that referenced this pull request Oct 25, 2026
…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 added a commit that referenced this pull request Oct 25, 2026
…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 added a commit that referenced this pull request Oct 25, 2026
…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 added a commit that referenced this pull request Oct 25, 2026
…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 added a commit that referenced this pull request Oct 25, 2026
…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 added a commit that referenced this pull request Oct 26, 2026
…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 added a commit that referenced this pull request Oct 26, 2026
…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 added a commit that referenced this pull request Oct 26, 2026
…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 added a commit that referenced this pull request Oct 26, 2026
…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 added a commit that referenced this pull request Oct 26, 2026
…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 added a commit that referenced this pull request Oct 26, 2026
…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 added a commit that referenced this pull request Oct 27, 2026
…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 added a commit that referenced this pull request Oct 27, 2026
…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]>
eddy-nassif pushed a commit to youdotcom-oss/NeMo-Gym that referenced this pull request Oct 28, 2026
…r.md and publish --harbor (M31) (NVIDIA-NeMo#4865)

* feat(harbor): parameterized tasks, in-sandbox Python verifiers, answer.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, NVIDIA-NeMo#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]>

* fix(harbor): check digest symlinks only on the paths the digest covers

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

---------

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

Copy link
Copy Markdown
Contributor Author

Closing - merged via NVIDIA-NeMo/Gym#4865, which landed these six examples under environments/hello_* with reference solutions and validation

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants