Skip to content

Validate replay files before the first rebuild - #1792

Merged
qianl-nv merged 6 commits into
mainfrom
qianl/fix/validate-variation-replay
Dec 3, 2026
Merged

qianl-nv merged 6 commits into
mainfrom
qianl/fix/validate-variation-replay

Conversation

@qianl-nv

@qianl-nv qianl-nv commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Validate variation values in every replay file against the Run's configured choices and ranges before the first rebuild. Move categorical choices into samplers and configure them through sampler_cfg.choices, so replay sample validations can happen in the sampler instead of in hdr/asset variation.

Why this change?

With a valid replay file for rebuild 0 and an out-of-choice asset in rebuild 1, the Run previously completed the first rollout and wrote its episode results and dataset before failing. This wasted evaluation time and left an output directory that could not be reused without clearing it.

Fixes https://nvbugspro.nvidia.com/bug/7140990.

What changes?

  • Validate variation values in all replay files before creating a simulation environment. Preflight and environment construction share ArenaEnvBuilder.get_variations_with_overrides(), using the builder's configured Hydra overrides. Errors identify the offending file and rebuild. Placement poses are still checked separately during each rebuild.
  • Add side-effect-free SamplerBase.validate_samples(), shared by preflight checks and replay sampling. Enforce categorical membership, continuous sample shapes, inclusive uniform bounds in every dimension, and boolean values for Bernoulli samples. Keep variation-key and record-consistency checks.
  • Share choice ownership and membership validation through CategoricalSampler, the base of ChoiceSampler and SequentialSampler. Preserve choice order and repetitions, and report rejected values alongside the allowed choices. VariationBase delegates recorded-value validation directly to its sampler.
  • Keep asset-name and rigid-object-type checks in the asset-selection variation. Keep HDR registration checks and expansion of an empty pool to all registered HDRs in the HDR variation.
  • Replace variation-level registry_names and hdr_names with sampler_cfg.choices. Update maintained YAML examples, CLI overrides, Python callers, and the migration guide. Preserve the recording format and sampler bindings when applying config overrides.

Breaking changes: existing YAML and CLI overrides must use the new choice paths shown below. Python callers pass AssetSelectionSamplerCfg(choices=[...]) or ChoiceSamplerCfg(choices=[...]) as the variation's sampler_cfg. Direct categorical sampler callers supply choices at construction, then call sample() without a choices argument. Empty HDR choices still select from all registered HDRs; enabled asset selection requires a non-empty pool.

Uniform replay previously accepted values outside low/high; those values are now rejected. Match the experiment bounds to the intended replay data. Custom samplers used for variation replay must implement validate_samples() without drawing samples, invoking replay callbacks, or notifying listeners.

Usage example

Before:

variations:
  pick_up_object.asset_selection.enabled: true
  pick_up_object.asset_selection.registry_names: [cracker_box, sugar_box]
  light.hdr_image.enabled: true
  light.hdr_image.hdr_names: [home_office_robolab, billiard_hall_robolab]

After:

variations:
  pick_up_object.asset_selection.enabled: true
  pick_up_object.asset_selection.sampler_cfg.choices: [cracker_box, sugar_box]
  light.hdr_image.enabled: true
  light.hdr_image.sampler_cfg.choices: [home_office_robolab, billiard_hall_robolab]

Validation

Ran the Experiment Runner locally with two replay files, the zero-action policy, and trajectory recording enabled. A second file selecting banana_ycb_robolab outside the configured choices exited with code 1 before any rollout and left the output directory empty.

Corrected that file to select orange_01_fruits_veggies_robolab and reran into the same output directory. Both rebuilds completed with the expected asset selections, one episode record, and one HDF5 trajectory each.

Also ran the Experiment Runner with a valid first file and a second file recording mass 3.0 against bounds [0.1, 2.0]. It rejected rebuild 1 before any rollout and left the output directory empty.

@qianl-nv
qianl-nv marked this pull request as ready for review December 1, 2026 03:07
@greptile-apps

greptile-apps Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Validates every replay file against the Run's enabled variations before the first environment build.

  • The Run checks every replay file before its first environment rebuild.
  • Replay values must fit the shape and rules of their sampler.
  • Asset and HDR variations take their allowed names from sampler choices.

No actionable issues found. This review used source inspection; tests were not run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Run configuration] --> B[Create preflight builder]
  B --> C[Apply variation overrides]
  C --> D[Load and validate every replay file]
  D -->|Invalid| E[Stop before rollout outputs]
  D -->|Valid| F[Build each environment]
  F --> G[Bind replay samples and run episodes]
Loading

Reviews (1) · Last reviewed commit: "Move variation choice fields into sample..." · Reviewed by Greptile

@arena-review-bot

Copy link
Copy Markdown
Contributor

🤖 Isaac Lab-Arena Review Bot

Summary

This PR checks every replay file against the Run's variation settings before the first rebuild. A bad file for a later rebuild now fails before any rollout runs or output is written. To make that one generic check, categorical choices move into the sampler configs (sampler_cfg.choices), replacing registry_names and hdr_names. The fix looks right. The points below cover where the migration note lives, duplicated sampler code, and two smaller follow-ups. At review time the test jobs had not run yet (they were skipped and the image build was still in progress), so I haven't seen a test result.

Findings

🟡 Warning: docs/pages/references/migration_guide_v0_4.rst:527: release/0.4.0 still ships registry_names and hdr_names, and main keeps changes made after v0.4.0 in migration_guide_v0_5.rst. Unless this PR is also going into the release branch, the rename belongs in the v0.5 guide and the v0.4 guide edits should be reverted.

🔵 Improvement: isaaclab_arena/variations/choice_sampler.py:58: ChoiceSampler and SequentialSampler now duplicate the code that stores and validates choices. A shared base class would remove the copy. It would also make replay errors for HDR and random-choice asset selection name the bad value and the allowed choices.

🔵 Improvement: isaaclab_arena/evaluation/run_execution.py:318: the up-front check repeats the builder's steps of applying overrides and then validating. If ArenaEnvBuilder owned those steps, both paths would stay in sync.

🔵 Improvement: docs/pages/concepts/experiment_record_replay.rst:40: placement poses are still checked separately for each rebuild. The sentence saying all replay files are validated before the first rebuild promises more than the code does.

Verdict

Minor fixes needed

@qianl-nv qianl-nv left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

self review 1

qianl-nv added a commit that referenced this pull request Dec 2, 2026
Report the JSONL filename and all affected line numbers when a recorded
variation is missing from some episode records.

Fixes https://nvbugspro.nvidia.com/bug/7140973

## Why this change?

A missing `variations` field currently reports only that a build-time
variation is absent from some records. Finding the bad rows in a large
or merged recording requires inspecting every file.

This change targets `main` and is independent of the replay preflight
and sampler changes in #1792.

## What changes?

Check partial presence for both build-time and run-time variations in
the loader, and remove the redundant presence check from replay
validation. Use "Build-time variation" for known build-time keys and
"Recorded variation" for other keys, whose phase the loader cannot
determine.

When validation fails, scan the source lines to report every missing row
for the offending variation, accounting for blank lines. Use strict row
matching so a changed row count fails instead of silently truncating the
diagnostic. Keep the JSONL parser and its returned records unchanged.

Variations omitted from every record can still be sampled live, except
that geometry-changing build-time variations require recorded values
when replaying recorded placements. Update the placement-test fixture to
include its variation in both records, and remove duplicate tests.

For example:

```text
Build-time variation 'light.color' is missing from some episode records: outputs/rebuild1.jsonl, lines 2, 37
```

---------

Signed-off-by: Qian Lin <[email protected]>
@qianl-nv
qianl-nv force-pushed the qianl/fix/validate-variation-replay branch from 9ed3ab1 to 609de6b Compare December 2, 2026 05:14

@cvolkcvolk cvolkcvolk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm!

@qianl-nv
qianl-nv force-pushed the qianl/fix/validate-variation-replay branch from bab607a to 32d96ef Compare December 3, 2026 03:28
@qianl-nv
qianl-nv enabled auto-merge (squash) December 3, 2026 04:03
@qianl-nv
qianl-nv merged commit ecb2f74 into main Dec 3, 2026
10 checks passed
@qianl-nv
qianl-nv deleted the qianl/fix/validate-variation-replay branch December 3, 2026 06:03
qianl-nv added a commit that referenced this pull request Dec 3, 2026
Backport #1792 (`ecb2f74a89d3ac74a2990abd09baca48a7fcb9d7`) to
`release/0.4.0`. Validate all replay files against the Run's configured
sampler choices and ranges before the first rebuild, so a bad later file
cannot leave completed rollouts and datasets behind.

Fixes https://nvbugspro.nvidia.com/bug/7140990.

## What changes?

- Share side-effect-free sample validation between preflight checks and
replay sampling. Errors identify the variation, replay file, and
rebuild.
- Move categorical choices into samplers, retaining asset and HDR
registry validation in their variations. Update the release examples and
migration guide.

**Breaking changes:** replace variation-level `registry_names` and
`hdr_names` with `sampler_cfg.choices` in YAML, CLI overrides, and
Python configs. Direct categorical sampler callers provide choices at
construction. Uniform replay now rejects values outside the configured
bounds; custom replay samplers must implement `validate_samples()`.

## Release adaptations

- Keep the release's variations-guide structure and update its existing
command examples. Main's guide was reorganized in #1463 and #1737,
neither of which is on release.
- Omit edits to `test_concept_experiment_configs.py` and
`gr1_put_sauce_bottles_in_fridge_gr00t_experiment.yaml`, which were
introduced by #1463 and #1702 and do not exist on release.
- Set the new rollout test mock's return value to `None` for the
release's metrics aggregation. Main removed that aggregation in #1456;
production replay logic is unchanged from #1792.

## Validation scope

The original end-to-end checks are documented in #1792: an invalid
second replay file was rejected before any rollout, and correcting it
allowed a retry into the same output directory. Those full Experiment
Runner checks were not repeated for this backport.

Signed-off-by: Qian Lin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants