Repository navigation
design(environments): prototype Harbor task authoring - #3653
cwing-nvidia wants to merge 2 commits into
Conversation
Signed-off-by: Chris Wing <[email protected]>
|
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. |
Signed-off-by: Chris Wing <[email protected]>
Yes
Yes, with the exception of I’m not sure how/if I can reuse artifacts like MCP tools.
Somewhat. I’d make one task when it’s not going to be a benchmark that needs to all be packaged One question I have is what if I want different runtimes for the tasks in a taskset? Does that mean
Enough, but I don’t really care about this, I think.
Yes, but it took a little time and docs will definitely help with this. I now see the difference between
The sandbox selection is not clear. The rest of the components of the run command are clear.
n/a
I would want full trajectories, I’d want a UI to view them in easily that has some first class support, |
|
Ran 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.txtAlternatively 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 |
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
|
Closing - merged via NVIDIA-NeMo/Gym#4865, which landed these six examples under environments/hello_* with reference solutions and validation |
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:
hello_worldintroduces one complete Harbor-compatible task.hello_datasetgroups independently authored tasks into one dataset.hello_mcp_tooladds a task-provided MCP tool.hello_python_verifierexpresses task-specific scoring in Python.hello_verifier_reusecomposes scoring from curated NeMo Gym helpers and task-specific Python.hello_parameterized_tasksgenerates 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:
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:
tests/verifier.pyto 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.The proposed verifier contract rejects a task containing both
tests/test.shandtests/verifier.py, avoiding ambiguous scoring behavior.Scope
This PR changes only the examples under
environments/hello_*.It does not implement or modify:
HarborEnvServergym eval runCLI behaviorThose runtime changes will be developed and reviewed separately.
Feedback requested
For task authors
Validation
hello_dataset.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.