Skip to content

feat(tasks): load Harbor task folders and hub datasets into materialized rows - #3673

Merged
adil-a merged 8 commits into
mainfrom
adasif/harbor-m1-loader
Oct 15, 2026
Merged

adil-a merged 8 commits into
mainfrom
adasif/harbor-m1-loader

Conversation

@adil-a

@adil-a adil-a commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

M1 of the Harbor tasks RFC (GitLab MR 340): read Harbor's task format into NeMo Gym materialized rows. First PR of the stack, based directly on main.

Rebased onto main 128eab4 (2026-10-04). The review fixes from that date are listed below.

Adds nemo_gym/tasks/harbor:

  • Pydantic mirror of task.toml schema 1.4 with Harbor field names. Deprecated spellings (version, image, memory, storage, allow_internet) are read and normalized, never written. Keys the mirror does not know are ignored with a warning, as Harbor ignores them. docker_image is optional.
  • Discovery: a folder with task.toml is one task. Otherwise its direct children are the tasks. task_id is the folder name. A task folder that does not load is skipped with a warning and listed in PreparedTaskset.skipped, so the rest of the dataset still prepares.
  • Base-image-only Dockerfile detection (FROM plus WORKDIR/ENV/USER/LABEL). Such tasks run the base image directly. task.toml settings win over the Dockerfile.
  • Whole-folder digest in task_data._ng_digest, same record format as the Harbor package publisher, so a server can refuse a row whose folder changed.
  • harbor:<dataset>[@version] resolves the Harbor registry, pins HEAD to a commit, and fetches task folders into the shared datasets folder ($NEMO_GYM_DATASETS_DIR, default ./datasets, now gitignored) under <dataset>-<version>/ with a manifest.toml of pins. Task folders already present keep the pins the manifest recorded for them.
  • Rows are MaterializedTask[SingleAgentTurnTaskInput]. The generated run config binds a harbor resources server instance, the selected agent and a single_agent_turn environment server, routed by taskset.
  • CLI: gym eval run <folder | harbor:dataset> --agent <name> [--sandbox <provider>] prepares the taskset under results/harbor/<taskset>/ and runs end to end.

Review fixes (2026-10-04)

One commit, 166e09c0e fix(harbor): loader robustness for registry datasets:

  • Version resolution is a total order: numeric versions first, by component, then the rest by text. An unpinned reference to a dataset whose versions do not order numerically is an error that asks for @<version>.
  • Registry dataset folders are named <dataset>-<version>, so two versions of one dataset never share a folder.
  • A rerun reuses the manifest pins of task folders already present and resolves HEAD once per repository. Completing a partial fetch no longer moves a pin.
  • Registry git_url values must be https://, ssh://, git:// or user@host:path. Anything else (file paths, ext::, option-looking strings) is refused before it reaches a git command line, and -- separates URLs from git options.
  • Unknown task.toml keys are ignored with a warning instead of failing the task. A task folder that fails to load (bad TOML, non-UTF-8 text, missing files) is skipped and reported instead of aborting the dataset.

Validation

  • pytest tests/unit_tests/test_harbor_tasks.py (58 tests: models and unknown-key detection, Dockerfile detector, digest, discovery with skipped tasks, taskset mapping, hub version resolution and git URL validation, hub fetch against a local git repo including manifest reuse, row and run-config shapes, CLI wiring).
  • pytest tests/unit_tests/test_cli_main.py (existing eval run flags unchanged).
  • pre-commit run --files <changed files> clean.
  • Against the live Harbor registry (before the review fixes): harbor:hello-world pinned HEAD to cdb76bae, fetched examples/tasks/hello-world, detected ubuntu:24.04 + WORKDIR /app, wrote rows and run config. The fixes only change where the folder lands (<dataset>-<version> when the registry entry has a version).

Rollouts

N/A for this PR alone (loader only). End-to-end runs are recorded in #3677.

Compatibility and benchmark impact

Additive. gym eval run gains an optional positional target and --sandbox. Existing invocations are unchanged. datasets/ is added to .gitignore. No benchmark results affected.

Checklist

  • I have read the contributing guidelines.
  • The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs.
  • Tests added or updated and pass locally, or N/A for docs-only / non-code changes (so CI unit/server checks pass when applicable).
  • Documentation added or updated, or N/A with justification.
  • Pre-commit checks pass locally (pre-commit run --all-files) (so CI lint/format checks pass).
  • New source files include the required Apache-2.0 SPDX header.
  • All commits have DCO sign-off (git commit -s) (so the DCO check passes).

🤖 Generated with Claude Code

@copy-pr-bot

copy-pr-bot Bot commented Sep 24, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@adil-a
adil-a added this pull request to stack #3678 September 24, 2026 08:49
@adil-a
adil-a force-pushed the adasif/harbor-m1-loader branch 2 times, most recently from 755d9c0 to 93375d5 Compare September 24, 2026 09:15
@adil-a
adil-a force-pushed the adasif/harbor-m1-loader branch from 93375d5 to 37a422a Compare September 28, 2026 19:35
@adil-a
adil-a removed this pull request from stack #3678 September 28, 2026 19:35
@adil-a
adil-a changed the base branch from adasif/environment-server-identity to ananthsub/episode-orchestration-10-rollout-routing September 28, 2026 19:35
@adil-a
adil-a added this pull request to stack #3733 September 28, 2026 19:36
@github-actions

Copy link
Copy Markdown
Contributor

@yuhezhang-ai yuhezhang-ai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rechecked 24d8597. The previously reported findings and follow-up suggestions are addressed, including the long-override regression. No remaining blocking findings in the Harbor loader changes.

Validation: 608 focused Harbor, CLI and global-config tests passed locally. CI core/sandbox tests, all eight server-test shards, and the required Nemo_CICD_Test, lint and DCO checks passed.

The separate Harness conformance checks remain red for existing agent recording/checker issues outside this PR's changes. They are not required checks and are excluded from the Nemo_CICD_Test gate. Main already contains partial fixes (#4048 and #4251), the base-commit CI run also reports conformance failures; these do not block approval of this loader-only PR. Model execution is N/A for this milestone.

@adil-a
adil-a removed this pull request from stack #3808 October 14, 2026 00:54
@adil-a
adil-a added this pull request to stack #4583 October 14, 2026 00:55
@adil-a
adil-a force-pushed the adasif/harbor-m1-loader branch from 24d8597 to c855ead Compare October 14, 2026 01:06
adil-a and others added 8 commits October 14, 2026 14:28
…zed rows

Adds `nemo_gym/tasks/harbor`, the loader for Harbor's task format (M1 of the
Harbor tasks RFC):

- Pydantic mirror of `task.toml` schema 1.4 with Harbor field names;
  deprecated spellings (`version`, `image`, `memory`, `storage`,
  `allow_internet`) are read and normalized, never written.
- Discovery: a folder with `task.toml` is one task, otherwise its direct
  children are the tasks. `task_id` is the folder name.
- Base-image-only Dockerfile detection (FROM plus WORKDIR/ENV/USER/LABEL) so
  such tasks run the base image directly; `task.toml` settings win.
- Whole-folder digest in `task_data._ng_digest`, same record format as the
  Harbor package publisher.
- `harbor:<dataset>[@Version]` resolves the Harbor registry, pins `HEAD` to a
  commit, and fetches task folders into Gym's shared datasets folder
  (`$NEMO_GYM_DATASETS_DIR`, default `./datasets`) with a `manifest.toml`.
- Rows are `MaterializedTask[SingleAgentTurnTaskInput]`; the generated run
  config binds a `harbor` resources server, the selected agent and a
  `single_agent_turn` environment server, routed by taskset.
- `gym eval run <folder | harbor:dataset> --agent <name> [--sandbox <provider>]`
  prepares the taskset and runs end to end.

Signed-off-by: Adil Asif <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
- total-order version resolution, error on ambiguous alphabetic versions
- registry folders named by dataset and version
- reuse manifest pins for present folders, resolve HEAD once per repo
- validate git_url schemes and pass -- to git
- ignore unknown task.toml keys with a warning, isolate per-task load errors

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
The generated run config now sets the harbor server's artifacts_dir to an absolute
<results>/<taskset>/verifier folder. Without it the server's relative default resolved
against the server process's own working directory, so the verifier_logs_dir recorded
in every row pointed at a path that did not exist from where the run was launched.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
Contain registry task sources and destinations, preserve safe symlinks, and publish truthful source pins after each task. Refuse existing unpinned folders rather than silently relabeling their contents.

Bring the M9 version-qualified taskset fix (2bdcada) and M15 config precedence fix (1ce0d01) into M1. Restore mixed CLI config merging, conservatively reject unsupported Dockerfile syntax, and ignore Dockerfile settings for prebuilt images.

Reject unenforced network policies, Windows and TPU tasks; align legacy resource fields with Harbor. Record per-task preparation failures and require --skip-unloadable before evaluating a partial taskset.

Validation: 554 Harbor, CLI and global-config tests passed; pre-commit run --all-files passed; live harbor:hello-world fetch/materialization and pin reuse passed at dc933be707feafbb9efcdf092cb8a0e391332617. Model rollouts N/A for the loader-only M1 layer.
Signed-off-by: Yuhe Zhang <[email protected]>
Include the resources-server domain in generated configs and validate complete
runs through Gym's configuration parser. Encode generated instance names with
collision-free byte escapes so versioned tasksets remain addressable by Hydra
overrides while their dataset identities stay unchanged.

Restore equals-free Hydra deletion overrides to target-free eval routing.
Keep validated pins for missing task folders across interrupted cache repairs.
Reject symlinked child task folders and duplicate task IDs before writing rows.
Report expected Harbor CLI errors concisely and reject invalid agent/sandbox
selectors before registry preparation or downloads.

Validation: 574 Harbor, CLI-routing and global-configuration tests passed;
pre-commit run --all-files passed. A fresh harbor:hello-world fetch at
dc933be707feafbb9efcdf092cb8a0e391332617 materialized one task with zero skips,
passed full run/server config validation, and accepted a generated-agent
override. Model and sandbox rollouts are N/A for this loader-only layer.

Signed-off-by: Yuhe Zhang <[email protected]>
Prefer explicit paths and existing directories over configuration overrides, quote generated paths, and preserve valid Hydra deletion syntax. Validate registry data before atomic cache publication and report actionable cache errors.

Validation: 606 Harbor, CLI, and configuration tests passed; fresh hello-world registry fetch and full configuration validation passed; all-files pre-commit and CI-equivalent secret scan passed. Loader-only changes require no model rollout.
Signed-off-by: Yuhe Zhang <[email protected]>
Keep valid long configuration values intact when the optional folder probe raises OSError. Add routing and Hydra parsing regressions with a 300-character dummy key for both eval run modes.

Validation: both regression cases failed before the fix; 608 Harbor, CLI and configuration tests passed after it. All-files pre-commit and CI-equivalent secret scan passed.
Signed-off-by: Yuhe Zhang <[email protected]>
@adil-a
adil-a force-pushed the adasif/harbor-m1-loader branch from c855ead to e27d6e0 Compare October 14, 2026 21:38
@adil-a

adil-a commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test e27d6e0

@yuhezhang-ai

Copy link
Copy Markdown
Contributor

One remaining correctness finding after checking the later stack:

[P2] Directory symlinks are omitted from task integrity validation. In content_hash, rglob does not descend into directory symlinks, and is_file() filters out the links themselves. Their targets therefore never reach either the containment check or the digest.

Reproduced with both tests/one/data.txt and tests/two/data.txt present: materialize with tests/data -> one, then change it to tests/data -> two. The selected test data changes, but the checksum stays identical. The runtime copies symlinks and compares the reloaded task's digest, so this changed input passes its stale-task check. Local loading also accepts a directory symlink pointing outside the task, although the registry fetch rejects that tree.

I checked all 16 later PRs through #4566 (68505ee9) and reproduced both cases at that head. The content_hash function is unchanged throughout; M20's separate Docker build-context digest does not address this.

Could we validate directory symlinks before filtering to regular files, reject escaping links for local tasks too, and either include supported link targets in task identity or explicitly refuse unsupported directory links? Regression coverage for an escaping directory link and retargeting an internal link would protect these cases. This is distinct from the already-fixed registry copying and linked child-task identity findings.

@adil-a
adil-a added this pull request to the merge queue Oct 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/38682357324

Merged via the queue into main with commit 8073346 Oct 15, 2026
49 of 54 checks passed
@adil-a
adil-a deleted the adasif/harbor-m1-loader branch October 15, 2026 04:51

This branch was previously deployed

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

Labels

area:data Datasets, preparation, task formats, and materialization complexity:high Cross-component or shared-contract change with a large review surface feature New capabilities, enhancements, or enablement work QA_verified waiting-on-customer Waiting on the original author to respond

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants