Skip to content

[release/0.4.0] Validate replay before the first rebuild (#1792) - #1836

Merged
qianl-nv merged 1 commit into
release/0.4.0from
qianl/fix/validate-replay-release-0.4.0
Dec 3, 2026
Merged

qianl-nv merged 1 commit into
release/0.4.0from
qianl/fix/validate-replay-release-0.4.0

Conversation

@qianl-nv

@qianl-nv qianl-nv commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

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

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.

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:

```yaml
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:

```yaml
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.

---------

(cherry picked from commit ecb2f74)
Signed-off-by: Qian Lin <[email protected]>
@greptile-apps

greptile-apps Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5RetriggerView in Greptile

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

This PR checks every replay file against the Run's configured variations before starting a multi-file replay.

  • Runs with multiple replay files check them before the first rebuild.
  • Categorical samplers keep their allowed choices in their configuration.
  • Variation overrides reject fields that the config does not define.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Start Run] --> B{Multiple distinct replay files?}
    B -->|Yes| C[Create builder and apply overrides]
    C --> D[Check every replay file]
    D -->|Invalid| E[Stop before first rebuild]
    D -->|Valid| F[Start rebuild loop]
    B -->|No| F
    F --> G[Load and check this rebuild's replay]
    G --> H[Bind recorded samples]
    H --> I[Build environment and run episodes]
Loading

Reviews (1) · Last reviewed commit: "Validate replay files before the first r..." · Reviewed by Greptile

@arena-review-bot

Copy link
Copy Markdown
Contributor

🤖 Isaac Lab-Arena Review Bot

Summary

This backports #1792 to release/0.4.0. Before the first environment build, every replay file is checked against the Run's sampler choices and bounds, and registry_names/hdr_names move to sampler_cfg.choices. The production code matches the merged #1792 change line for line. The only differences are the release adaptations in the description, and they look correct: for example, Mock(return_value=None) keeps release's aggregate_metrics step from receiving a mock object. The design points raised on #1792 (cost of the extra environment build, the HDR variation filling an empty choice list, where the migration note goes) were settled there, so I haven't repeated them.

When I reviewed, CI had not run the tests on this head: the native uv test job was skipped and the image build was still in progress. So I haven't seen a test result for the release-only test change.

Verdict

Ship it

@qianl-nv
qianl-nv merged commit 22f2375 into release/0.4.0 Dec 3, 2026
11 checks passed
@qianl-nv
qianl-nv deleted the qianl/fix/validate-replay-release-0.4.0 branch December 3, 2026 08:23
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