You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(cli): validate duplicate agent executables during dry run (#736)
#### Overview
NeMo Relay's CLI can accept a command that is syntactically valid but likely duplicates an explicitly selected agent executable:
```bash
nemo-relay run --agent <agent> --dry-run -- <agent> [arguments]
```
This PR makes `--dry-run` the validation and inspection surface for that high-confidence mistake. During a dry run, Relay logs a structured warning about the duplicate and prints the actual resolved launch plan without running setup, starting the gateway, activating dynamic plugins, or launching the agent.
Live launches are unchanged. Relay does not preflight, reject, or rewrite their forwarded arguments; downstream command handling remains authoritative.
- [x] I confirm this contribution is my own work, or I have the right to submit it under this project's license.
- [x] I searched existing issues and open pull requests, and this does not duplicate existing work.
#### Details
- Add `--dry-run` to the Claude, Codex, and Hermes shortcuts.
- Detect a repeated executable only when `--dry-run` is present and the first token after `--` resolves to the explicitly selected agent.
- Reuse `CodingAgent::infer` for canonical names, aliases, paths, and supported executable suffixes.
- Keep the diagnostic in `commands/run.rs` and reuse the existing launcher planning path rather than adding a second command renderer.
- Borrow parsed forwarded arguments rather than cloning them.
- Emit one structured warning containing only the selected agent and fixed diagnostic metadata; executable paths and forwarded arguments are not logged.
- Preserve the complete resolved argv in explicit dry-run output and document that it can contain prompts or credentials.
- Verify that live launches skip this diagnostic and continue through normal downstream handling.
#### Where should the reviewer start?
Start with `crates/cli/src/commands/run.rs`, which owns dry-run admission and the diagnostic. Then review the CLI behavior tests in `crates/cli/tests/cli_tests.rs` and the command-level coverage in `crates/cli/tests/coverage/commands/main_tests.rs`.
#### Validation
- `just test-rust` passed.
- `cargo test -p nemo-relay-cli` passed: 1,202 unit tests, 12 architecture tests, and 104 CLI integration tests.
- `cargo clippy --workspace --all-targets -- -D warnings` passed.
- `cargo fmt --all` and `git diff --check` passed.
- The complete pre-commit suite passed, including Cargo check, Clippy, formatting, audit, FFI header sync, Python typing, Go vet, and Node checks.
- `just docs` passed with zero errors. Fern redirect validation was skipped because the local environment was not authenticated.
- Full PR CI passed on Linux, macOS, Windows amd64, and Windows arm64, including package smoke tests and documentation preview.
#### Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)
- Relates to: none.
Authors:
- Eric Evans II (https://github.com/ericevans-nv)
- Alex Fournier (https://github.com/afourniernv)
Approvers:
- Maryam Najafian (https://github.com/mnajafian-nv)
- Will Killian (https://github.com/willkill07)
URL: #736
0 commit comments