Skip to content

chore(data): apply the dataset decoupling migration (agent_ref out of data files) - #2732

Draft
adil-a wants to merge 21 commits into
mainfrom
data-prep/migration
Draft

adil-a wants to merge 21 commits into
mainfrom
data-prep/migration

Conversation

@adil-a

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

Copy link
Copy Markdown
Contributor

What this PR does

Applies the dataset↔agent decoupling to the whole repo. Datasets and configs stop naming the agent that runs them. Routing comes from the run's config instead, via the resolver from #2713.

The diff is large but generated: a migration script produced it, and the checks below verify it. The script is a one-shot tool and is not committed. Review this PR by reading the verification section and spot-checking the diff, not by reading every file.

No files move or get renamed. Only contents change.

Kept current with main. After rebases, new content that arrived on main is migrated the same way: the new environments/<harness>_math/ and environments/aviary_*/ families (19 configs, 33 dataset declarations moved), and 14 more prep scripts that still stamped agent_ref (12 new ones from the math family, plus 2 pre-existing generators an earlier sweep had missed). The verification below is re-run after every rebase.

Data changes

agent_ref is removed from 736 rows across 83 committed dataset files. Nothing else in any row changes.

# Before:
{"responses_create_params": {...}, "question": "...", "expected_answer": "42",
 "agent_ref": {"type": "responses_api_agents", "name": "math_with_judge_simple_agent"}}
# After:
{"responses_create_params": {...}, "question": "...", "expected_answer": "42"}

Deliberately untouched:

  • Run artifacts committed under data/ (rollout outputs, prepared sidecars). They record which agent produced them. That is provenance, and it stays. Verified: 0 artifact files modified.
  • The 130 remote-backed datasets (HuggingFace/GitLab). They keep working as-is: collate strips their stale agent_ref on read, and the resolver accepts legacy rows. Re-upload is later hygiene, not a blocker.
  • Folding loose fields under task_data. Different issue (unified row format), different PR.

Config changes (310 YAML files, edited in place)

Change Count
datasets: lists move from agent blocks to the resources-server block that owns them 410 declarations
Benchmark datasets carry no agent: pin — all 116 resolve from config structure alone (declaring agent block, or the unique agent referencing the declaring resources server; verified by resolver simulation). The key stays available for genuinely ambiguous configs (#2724) 116 verified
genrm_compare + jailbreak_detection: N duplicate declarations of one file become 1 declaration + a fan_out: key (#2713). Same behavior: each row runs once per agent 2 configs
swe_agents_val / swe_agents_train alias agents deleted. They existed only so rows with baked-in names could route; those rows are cleaned in this PR 4 files
legal_agent_bench: harbor agent gets a structured resources_server: reference (was bound only through ${...} interpolation, invisible to routing) 2 files
mini_swe_agent_2.yaml: pre-existing duplicate datasets: key removed (broke strict YAML parsing, plus 5 configs that include the file) 1 file

Left alone on purpose: 40 dataset declarations on self-contained agents (tau2, osworld, SWE harnesses — the agent verifies in-process and owns its data), and 9 declarations whose resources server lives in another, shared file (moving them would collide).

Every prep/generation script in the repo stops stamping agent_ref (59 script files in this diff), so regenerated data stays clean. The only remaining agent_ref mentions in non-test code are genuine readers (scripts that strip the field from upstream rows, or read it from run outputs, where it stays as provenance). Tests that asserted the field's presence now assert its absence.

How this was tested

Every check runs over the whole repo, before vs after, machine-checked.

  1. Row content proof. Per file: row counts and content hashes (computed with the label fields excluded) are identical before and after. 0 violations. Only agent_ref was removed.
  2. Config parse sweep. All 517 server-relevant YAMLs parse cleanly — plain load, strict duplicate-key load, and the real config parser. 0 new errors. 6 previously broken configs are fixed by the mini_swe repair.
  3. Shape rules. No datasets on model servers. Every benchmark dataset resolves unambiguously without a pin. No stray agent_ref keys anywhere. Enumeration is assumption-free: git ls-files for data files, a full filesystem walk for configs. (Earlier sweeps used globs or filters and missed things: nested dirs, benchmark overlays not named config*.yaml, and two generator scripts whose names matched a test-file filter. Each gap was found by an independent verification pass and fixed. The final sweep uses no filters at all: every tracked file is grepped, and every hit is classified.)
  4. Routing replay. The full pipeline — config merge, collate, run-input build, dispatch with the network call stubbed — replayed over every runnable config. Every row routes to the same agent as before, except three intended changes: (a) 7 datasets whose stale agent_refs used to crash runs mid-collection now route from their declaration and work; (b) rows that targeted the deleted swe aliases route to swe_agents; (c) collated swe outputs drop duplicated, mislabeled copies (leftovers of the truncation bug fixed in feat(data): collate stamps task_source; datasets declarable on resources servers #2717).
  5. Unit tests. Core suite: 2887 passed. All affected server suites re-run green.
  6. Live rollouts with a real model and real servers, one per routing pattern: plain task_source routing, a legacy agent_ref file (works, plus deprecation warning), fan-out across 2 agents, an agent_map redirect, a reverify round-trip, and the aime24 benchmark end-to-end (prepare → collate → run). 6/6 passed.

Compatibility

  • Old datasets and old collated files keep working, indefinitely. The resolver routes their agent_ref rows and warns once per run.
  • New collated files contain task_source and no agent_ref. They need a Gym with the resolver (this release) at training time. Trainer integrations bump their embedded Gym with this release; no code changes (verified for verl and NeMo RL — both delegate dispatch to embedded Gym).
  • A CI contract test (feat(data): collate stamps task_source; datasets declarable on resources servers #2717) pins the processed format so it cannot drift silently.

Follow-up work (not in this PR; GitHub issue to be filed)

  1. Remove the legacy routing path (PR6, draft). Rows with a baked agent_ref stop routing and get a clear "re-collate this file" error. Gated on: trainers ship a Gym with the resolver, and the deprecation warning has been live for one release.
  2. Docs. Nine live Fern pages and ten READMEs still teach agent_ref. They need to teach task_source, agent_map, and fan_out.
  3. The pivot-datasets skill. Its instructions and reference scripts still teach agent_ref alignment. Left out of this PR on purpose: fixing the scripts without rewriting the skill's prose would make the examples contradict their own instructions.
  4. NeMo RL adoption. It calls run_examples directly. It should call the new preprocess_examples first so run-level routing knobs work from trainers (change lands in the NeMo RL repo).
  5. Remote dataset re-upload. The ~130 datasets on HuggingFace/GitLab still carry stale agent_ref. They work today because collate strips the field on read. Re-uploading them clean is hygiene.
  6. Small fixes. gym eval reverify needs a --no-serve mode and a friendly head-port-in-use error. The aime24 metrics sidecar on main is stale.

Relationship to other PRs

Part 5 of 5 of the dataset↔agent decoupling work (RFC: gym-dataset-preparation OQ1), It depends on the resolver in #2724, so its base is #2724's branch — the diff shows only the migration, and GitHub retargets this PR to main when #2724 merges. A follow-up draft PR will hold the condition-gated removal of the legacy routing path; the --agent retirement moved to #2757.

🤖 Generated with Claude Code

@copy-pr-bot

copy-pr-bot Bot commented Aug 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 force-pushed the data-prep/migration branch 2 times, most recently from 4f5e95e to e3262ee Compare August 25, 2026 05:36
@adil-a
adil-a force-pushed the data-prep/migration branch 2 times, most recently from 3e679db to b2fa94f Compare August 25, 2026 18:37
@github-actions github-actions Bot added the sla:triage-overdue Review assignment is over the one-business-day SLA label Aug 25, 2026
@adil-a
adil-a force-pushed the data-prep/migration branch from eb13bcc to 4fad192 Compare August 26, 2026 02:20
@adil-a

adil-a commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 4fad192

@adil-a

adil-a commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 67a272f

@adil-a

adil-a commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 2423897

@adil-a

adil-a commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test d2fca34

kajalj22
kajalj22 previously approved these changes Aug 28, 2026
adil-a and others added 21 commits August 28, 2026 16:41
Modular migration engine for the data-prep decoupling stack (PR5):
- config mover: datasets from agent blocks -> declaring RS block (same-file);
  self-contained agents (no structured RS edge) left untouched and reported
- benchmark pins: explicit agent: key on type: benchmark dataset entries
- fan-out conversion: report-only proposals for genrm_compare/jailbreak_detection
- jsonl rewriter: strip agent_ref; optional --fold-task-data (schema pending RFC)
- proof emitter: per-file row counts + content-hash manifests (agent_ref-invariant)
  for the golden-harness bijection check
- special cases reported/stubbed: remote-backed datasets, legal_agent_bench edge,
  swe alias deletion; cross-file RS declarations skipped with report entries

Dry-run by default; --apply refuses the PyYAML fallback to protect comments.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
Finishes the migration script for the repo-wide sweep:

- _inherit_from-aware: benchmark manifests whose resources server exists only
  as an inherit stub get the RS block created with the implementation key
  learned from the merged config view (previously misclassified as cross-file
  and skipped).
- Run artifacts (rollout outputs, prepare sidecars committed under data/) are
  excluded from the row rewrite: they carry agent_ref as provenance, which is
  correct and must survive.
- Fan-out conversion implemented (the schema shipped with the resolver PR):
  cross-product configs keep one dataset declaration on the RS block and gain
  a top-level fan_out key, dispatching each row once per agent exactly as the
  per-agent duplicate declarations did.
- legal_agent_bench gains structured resources_server edges (previously bound
  only via interpolations, invisible to inversion and reverify).
- swe_agents_val/swe_agents_train alias configs are deleted; the baked
  agent_ref rows they existed to satisfy are stripped in the same run.
- Updates the collate sanity test: the declaring instance for
  example_multi_step is now its resources server.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
Generated by scripts/migrate_dataset_decoupling.py --apply. File locations are
unchanged; only contents migrate:

- 292 config files: datasets: lists move from agent blocks into the declaring
  resources-server block (404 declarations; _inherit_from benchmark stubs get
  their RS block materialized); 103 benchmark datasets gain an explicit agent:
  pin; genrm_compare and jailbreak_detection convert to fan_out; the
  swe_agents_val/swe_agents_train alias instances are deleted;
  legal_agent_bench gains structured resources_server edges.
- 80 committed JSONLs: agent_ref stripped from 651 rows. Nothing else in any
  row changes (task_data folding is out of scope, tracked by the unified-row
  RFC). Run artifacts (rollout outputs) keep their agent_ref provenance.
- mini_swe_agent_2.yaml: pre-existing duplicate datasets key removed (broke
  strict YAML parsing; also unblocks 5 configs that include it).
- 130 remote-backed dataset declarations are untouched: collate overwrites
  stale agent_refs when dual-stamping and the resolver honors legacy rows, so
  they keep working until re-uploaded clean.

Verification (full-pipeline replay over every runnable config, pre vs post):
- Parse sweep: 0 new errors; 6 configs FIXED (mini_swe duplicate key ripple).
- Row bijection: 0 violations across all 182 scanned JSONLs (content hashes
  invariant; only agent_ref removed).
- Routing isomorphism: every row routes to the same agent as before, except
  the enumerated intended changes: 7 datasets whose stale agent_refs crashed
  mid-run now bind via task_source and work; rows that routed to the deleted
  swe aliases route to swe_agents; collated swe outputs drop the duplicated
  mislabeled copies (2 rows -> 1).
- Core unit suite: 2809 passed.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
…n rows

The migration stripped agent_ref from committed data, which broke server tests
asserting its presence, and left four prep scripts still stamping it (so
regenerating data would re-pollute the cleaned files). Prep scripts
(bunsenbench create_examples, conversational_tool_use dataset builder,
legal_agent_bench prepare, biomnibench_da prepare) no longer emit agent_ref;
their tests and spartqa's acceptance test now assert rows carry no agent
binding. image_tools' image_tools_base_agent_ref is its own request field and
is untouched; conversational materialized-sampler fixtures constructing legacy
rows are untouched (the resolver honors them).

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
The post-migration shape sweep caught 13 benchmark configs not named
config*.yaml (opencode.yaml, cascade.yaml, hle_no_tools.yaml, tau2 configs/,
eval_container_config_with_staged.yaml) that the migration glob
benchmarks/**/config*.yaml skipped. Glob widened to benchmarks/**/*.yaml and
the migration re-applied: 13 benchmark datasets gain their agent: pin, 6
dataset declarations move to their resources-server blocks (tau2's stay on the
agent: self-contained). All 13 re-verified: strict parse clean, every
benchmark dataset pinned.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
The full-inventory sweep caught 3 more committed source files under nested
agent directories (responses_api_agents/conversational_tool_use/*/data/) that
the single-level data glob skipped. Globs are now recursive (**/data/*.jsonl)
across all four roots; 3 agent_refs stripped, bijection proof clean.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
Final coverage gap from the full-inventory sweep: harbor_agent ships example
input files under example/ instead of data/ (97 agent_ref rows across 3
files). Data globs extended; _output files are classified as run artifacts and
keep their provenance. The documented harbor workflow is unchanged (its README
already passes --agent harbor_agent with these files). Bijection proof clean.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
The migration is done and verified; the script is a one-shot tool, not a
maintained interface. It is preserved outside the repo for reruns. The PR diff
now contains only the migrated configs and data.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
…ripts

Same change as the four prep scripts already de-stamped in this PR:
generated rows should carry no routing; the run config decides the agent.
These two were missed by the sweep (rows they generate carried a baked
agent_ref that outranks task_source via the legacy path). ~40 other prep
scripts still stamp agent_ref; they keep working through the honored
legacy path and are follow-up cleanup, not migration blockers.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
…on script

Finishes what the earlier de-stamp commits started: no script in the repo
writes agent_ref into the rows it generates anymore. Routing is the run
config's job; a baked agent_ref silently outranks a task_source added
later (legacy precedence), which makes stale stamps a footgun for anyone
constructing datasets from prep output.

40 scripts de-stamped (plus dead constants, agent-name CLI args that
existed only for stamping, and docstrings describing the field). The five
remaining agent_ref mentions in non-test code are genuine readers:
litmus-bench's three prepare scripts strip the field, openair's client
pops it, and nemotron's export_to_csv reads run-output metrics (outputs
still carry agent_ref as provenance).

Also fixes two latent test breaks from the config/data migration itself:
scenario_generation's example-contract test still expected agent_ref in
the (already stripped) example.jsonl, and legal_agent_bench's config test
still read datasets off the agent block after the dataset moved to the
resources server.

Verified: full-repo sweep shows only the five readers; every modified
file compiles and passes ruff; conversational_tool_use materialize
suites, legal_agent_bench prepare tests, spartqa acceptance, and the
2787-test core suite all pass.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
Main moved the math_with_judge harness-variant configs into new
environments/<harness>_math/ dirs and the aviary configs into
environments/aviary_*/, all still declaring datasets on agent blocks.
Re-ran the migration over the rebased tree: 19 configs, 33 dataset
declarations moved to the owning resources-server block. No data
changes needed - the new example.jsonl files carry no agent_ref, and
the example_rollouts.jsonl files that do are run artifacts (provenance,
untouched).

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
…rought in

The environments/<harness>_math family added on main ships prepare.py
scripts built from the pre-decoupling template: every emitted row of the
declared dapo17k_train.jsonl carried a baked agent_ref (12 scripts).
Two pre-existing generators (grl_sokoban/grl_tetris
generate_test_examples.py) were also still stamping - their names
matched none of the earlier sweep's patterns; caught by the exhaustive
union sweep (name patterns + any .py that writes jsonl). All 14 stop
stamping; dead AGENT_NAME constants removed.

Full-repo sweep now shows only the five genuine readers (litmus x3
strip, openair pops, nemotron export reads run outputs).

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
…gents

The migration removed the swe_agents_val/swe_agents_train alias blocks
from this file but left the comment that explained them.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
…empty swe training config stubs

The update-readme-table hook only read dataset declarations from
responses_api_agents blocks. The migration moved datasets under
resources_servers blocks, so the regenerated table dropped every
resources-server row and CI lint failed on the merge ref.

- visit_agent_datasets now scans both resources_servers and
  responses_api_agents blocks for datasets lists.
- The harbor_datasets/vf_env_id train fallback now applies only when
  the config declares no datasets list at all, keeping rows like
  legal_agent_bench identical to main.
- swebench_opencode_training.yaml and swebench_openhands_training.yaml
  were reduced to empty stubs by the migration (their datasets folded
  into the main swe configs) and nothing references them; delete them
  and their README rows.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
…ntries

Every benchmark dataset resolves without a pin: it is either declared
inside the agent block that runs it, or exactly one agent references
the declaring resources server. Verified by simulating the resolver
over all 114 files (116 datasets) and by the golden routing gate
(strict 0-diff, 247 closures). The agent key stays as the documented
escape hatch for genuinely ambiguous configs; the ambiguity error
already points at it.

Also updates the legal_agent_bench prepare test to assert the pin-less
resolution path (unique agent -> resources server edge).

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
…s, restore swe training configs, keep bigcodebench example on the agent

Addresses review on #2732:
- nemotron_3.5_super: the three datasets:[] disables now target the
  resources-server blocks the declarations moved to (7 active benchmarks
  again), and with_staged re-enables them on the same paths instead of
  duplicating on agent blocks (10 unique declarations, was 13).
- Restore swebench_{opencode,openhands}_training.yaml: they were full
  training variants with distinct knobs (timeouts, memory, prompt
  overrides), not routing aliases; their deletion moves to a follow-up.
- bigcodebench: the example dataset stays on the agent — the benchmark
  closure adds a second agent on that resources server and non-benchmark
  datasets have no agent: pin, so RS-declared rows could not route.
- update_env_list: implicit harbor/vf train suppression follows the
  agent's resources_server edge instead of any datasets list in the file;
  vf_env_id and append-once semantics now covered; pragma removed.
- genrm_compare/inverse_if: datasets blocks moved above the section
  banners they had landed under (comment-only, content identical).

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
The migration moved the litmus-bench dataset declaration to the resources
server, but this test still asserted it on the agent block (the parallel
legal_agent_bench test was updated; this one was missed). Found by a
per-folder regression audit of the PR diff.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
New on main: terminal_bench_2_1 (benchmark overlay + nemotron eval container
wiring) and the two nemo_fabric_deepagents environments. Their dataset
declarations move to the resources-server blocks, and the nemotron
disable/staged overrides for terminal_bench_2_1 re-target the RS block,
matching the review fix for the other three staged benchmarks.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
Main's #2641 compose test asserts the composed agent block carries the gpqa
benchmark dataset; the migration moved it to the resources server.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
The example/test declarations move to the agentif resources-server block;
the benchmark overlay stays agent-declared like the other overlays
(_inherit_from keeps its closure unambiguous). Routing verified for both
closures. Found by a completeness sweep after the latest rebase.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
@yaoyu-33

Copy link
Copy Markdown
Contributor

We’re doing some cleanup of the open PR list. This PR has had no activity for over a month, so I’ve moved it back to draft.

If this change is still needed, please resolve any merge conflicts and mark the PR ready for review again when it’s ready to merge. Thanks!

This branch was previously deployed

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

Labels

area:data Datasets, preparation, task formats, and materialization feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants