Skip to content

fix(environments): preserve Hugging Face cache during prepare - #3128

Draft
yaoyu-33 wants to merge 1 commit into
mainfrom
codex/mb-1553-environments
Draft

yaoyu-33 wants to merge 1 commit into
mainfrom
codex/mb-1553-environments

Conversation

@yaoyu-33

@yaoyu-33 yaoyu-33 commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • audit environments/ configuration, preparation entrypoints, source-row shape, and representative simple/stateful/external-harness compositions for MB-1553
  • preserve Hugging Face Hub cache artifacts in the calendar, calendar_v2, and code_gen preparation paths by copying downloads into the environment data directory instead of moving cache files
  • add behavior-level regression coverage for cache preservation, destination content, repeat preparation, split-to-artifact mapping, and code_gen's differing remote/local validation filenames

Audit scope and findings

Representative review covered:

  • simple single-turn verifier: environments/code_gen
  • stateful/tool environment: environments/calendar_v2
  • external harness/agent compositions: environments/aviary_bixbench and environments/codex_math

Systematic checks covered all 47 YAML files, all 49 prepare.py entrypoints, and 226 rows across the 45 committed source JSONL files under environments/:

  • strict duplicate-key YAML load: no failures
  • component entrypoint references: all referenced files exist
  • dataset paths: committed examples exist; missing generated/remote datasets are gitignored
  • source JSONL: all rows parse and have a supported string/list responses_create_params.input
  • Python compilation: every Python file under environments/ compiles under the available Python 3.12.10 fallback

The actionable uncovered defect was three uses of Path.rename() on the path returned by hf_hub_download(). That path belongs to Hugging Face's shared cache. Moving it consumes the cache artifact, and a cache located on another filesystem raises EXDEV. shutil.copyfile() preserves the source/cache contract and retains the existing destination filenames and CLI behavior.

Related in-flight work

This PR intentionally avoids duplicating two broad existing efforts:

Neither PR covers the Hugging Face cache-consumption bug fixed here.

Validation

  • PYTHONPATH=. /home/yuya/mypython/bin/python -m pytest tests/unit_tests/test_environment_prepare.py tests/unit_tests/test_environment_tombstones.py -q — 9 passed
  • pre-commit run --files environments/calendar/prepare.py environments/calendar_v2/prepare.py environments/code_gen/prepare.py tests/unit_tests/test_environment_prepare.py — passed
  • /home/yuya/mypython/bin/python -m compileall -q environments — passed
  • ruff check and ruff format --check on all changed files — passed
  • skill-creator/scripts/quick_validate.py against both main's and docs(skills): align repository skills with current contracts #3123's add-benchmark skill — passed structurally
  • live unauthenticated Hugging Face validation downloads for both calendar datasets — prepared outputs were byte-identical to cached artifacts and both cache artifacts remained present (2,156,971 and 3,443,738 bytes)

Attempted broader registry tests could not collect because the fallback environment does not contain Ray. The repository pins Python 3.13.14, which is unavailable on this machine (uv cannot locate it); the available Python 3.12.10 fallback was used for the focused checks above. CI remains authoritative for the supported Python version and full suite.

Rollouts

No model rollout was run: this change affects only dataset preparation before rollout, and a model rollout over committed examples does not execute the modified download path. The modified external call/result path was instead exercised directly against two real Hugging Face datasets, in addition to mocked repeatable behavior tests.

Independent review

  • Compared the branch with origin/main, the MB-1553 cache-preservation requirement, sibling preparation scripts, and the Hugging Face Hub cache contract. No additional code/API/result-contract finding was found.
  • The repository's rollout gate is not yet satisfied: no usable model endpoint or OpenAI/NVIDIA credential is available locally, so no representative model rollout was run or inspected. Live Hugging Face download/preparation checks are I/O evidence only and are not a rollout.
  • Keep this PR in draft until a representative real-model rollout and agent/verifier inspection are attached.

@copy-pr-bot

copy-pr-bot Bot commented Sep 5, 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.

This branch has not been deployed

No deployments
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 bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants