Skip to content

fix(cli): CLI subcommands exiting 0 when the child command fails - #6758

Merged
StafaH merged 4 commits into
isaac-sim:developfrom
mgwedd:fix/cli-exit-code-propagation
Sep 21, 2026
Merged

StafaH merged 4 commits into
isaac-sim:developfrom
mgwedd:fix/cli-exit-code-propagation

Conversation

@mgwedd

@mgwedd mgwedd commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Description

Follow-up to #5237 and #5238. PR #5238 fixed isaaclab -p exiting 0 on child
failure, but the same bug remained in the -t, --new, and --docker
subcommands. run_python_command defaults to check=False, so these commands
reported success even when their Python child failed.

This passes check=True at the three affected call sites, matching the existing
-p behavior. Probe-style subprocesses and the interactive Isaac Sim launch
retain their explicit unchecked behavior.

The regression coverage is consolidated into the existing
source/isaaclab/test/cli/test_misc_commands.py module. One mocked test invokes
all three subcommands and verifies their exact checked calls without launching
child processes.

Type of change

  • Bug fix (non-breaking change)

Validation

  • uv run python -m pytest source/isaaclab/test/cli/test_misc_commands.py -q
    (8 passed in 0.03s)
  • Verified an invalid pytest option now makes isaaclab -t return pytest's
    nonzero exit code instead of 0.
  • uv run python tools/changelog/cli.py check develop
  • uv run isaaclab -f

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks
  • I have made corresponding documentation changes
  • My changes generate no new warnings
  • I have added focused regression coverage
  • I have added a changelog fragment
  • The contributor is listed in CONTRIBUTORS.md

Release backport

  • Backport this pull request to the active release branch after it merges into develop

@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team documentation Improvements or additions to documentation infrastructure labels Jul 28, 2026
@mgwedd
mgwedd marked this pull request as ready for review July 29, 2026 03:34
@mgwedd
mgwedd requested a review from a team July 29, 2026 03:34
Comment thread docs/source/refs/contributing.rst Resolved
@greptile-apps

greptile-apps Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR makes miscellaneous CLI subcommands fail when their Python children fail.

  • Passes checked execution to template creation, testing, VS Code setup, and Docker commands.
  • Adds regression coverage for checked and unchecked child-process behavior.
  • Documents test-command failure propagation and adds a changelog entry and contributor.

Confidence Score: 4/5

The runtime fix appears safe to merge, with non-blocking corrections needed so its regression test runs in the regular suite and its Windows documentation is precise.

Checked execution correctly turns child failures into nonzero CLI exits, but the newly added test is outside the orchestrator's discovery roots and the Windows batch wrapper does not preserve exact pytest status codes as documented.

Files Needing Attention: tools/test_cli_exit_codes.py, docs/source/refs/contributing.rst

Important Files Changed

Filename Overview
source/isaaclab/isaaclab/cli/commands/misc.py Adds checked execution at all five intended child-command call sites, correctly propagating failures through the existing utility.
tools/test_cli_exit_codes.py Correctly tests the desired behavior when run directly, but its location prevents collection by the regular orchestrated suite.
docs/source/refs/contributing.rst Documents failure propagation but overstates exact exit-code preservation on Windows.
source/isaaclab/changelog.d/fix-cli-exit-code-propagation.rst Accurately describes the user-visible nonzero failure-propagation fix.
CONTRIBUTORS.md Adds the contributor in alphabetical order.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    CLI[IsaacLab CLI subcommand] --> Child[Python child process]
    Child -->|exit 0| Success[CLI returns successfully]
    Child -->|nonzero| Check[run_command check=True]
    Check --> Exit[sys.exit with child status]
    Exit --> Shell[Invoking shell or CI step]
Loading

Reviews (1): Last reviewed commit: "Merge branch 'develop' into fix/cli-exit..." | Re-trigger Greptile

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Isaac Lab Review Bot

Summary

Passes check=True at the five run_python_command call sites in isaaclab/cli/commands/misc.py so -t, --new, --vscode, and --docker propagate a failing child's exit code, matching the existing -p behavior. Includes a changelog fragment, a contributing-guide note, a CONTRIBUTORS entry, and a new regression test under tools/. The core change is small, consistent, and matches the established pattern; the remarks below are about the new test's robustness and one behavioral nuance in the VS Code path. Note that command_build_docs still calls run_command for the pip install and sphinx build without check=True, so -d retains the same swallow-the-failure behavior — worth a follow-up if that is in scope.

Architecture impact

No architectural change. The fix only adjusts keyword arguments at existing call sites and preserves the deliberate check=False probes in utils.py and the interactive -s launch.

Test coverage

A new tools/test_cli_exit_codes.py covers run_command in both check=True and check=False modes and guards the misc call sites via a mocked run_python_command. Coverage of the intermediate run_python_command forwarding is missing, and one assertion is coupled to the presence of an optional repo file.

Implementation verdict

Minor fixes needed. Posted 4 actionable findings inline.

Automated comment-only review; human maintainers own approval decisions.

Comment thread tools/test_cli_exit_codes.py Resolved
Comment thread tools/test_cli_exit_codes.py Resolved
mgwedd added 3 commits July 28, 2026 23:24
isaaclab.sh -t, --new, --vscode and --docker ran their Python child
processes without check=True, so a failing child (e.g. pytest failures)
still exited 0. Pass check=True at the remaining run_python_command call
sites, matching the earlier fix to the -p paths, so run_command
propagates the child's exit code.

Fixes isaac-sim#5237

Signed-off-by: Michael Wedd <[email protected]>
Covers the check=True propagation with a regression test for the misc
subcommand wiring, documents that the test commands exit with pytest's
exit code, and adds Michael Wedd to CONTRIBUTORS.md.

Signed-off-by: Michael Wedd <[email protected]>
- Move the regression test to source/isaaclab/test/cli/ so the -t
  orchestrator actually collects it (tools/ is not walked), which also
  removes the module-level sys.path insertion.
- Keep --vscode settings generation best-effort: it also runs inside
  the install flow, and a failure generating editor settings should not
  abort the invoking command. Missing script and failing script now
  behave consistently.
- Add a test that check=True survives the delegation from
  run_python_command to run_command.
- Docs: promise nonzero failure propagation rather than the exact
  pytest code, since isaaclab.bat maps any failure to 1.

Signed-off-by: Michael Wedd <[email protected]>
@mgwedd
mgwedd force-pushed the fix/cli-exit-code-propagation branch from f914f33 to 28cf204 Compare July 29, 2026 05:24
@mgwedd mgwedd changed the title Fixes CLI subcommands exiting 0 when the child command fails fix(cli): CLI subcommands exiting 0 when the child command fails Jul 29, 2026
…e-propagation

# Conflicts:
#	source/isaaclab/isaaclab/cli/commands/misc.py
@StafaH
StafaH requested a review from fatimaanes as a code owner September 21, 2026 03:46
@StafaH

StafaH commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Sep 21, 2026
@StafaH

StafaH commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Sep 21, 2026
@StafaH
StafaH enabled auto-merge (squash) September 21, 2026 04:55
@StafaH
StafaH disabled auto-merge September 21, 2026 04:55
@StafaH
StafaH merged commit a3c2eb1 into isaac-sim:develop Sep 21, 2026
56 of 84 checks passed
@isaaclab-bot

isaaclab-bot Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Backported to release/3.0.0 as 2e31616.

isaaclab-bot Bot pushed a commit that referenced this pull request Sep 21, 2026
# Description

Follow-up to #5237 and #5238. PR #5238 fixed `isaaclab -p` exiting 0 on
child
failure, but the same bug remained in the `-t`, `--new`, and `--docker`
subcommands. `run_python_command` defaults to `check=False`, so these
commands
reported success even when their Python child failed.

This passes `check=True` at the three affected call sites, matching the
existing
`-p` behavior. Probe-style subprocesses and the interactive Isaac Sim
launch
retain their explicit unchecked behavior.

The regression coverage is consolidated into the existing
`source/isaaclab/test/cli/test_misc_commands.py` module. One mocked test
invokes
all three subcommands and verifies their exact checked calls without
launching
child processes.

## Type of change

- Bug fix (non-breaking change)

## Validation

- `uv run python -m pytest
source/isaaclab/test/cli/test_misc_commands.py -q`
  (`8 passed in 0.03s`)
- Verified an invalid pytest option now makes `isaaclab -t` return
pytest's
  nonzero exit code instead of 0.
- `uv run python tools/changelog/cli.py check develop`
- `uv run isaaclab -f`

## Checklist

- [x] I have read and understood the contribution guidelines
- [x] I have run the pre-commit checks
- [x] I have made corresponding documentation changes
- [x] My changes generate no new warnings
- [x] I have added focused regression coverage
- [x] I have added a changelog fragment
- [x] The contributor is listed in `CONTRIBUTORS.md`

## Release backport

- [x] <!-- backport-active-release --> Backport this pull request to the
active release branch after it merges into `develop`

---------

Signed-off-by: Michael Wedd <[email protected]>
Co-authored-by: Mustafa Haiderbhai <[email protected]>

(cherry picked from commit a3c2eb1)
ooctipus added a commit that referenced this pull request Sep 24, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation infrastructure isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants