Repository navigation
Fix DelayBuffer state mutation on invalid lag - #7893
Conversation
Signed-off-by: Xu Zihan <[email protected]>
Add test for invalid time lag handling in delay buffer. Signed-off-by: Xu Zihan <[email protected]>
Fixes an issue with DelayBuffer that caused invalid delays to remain in the buffer after validation failure. Signed-off-by: Xu Zihan <[email protected]>
There was a problem hiding this comment.
Isaac Lab Review Bot
The change makes DelayBuffer.set_time_lag transactional: updates are staged, validated as a complete candidate state, and committed only after validation succeeds. Rejected scalar and tensor lags therefore leave the live lag tensor and cached extrema unchanged.
- Design and architecture: State remains owned by
DelayBuffer, with the committed lag tensor and cached minimum/maximum updated together. Usingcopy_()preserves the existing tensor identity, whilecompute()continues to consume the same_time_lagsobject. - API: Accepted inputs, validation errors, device conversion, and successful update semantics remain unchanged. The observable behavior on failed validation is corrected without renaming or removing public APIs, and the package includes an appropriate past-tense changelog fragment.
- Implementation: Both scalar and tensor updates now target a clone before range validation, and the live state is committed only on success. Regression coverage checks rejected negative and over-limit updates. The added clone introduces a small per-update allocation, and the new test still warrants execution in the project environment because it was not run by the author, but neither issue requires a pre-merge correction based on the supplied patch.
No blocking issues. No inline issue met the actionable-evidence threshold; the assessment above records the review feedback.
Automated review; human maintainers own approval decisions.
|
| expected_lags = delay_buffer.time_lags.clone() | ||
|
|
||
| with pytest.raises(ValueError): | ||
| delay_buffer.set_time_lag(time_lag, batch_ids) | ||
|
|
||
| assert torch.equal(delay_buffer.time_lags, expected_lags) |
There was a problem hiding this comment.
Tensor identity remains untested
This regression test verifies only the tensor values and cached extrema, while the implementation explicitly preserves time_lags identity for callers that retain a reference. Retain the pre-call tensor and assert that it remains the same object after the rejected update. Otherwise, a future change from copy_() to tensor reassignment could break that compatibility guarantee while this test continues to pass.
| expected_lags = delay_buffer.time_lags.clone() | |
| with pytest.raises(ValueError): | |
| delay_buffer.set_time_lag(time_lag, batch_ids) | |
| assert torch.equal(delay_buffer.time_lags, expected_lags) | |
| expected_lags = delay_buffer.time_lags | |
| expected_values = expected_lags.clone() | |
| with pytest.raises(ValueError): | |
| delay_buffer.set_time_lag(time_lag, batch_ids) | |
| assert delay_buffer.time_lags is expected_lags | |
| assert torch.equal(delay_buffer.time_lags, expected_values) |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
run-ci |
Fixes isaac-sim#7793 DelayBuffer.set_time_lag currently writes the requested lag into the live tensor before validating the resulting range. If validation raises, the invalid value remains in the buffer and later compute() calls use it. This validates the requested scalar or tensor delays before assigning them to the live tensor. Invalid inputs raise immediately without changing the lag tensor or its cached bounds. Valid updates retain the existing tensor identity, without cloning the full buffer state. - [x] Bug fix (non-breaking change which fixes an existing issue) - [x] I have run the pre-commit checks - [x] I have added regression coverage for the rejected scalar and tensor updates - [x] I have added a changelog fragment Validation: all 7 tests in test_delay_buffer.py passed. The added early-validation regression failed against the previous clone-based implementation and passed with this change. Additional CPU and CUDA checks covered valid full/subset updates, empty selections, rejected inputs, tensor identity, cached bounds, and subsequent delayed output. Full pre-commit checks and git diff --check passed. --------- Signed-off-by: Xu Zihan <[email protected]> Co-authored-by: Octi Zhang <[email protected]> (cherry picked from commit 22fcd71)
…ng docs (#7957) Backports the three changes from the September 20–23 `develop` audit that are missing from `release/3.0.0`, alongside the existing cloning-guide backport: - #7722 (`4cf439dfeb`): reject a second `SimulationContext` construction instead of silently discarding its configuration. Includes the original fixture cleanup and regression coverage. - #7893 (`22fcd71bc4`): validate DelayBuffer lag values before mutating its live configuration. - #7947 (`6e9ef17f59`): make `v3.0.0-EA` the default documentation version in deployment and local multi-version builds. - #7129 (`354168560f`): clarify that `replicate_physics=False` skips the active physics context while other declared replication contexts still run. **Compatibility:** repeated `SimulationContext(...)` calls now raise. Retrieve the live context with `SimulationContext.instance()`, or call `clear_instance()` before constructing a replacement. The original major changelog fragment includes this migration. The runtime and test files match current `develop`. The docs-default backport adapts the release branch's existing redirect template, validates the target page, and preserves explicit overrides. The cloning-guide backport preserves the current release APIs; its obsolete sections were already removed. ## Release audit Checked all **35 PRs** merged into `develop` from **2026-09-20 16:43:18 UTC** through `cff81e8473` (September 23), against release head `5d3e0b695e`. **32 are already covered; the remaining three are included here.** Git history, patch equivalence, GitHub's merged PR list, and remaining file differences were checked. Branch-specific version/changelog compilation and existing release-only changes are preserved. <details> <summary>Already covered PRs</summary> 26 have an equivalent patch in release: #7919, #7922, #7923, #7924, #7925, #6758, #7928, #7902, #7927, #7891, #7931, #7691, #7861, #7929, #7916, #7939, #4609, #7942, #7940, #7948, #7937, #7955, #7960, #7961, #7970, #7958. Six were squash-merged or adapted: #7530 and #7899 in #7926; #7637 in #7933; #7860 in #7936; #7954 and #7950 in #7964. Their implementation differences were checked against the current release tree. </details> ## Validation - **276 tests passed**: SimulationContext (51, including CPU/CUDA), headless context construction (15), nine schema/fragment suites (165), four manager suites (38), and DelayBuffer (7). - Both backported regressions reproduce with the original release implementations. - Docs redirect recipe: local/deployment EA defaults, explicit override, and missing-target rejection passed with a stubbed Sphinx builder. - All 22 changed files match the intended backport scope; `uv run isaaclab -f` and `git diff --check` passed. - Fresh Sphinx validation (`-b dummy -W --keep-going`): passed without warnings, excluding static assets as the HTML builder does. Full HTML documentation CI is running. Local runtime validation used PyTorch 2.12.0, CUDA 13.0, Isaac Sim 6.0.1.0, and an RTX 5090. Existing runtime/deprecation warnings occurred; the CI jobs validate the pinned environments. The previous [docs CI failure](https://github.com/isaac-sim/IsaacLab/actions/runs/35795116307/job/106972539281) was an external connection reset fetching the Omniverse intersphinx inventory, producing one warning under `-W`. That URL returned HTTP 200 when rechecked. This update starts a fresh docs build. --------- Co-authored-by: hujc <[email protected]> Co-authored-by: Zihan Xu <[email protected]>
Description
Fixes #7793
DelayBuffer.set_time_lag currently writes the requested lag into the live tensor before validating the resulting range. If validation raises, the invalid value remains in the buffer and later compute() calls use it.
This validates the requested scalar or tensor delays before assigning them to the live tensor. Invalid inputs raise immediately without changing the lag tensor or its cached bounds. Valid updates retain the existing tensor identity, without cloning the full buffer state.
Type of change
Checklist
Validation: all 7 tests in test_delay_buffer.py passed. The added early-validation regression failed against the previous clone-based implementation and passed with this change. Additional CPU and CUDA checks covered valid full/subset updates, empty selections, rejected inputs, tensor identity, cached bounds, and subsequent delayed output. Full pre-commit checks and git diff --check passed.