Adds hydra safty guard against cli args starting with -- - #4802
Conversation
Greptile SummaryThis PR adds a two-line safety guard in Key points:
Confidence Score: 4/5
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["sys.argv[1:] args"] --> B{"starts with '-'?"}
B -->|Yes| SKIP["Skip / discard arg\nnew guard in this PR"]
B -->|No| C{"has '='?"}
C -->|No| GS["global_scalar\npassed to Hydra"]
C -->|Yes| D{"key == 'presets'?"}
D -->|Yes| GP["global_presets list"]
D -->|No| E{"key in preset_paths?"}
E -->|Yes| PS["preset_sel list\nREPLACE selection"]
E -->|No| F{"key starts with preset_path + '.'?"}
F -->|Yes| PSC["preset_scalar list\nscalar in preset path"]
F -->|No| GS2["global_scalar\npassed to Hydra"]
Last reviewed commit: 6d6b08b |
| if arg.startswith("-"): | ||
| continue |
There was a problem hiding this comment.
Args starting with - are silently dropped with no logging or warning. If a user accidentally prefixes a Hydra override with a dash (e.g., -env.sim.dt=0.01 instead of env.sim.dt=0.01), the override will be silently ignored with no feedback as to why it had no effect.
Consider adding a debug-level log message to help users diagnose such situations:
| if arg.startswith("-"): | |
| continue | |
| if arg.startswith("-"): | |
| # Skip non-Hydra CLI args (e.g. --headless, --device=cpu) | |
| continue |
Adding a comment explaining this behavior would also help future maintainers understand the intent.
| if arg.startswith("-"): | ||
| continue |
There was a problem hiding this comment.
The PR description and title refer to filtering -- (double-dash) CLI args, but the guard uses startswith("-"), which also filters single-dash args (e.g., -v, -e). While filtering both single- and double-dash args is correct (neither is valid Hydra override syntax), the code comment should reflect this accurately to avoid confusing future maintainers.
Consider clarifying the intent with a more precise comment:
| if arg.startswith("-"): | |
| continue | |
| if arg.startswith("-"): | |
| # Skip standard UNIX-style CLI flags (both -flag and --flag). | |
| # These are intended for the outer argparse layer, not for Hydra. | |
| continue |
|
Hi @ooctipus — thanks for putting this one up! 🙏 We're doing a cleanup pass over the Isaac Lab PR backlog, which had grown past 400 open pull requests, and we're closing out the ones that have gone quiet so the queue is reviewable again. Why this PR is being closed: Here is exactly what we found on this PR when we reviewed the backlog:
It was picked up by the sweep because it has been open for about 6 months. It was then put in the "close" bucket because the author has been silent for about 6 months — which is the signal we used to tell apart pull requests that are still being worked on from ones that have genuinely been set aside. We deliberately did not close pull requests that were approved and ready to land, or that were small and clearly still fixing a live bug — there were 27 of those, and we are merging them rather than closing them. No judgement on the change itself — this is purely backlog hygiene. If this is still wanted, please reopen it or re-submit against 🤖 This comment was drafted with AI assistance as part of a maintainer-led sweep of the Isaac Lab pull request backlog. A maintainer is behind this cleanup — but if this closure looks wrong, it may well be, so please push back and we'll take another look. |
Description
This PR adds safty guard mechanism to hydra preset system to filter out user's -- cliargs
Type of change
Screenshots
Please attach before and after screenshots of the change if applicable.
Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there