Skip to content

[NVBug 6900465] Fix gym dataset collate silently skipping task_data schema validation #4523

Closed

Description

@qiaochuz-nv

Queue rank 35/48 · Difficulty 3/5 · Status on main: not_fixed

NVBug: https://nvbugspro.nvidia.com/bug/6900465 · Priority: Unprioritized (reporter-suggested P2) · ARB: Ananth Subramaniam
GitHub: none fixes this. Related open: #4098 (rewrites _task_data_validator_for, does NOT fix Defect 1), #4004 (unrelated to Defect 2); #2795 introduced both defects.

Summary

gym dataset collate is supposed to validate every dataset row against the owning server's task_data.py schema (in --mode example_validation the auto gate becomes error, the repo's PR gate). Two defects make it skip validation silently and exit 0; the bad row then fails later at rollout/verify. Both arrived with #2795 and are present on r0.6.0, r0.7.0 rc1, and current main.

Reproduction

From a Gym checkout venv: edit resources_servers/mcqa/data/example.jsonl row 0 grading_mode to a non-Literal typo, delete its example_metrics.json, then gym dataset collate --resources-server mcqa --mode example_validation --output-dir /tmp/out. Actual exit 0, typo row collated; expected exit 1 ValueError. See bug steps A (Defect 1) and B (Defect 2, external cwd).

Root cause

Defect 1 (main, any cwd): run() passes the filtered load_and_validate_server_instance_configs list (only in-scope-declaring instances) to validation. An agent's referenced resources server declares no datasets, so it is absent; _owning_resources_server_impl loops that list (train_data_utils.py:998) and returns None, so _task_data_validator_for returns None (:1019-1020). Defect 2 (cwd outside tree): the :949/:1094 mkdir creates a data-only resources_servers/<name>/ under cwd; find_server_dir uses validator=Path.is_dir (task_data.py:87) and picks that shadow dir, which has no task_data.py.

Status on main (not_fixed)

HEAD 75bb53e. No commit touched these four files since reference 8555fc3 — they are byte-identical (the in-range Ray commits modified other files such as global_config.py). Confirmed: filtered loop at train_data_utils.py:998; _task_data_validator_for None at :1019-1020; bare Path.is_dir at task_data.py:87. Both guarding tests resolve the owner differently from production (test_task_data.py:455, sweep :604-619). #4098 still OPEN.

Proposed fix

In train_data_utils.py: build the full filter_for_server_instance_configs list (or a name→impl map) and thread it to _task_data_validator_for and _dataset_metrics_hook_for. In task_data.py: give find_server_dir a marker validator (requirements.txt/pyproject.toml, as cli/env.py:357-358), or match the looked-up file. Optionally warn/fail in error mode when an agent-declared owner cannot resolve. Add a test driving run()/collate_samples for an agent-declared schema-violating row. Coordinate with #4098 if it lands first.

Validation

QA testcases/dataset/dataset_collate.py (SERVER=example_single_tool_call, runs example_validation from a scratch workspace — hits both defects). Add a negative control: a schema-violating row must make example_validation exit 1, run from a scratch workspace and on a resources-server-declared dataset. Also affects ns_tools.py, indian_banking.py.

Triage

Difficulty 3/5 — two defects across two files plus a small design choice (list vs map) and new run-level + QA tests; root cause pinpointed, both fixes pre-validated in-process. Needs GPU/model: no.

Reviewer notes

Verifier confirmed not_fixed (all four files byte-identical since 8555fc3; every cited line matches) and difficulty 3. Correction: the status should say no commit touched these four files (byte-identical); the in-range Ray commits modified other files (e.g. global_config.py), not these — so the earlier "two Ray commits touched the files" phrasing was wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions