Skip to content

feat(cli): warn about duplicate agent executables - #736

Open
ericevans-nv wants to merge 2 commits into
NVIDIA:mainfrom
ericevans-nv:feat/duplicate-agent-invocation-diagnostic
Open

feat(cli): warn about duplicate agent executables#736
ericevans-nv wants to merge 2 commits into
NVIDIA:mainfrom
ericevans-nv:feat/duplicate-agent-invocation-diagnostic

Conversation

@ericevans-nv

@ericevans-nv ericevans-nv commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Overview

NeMo Relay’s CLI does not currently warn users when a command is syntactically accepted but is likely incorrect. These commands can continue into execution and fail later with confusing behavior, leaving the user without an explanation of the likely mistake or a suggested correction.

The first high-confidence case addressed by this PR is a duplicated agent executable:

nemo-relay run --agent <agent> -- <agent> [arguments]

The likely intended command is:

nemo-relay run --agent <agent> -- [arguments]

This PR introduces an advisory CLI invocation diagnostic for that command shape. The diagnostic identifies the possible duplication, displays redacted versions of the observed and recommended commands, and gives the user a doctor command for further inspection.

The warning is informational. Relay does not reject the command, silently rewrite it, or inspect prompt content. This provides actionable guidance while preserving existing execution behavior.

  • I confirm this contribution is my own work, or I have the right to submit it under this project's license.
  • I searched existing issues and open pull requests, and this does not duplicate existing work.

Details

  • Add the first targeted CLI invocation diagnostic for a command that is syntactically valid but likely incorrect.
  • Detect when the first token after -- appears to repeat the agent executable already selected by the command.
  • Support both CLI invocation forms:
    • nemo-relay run --agent <agent> -- ...
    • nemo-relay <agent> -- ...
  • Recognize supported Claude, Codex, and Hermes executable names, aliases, and executable paths through the existing agent inference logic.
  • Print an advisory warning containing:
    • A stable diagnostic identifier.
    • The duplicated executable.
    • A redacted representation of the observed command.
    • A redacted representation of the recommended command.
    • Commands for inspecting the diagnosis.
  • Redact forwarded arguments by default so prompts and other potentially sensitive values are not printed.
  • Emit a structured agent_invocation_warning log without recording paths, prompts, or forwarded arguments.
  • Add nemo-relay doctor invocation so users can inspect a command without launching an agent.
  • Keep doctor output redacted by default and require --show-full-command before displaying complete arguments.
  • Continue executing the original command without rejecting or modifying it.
  • Limit detection to the first forwarded token so agent names appearing later in valid arguments or prompt content do not trigger the warning.
  • Add focused tests for:
    • Standard run --agent commands.
    • Agent shortcuts.
    • Executable names, aliases, and paths.
    • Redacted and full doctor output.
    • Valid commands that should not produce a warning.
    • Continued execution without command rewriting.
  • Add concise CLI documentation showing the incorrect command shape, recommended correction, warning output, and doctor workflow.

Where should the reviewer start?

Start with crates/cli/src/diagnostics/invocation.rs, which defines the diagnostic condition, redaction boundary, warning content, and recommended command rendering.

Then review:

  1. crates/cli/src/commands/run.rs for where the diagnostic is evaluated before the existing launch path.
  2. crates/cli/src/commands/diagnostics.rs for the doctor invocation command.
  3. crates/cli/tests/cli_tests.rs for observable CLI behavior.
  4. crates/cli/tests/coverage/shared/invocation_diagnostic_tests.rs for focused detection and rendering coverage.

Validation

  • cargo test -p nemo-relay-cli passed: 1,204 unit, 12 architecture, and 105 CLI integration tests.
  • All diff-scoped pre-commit checks passed.
  • Documentation link checking passed with zero errors.

Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

  • Relates to: none.

@github-actions github-actions Bot added size:L PR is large Feature a new feature lang:rust PR changes/introduces Rust code labels Aug 7, 2026
Signed-off-by: Eric Evans <194135482+ericevans-nv@users.noreply.github.com>
@ericevans-nv
ericevans-nv force-pushed the feat/duplicate-agent-invocation-diagnostic branch from a126bd4 to c284414 Compare August 7, 2026 13:25
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The CLI now detects duplicate agent executables in normal and shortcut invocations. It adds doctor invocation for non-launching inspection, redacts command arguments by default, supports full command display, and documents the behavior with CLI coverage.

Changes

Invocation diagnostics

Layer / File(s) Summary
Duplicate-agent diagnostic model
crates/cli/src/diagnostics/..., crates/cli/tests/coverage/shared/invocation_diagnostic_tests.rs
Adds duplicate executable detection, invocation forms, structured warnings, command formatting, redaction, and coverage for supported agents and command shapes.
CLI invocation diagnostic integration
crates/cli/src/commands/..., crates/cli/tests/cli_tests.rs, crates/cli/tests/coverage/commands/main_tests.rs, docs/nemo-relay-cli/basic-usage.mdx
Adds doctor invocation, integrates detection into normal and shortcut run flows, validates CLI parsing and outcomes, and documents argument forwarding and redaction behavior.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant RunCommand
  participant DuplicateAgentExecutable
  participant DoctorCommand
  participant stderr
  RunCommand->>DuplicateAgentExecutable: detect(agent, command, form)
  DuplicateAgentExecutable->>stderr: print_invocation_warning(format_warning())
  DoctorCommand->>DuplicateAgentExecutable: detect(agent, command, form)
  DuplicateAgentExecutable-->>DoctorCommand: formatted diagnostic or no-duplicate result
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 93.33% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title follows Conventional Commits format, uses an allowed type and scope, stays under 72 characters, and accurately summarizes the change.
Description check ✅ Passed The description includes the required sections, checklist confirmations, implementation details, reviewer guidance, and validation results.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Signed-off-by: Eric Evans <194135482+ericevans-nv@users.noreply.github.com>
@ericevans-nv
ericevans-nv force-pushed the feat/duplicate-agent-invocation-diagnostic branch from 432c1b9 to 79760d0 Compare August 7, 2026 13:51
@ericevans-nv
ericevans-nv marked this pull request as ready for review August 7, 2026 13:54
@ericevans-nv
ericevans-nv requested review from a team as code owners August 7, 2026 13:54

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/cli/tests/cli_tests.rs`:
- Around line 3817-3865: Extend
invocation_diagnostic_cli_warns_without_rewriting_the_command to capture
normal-run structured logs, then assert the raw executable path and forwarded
arguments are absent from those logs in addition to stderr. At
crates/cli/tests/cli_tests.rs lines 3947-3985, apply the same structured-log
capture and assert the forwarded arguments are absent; preserve the existing
rendered-warning assertions.

In `@crates/cli/tests/coverage/shared/invocation_diagnostic_tests.rs`:
- Around line 12-17: Expand the cases matrix in the invocation diagnostic tests
to include every documented executable name, alias, and path form for each
CodingAgent, not just the current Codex and Hermes examples. Reuse the supported
forms defined by the matching implementation so the tests cover the complete
promised API surface while retaining the existing ClaudeCode cases.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 963b0853-7a66-4ad1-b923-b290c462c0f9

📥 Commits

Reviewing files that changed from the base of the PR and between d27a20e and 79760d0.

📒 Files selected for processing (9)
  • crates/cli/src/commands/diagnostics.rs
  • crates/cli/src/commands/mod.rs
  • crates/cli/src/commands/run.rs
  • crates/cli/src/diagnostics/invocation.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/cli/tests/cli_tests.rs
  • crates/cli/tests/coverage/commands/main_tests.rs
  • crates/cli/tests/coverage/shared/invocation_diagnostic_tests.rs
  • docs/nemo-relay-cli/basic-usage.mdx
📜 Review details
⏰ Context from checks skipped due to timeout. (11)
  • GitHub Check: Rust / Package (macos-arm64)
  • GitHub Check: Rust / Test (windows-amd64)
  • GitHub Check: Rust / Package (linux-arm64)
  • GitHub Check: Rust / Package (windows-amd64)
  • GitHub Check: Rust / Package (windows-arm64)
  • GitHub Check: Rust / Test (linux-amd64)
  • GitHub Check: Rust / Package (linux-amd64)
  • GitHub Check: Rust / Test (linux-arm64)
  • GitHub Check: Rust / Test (windows-arm64)
  • GitHub Check: Rust / Test (macos-arm64)
  • GitHub Check: Preview docs
🧰 Additional context used
📓 Path-based instructions (21)
**/*.rs

📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)

**/*.rs: Any Rust change must run just test-rust
Any Rust change must run cargo fmt --all
Any Rust change must run cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all for all FFI work since it is Rust work
Run just test-rust to validate FFI changes
Run cargo clippy --workspace --all-targets -- -D warnings to enforce strict linting on FFI work

When Rust files changed as part of Go work, also run cargo fmt --all, just test-rust, and cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all when Rust files are changed as part of Node work
Run cargo clippy --workspace --all-targets -- -D warnings when Rust files are changed as part of Node work
Run just test-rust when Rust files are changed as part of Node work

**/*.rs: If any Rust code changed, always run just test-rust.
If any Rust code changed, also run cargo fmt --all.
If any Rust code changed, also run cargo clippy --workspace --all-targets -- -D warnings.
For Rust changes headed for review, run cargo fmt --all and cargo clippy --workspace --all-targets -- -D warnings even if relying on pre-commit.

**/*.rs: Format Rust code with rustfmt defaults using cargo fmt.
Run cargo clippy -- -D warnings; all Rust warnings must be treated as errors.
Use Rust snake_case naming conventions.

Files:

  • crates/cli/src/diagnostics/mod.rs
  • crates/cli/tests/coverage/commands/main_tests.rs
  • crates/cli/src/commands/mod.rs
  • crates/cli/tests/coverage/shared/invocation_diagnostic_tests.rs
  • crates/cli/src/commands/run.rs
  • crates/cli/src/commands/diagnostics.rs
  • crates/cli/tests/cli_tests.rs
  • crates/cli/src/diagnostics/invocation.rs
{crates/**/src/**/*.rs,python/**/*.py}

📄 CodeRabbit inference engine (.agents/skills/maintain-dynamic-plugins/SKILL.md)

Do not add tests under src; Rust tests belong in crate tests/ trees, and Python SDK tests belong under python/tests.

Files:

  • crates/cli/src/diagnostics/mod.rs
  • crates/cli/src/commands/mod.rs
  • crates/cli/src/commands/run.rs
  • crates/cli/src/commands/diagnostics.rs
  • crates/cli/src/diagnostics/invocation.rs
**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

**/*: Format changed files with the language-native formatter before the final lint/test pass.
If dynamic plugin behavior changed, use maintain-dynamic-plugins and include the native SDK, worker protocol, Python SDK, docs, packaging, and Codecov surfaces in the validation plan.
If code changes alter APIs, bindings, commands, paths, packaging behavior, observability/adaptive semantics, or documented best practices, update any dependent maintainer or consumer skills in the same branch.
During iteration, prefer uv run pre-commit run --files <changed files...>.
Before review or handoff, run uv run pre-commit run --all-files.

**/*: Use release tags in raw Rust-compatible SemVer without a leading v; tags such as v0.1.0 are prohibited.
Use branch prefixes feat/, fix/, docs/, test/, or refactor/ according to the change purpose.
Every commit in a pull request must include a DCO Signed-off-by: sign-off.
Before submitting a pull request, ensure pre-commit hooks, relevant tests, target-specific builds, documentation updates, and a rebase on the latest main are complete.
Use commit messages in the form type: short description, with a valid type and a first line under 72 characters.

Files:

  • crates/cli/src/diagnostics/mod.rs
  • crates/cli/tests/coverage/commands/main_tests.rs
  • crates/cli/src/commands/mod.rs
  • docs/nemo-relay-cli/basic-usage.mdx
  • crates/cli/tests/coverage/shared/invocation_diagnostic_tests.rs
  • crates/cli/src/commands/run.rs
  • crates/cli/src/commands/diagnostics.rs
  • crates/cli/tests/cli_tests.rs
  • crates/cli/src/diagnostics/invocation.rs
**/*.{rs,py,go,js,ts}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If a language surface changed, always run that language's test target even when Rust core did not change.

**/*.{rs,py,go,js,ts}: When observability configuration or lifecycle is exposed, keep FFI and Python, Go, and Node.js binding-native config objects and subscriber/exporter methods aligned in logical knobs and semantics.
Require every OpenTelemetry endpoint to have a type and nonblank destination; resolve header_env values at activation and reject missing, blank, or duplicate headers.
Concatenate layered ATOF sink, ATIF storage, and OpenTelemetry endpoint lists with higher-precedence entries first.
Preserve correct handling of mark events, start/end events, orphan cases, and span or trajectory fields derived from intended event data.
Run affected Rust tests and just test-rust when event fields change; run just test-python, just test-go, and just test-node when binding-native configuration or lifecycle changes.

Files:

  • crates/cli/src/diagnostics/mod.rs
  • crates/cli/tests/coverage/commands/main_tests.rs
  • crates/cli/src/commands/mod.rs
  • crates/cli/tests/coverage/shared/invocation_diagnostic_tests.rs
  • crates/cli/src/commands/run.rs
  • crates/cli/src/commands/diagnostics.rs
  • crates/cli/tests/cli_tests.rs
  • crates/cli/src/diagnostics/invocation.rs
**/*.{rs,py,js,ts,tsx,go,java,kt,swift}

📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)

Add tests covering registration and duplicate names, deregistration and missing names, priority ordering, callback failure policy, scope-local inheritance and cleanup, event payload semantics, immutable mark and scope fields, and parity across affected bindings.

Files:

  • crates/cli/src/diagnostics/mod.rs
  • crates/cli/tests/coverage/commands/main_tests.rs
  • crates/cli/src/commands/mod.rs
  • crates/cli/tests/coverage/shared/invocation_diagnostic_tests.rs
  • crates/cli/src/commands/run.rs
  • crates/cli/src/commands/diagnostics.rs
  • crates/cli/tests/cli_tests.rs
  • crates/cli/src/diagnostics/invocation.rs
**/*.{rs,py,js,jsx,ts,tsx,go,c,h,cc,cpp,md,toml,yml,yaml,sh}

📄 CodeRabbit inference engine (AGENTS.md)

Keep SPDX headers on source, documentation, scripts, and configuration files; the project is Apache-2.0.

Files:

  • crates/cli/src/diagnostics/mod.rs
  • crates/cli/tests/coverage/commands/main_tests.rs
  • crates/cli/src/commands/mod.rs
  • crates/cli/tests/coverage/shared/invocation_diagnostic_tests.rs
  • crates/cli/src/commands/run.rs
  • crates/cli/src/commands/diagnostics.rs
  • crates/cli/tests/cli_tests.rs
  • crates/cli/src/diagnostics/invocation.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

Use snake_case naming in Rust and Python.

Files:

  • crates/cli/src/diagnostics/mod.rs
  • crates/cli/tests/coverage/commands/main_tests.rs
  • crates/cli/src/commands/mod.rs
  • crates/cli/tests/coverage/shared/invocation_diagnostic_tests.rs
  • crates/cli/src/commands/run.rs
  • crates/cli/src/commands/diagnostics.rs
  • crates/cli/tests/cli_tests.rs
  • crates/cli/src/diagnostics/invocation.rs
crates/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

crates/**/*.rs: Use Json = serde_json::Value in Rust-facing runtime APIs where existing code expects JSON payloads.
Treat Rust as the source of truth for runtime behavior; binding APIs should mirror Rust semantics unless a language-specific wrapper intentionally improves ergonomics.

Files:

  • crates/cli/src/diagnostics/mod.rs
  • crates/cli/tests/coverage/commands/main_tests.rs
  • crates/cli/src/commands/mod.rs
  • crates/cli/tests/coverage/shared/invocation_diagnostic_tests.rs
  • crates/cli/src/commands/run.rs
  • crates/cli/src/commands/diagnostics.rs
  • crates/cli/tests/cli_tests.rs
  • crates/cli/src/diagnostics/invocation.rs
**/*.{rs,py,js,mjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Preserve the existing Tokio-based asynchronous model and callback/future lifetimes; do not unexpectedly block or hide async work in bindings.

Files:

  • crates/cli/src/diagnostics/mod.rs
  • crates/cli/tests/coverage/commands/main_tests.rs
  • crates/cli/src/commands/mod.rs
  • crates/cli/tests/coverage/shared/invocation_diagnostic_tests.rs
  • crates/cli/src/commands/run.rs
  • crates/cli/src/commands/diagnostics.rs
  • crates/cli/tests/cli_tests.rs
  • crates/cli/src/diagnostics/invocation.rs
**/*.{rs,py,go,js,jsx,ts,tsx,c,h}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.{rs,py,go,js,jsx,ts,tsx,c,h}: Run tests for every language affected by a change; changes to the core Rust crate require tests across all bindings.
Use SONAR_IGNORE_START / SONAR_IGNORE_END only for documented false positives, keep ignored blocks minimal, explain them with a comment, and obtain reviewer sign-off.
Preserve the layered architecture in which Rust provides the core runtime and C FFI, PyO3, and NAPI provide bindings that mirror the full API surface.

Files:

  • crates/cli/src/diagnostics/mod.rs
  • crates/cli/tests/coverage/commands/main_tests.rs
  • crates/cli/src/commands/mod.rs
  • crates/cli/tests/coverage/shared/invocation_diagnostic_tests.rs
  • crates/cli/src/commands/run.rs
  • crates/cli/src/commands/diagnostics.rs
  • crates/cli/tests/cli_tests.rs
  • crates/cli/src/diagnostics/invocation.rs
**/*.{rs,py,go,js,jsx,ts,tsx,c,h,html,md,mdx,toml}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Include the appropriate SPDX copyright and Apache-2.0 license header in every source file.

Files:

  • crates/cli/src/diagnostics/mod.rs
  • crates/cli/tests/coverage/commands/main_tests.rs
  • crates/cli/src/commands/mod.rs
  • docs/nemo-relay-cli/basic-usage.mdx
  • crates/cli/tests/coverage/shared/invocation_diagnostic_tests.rs
  • crates/cli/src/commands/run.rs
  • crates/cli/src/commands/diagnostics.rs
  • crates/cli/tests/cli_tests.rs
  • crates/cli/src/diagnostics/invocation.rs
**/{test,tests}/**/*

📄 CodeRabbit inference engine (CONTRIBUTING.md)

When adding functionality, include tests in the appropriate test files for each affected language binding.

Files:

  • crates/cli/tests/coverage/commands/main_tests.rs
  • crates/cli/tests/coverage/shared/invocation_diagnostic_tests.rs
  • crates/cli/tests/cli_tests.rs
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}

⚙️ CodeRabbit configuration file

{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}: Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.
Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests.

Files:

  • crates/cli/tests/coverage/commands/main_tests.rs
  • crates/cli/tests/coverage/shared/invocation_diagnostic_tests.rs
  • crates/cli/tests/cli_tests.rs
**/*.mdx

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)

MDX top-of-file SPDX comments must use {/* ... */} delimiters instead of HTML comment delimiters (Must-Fix)

**/*.mdx: In MDX files, top-of-file comments must use JSX comment delimiters ({/* and */}); do not use HTML comments for MDX SPDX headers.
New or regenerated MDX files must use {/* ... */} for top-of-file SPDX comments.

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
{docs,examples}/**/*

📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)

Update docs and examples.

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
docs/**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If documentation examples or commands under docs/ change, run the targeted docs checks appropriate to the change.

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
**/*.{md,mdx}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If links in documentation change, run just docs-linkcheck.

Use documented public APIs and stable wrapper commands in examples and user-facing documentation; do not rely on internal helpers.

**/*.{md,mdx}: Prefer the documented public API over internal shortcuts in documentation and examples.
Keep package names, repository references, and build commands current.
Contribution workflow documentation must require an issue before external contribution pull requests and note that NVIDIA contributors may use a GitHub or Linear issue.
Update entry-point documentation when examples or reading paths change.
Keep release-process and release-notes guidance in maintainer documentation such as RELEASING.md, rather than user-facing documentation pages or CHANGELOG.md.
Use stable user-facing wrappers at the scripts/ root in documentation and examples; reference namespaced helper paths only for internal maintenance documentation.
When detailed dynamic plugin guides exist, keep Rust native plugin examples, Python worker plugin examples, and grpc-v1 protocol details on separate pages.
Dynamic plugin manifests in documentation and examples should use compat.relay = ">=0.5,<1.0" unless deliberately narrower.
Render images, diagrams, tables, and other visual content at representative page widths, ensuring legibility and complete access without clipping; use responsive scaling, reflow, or overflow as appropriate and scope visual styling narrowly.
Dynamic plugin entry pages should link to native, worker, Rust example, Python example, and protocol pages when those pages exist.
Images, diagrams, tables, and custom visual content must remain legible and fully accessible at representative desktop and narrow page widths.
Release-policy documentation must point to GitHub Releases as the only release-history source of truth.
Run just docs when the documentation site changes; retain ./scripts/build-docs.sh html as the compatibility wrapper.

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
**/*.{md,mdx,py,go,js,ts}

📄 CodeRabbit inference engine (.agents/skills/maintain-observability/SKILL.md)

Examples and documentation must use each exporter's documented flush/deregister order before shutdown.

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
docs/**/*.{md,mdx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Update relevant reference documentation when public behavior or APIs change.

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
**/*.{md,mdx,rst}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-technical-docs.md)

**/*.{md,mdx,rst}: Use title case consistently for technical documentation headings and table headers; avoid quotation marks, ampersands, and exclamation marks in headings, while preserving official product, event, research, and whitepaper title case.
Format code elements, commands, parameters, package names, expressions, directories, file names, and paths in monospace; represent path placeholders with angle brackets inside monospace.
Format UI buttons, menus, fields, and labels in bold, and separate consecutive UI navigation labels with >.
Use quotation marks for error messages and strings when appropriate, italics for newly introduced terms and publication titles, and plain text for keyboard shortcuts.
Represent GitHub repositories with owner/repository link text, such as [NVIDIA/NeMo](link), rather than generic repository wording.
Introduce every code block with a complete sentence; do not let a code block complete or interrupt the grammar of surrounding prose; use syntax highlighting when supported.
Keep inline method, function, and class references consistent with nearby documentation; omit empty parentheses in prose when no call is shown.
Use descriptive link text matching the destination title when possible; avoid raw URLs, generic anchors, long-sentence links, and unnecessary links that distract from procedures.
Ensure lists have a complete lead-in sentence, more than one item, no more than two levels, parallel construction, one idea or action per item, and appropriate punctuation; use bullets for unordered items and numbers for ordered tasks.
Format definition lists with a bold term followed by a complete, parallel, punctuated definition.
Use tables for reference information, decision support, compatibility matrices, and comparable choices; flag one-row tables, missing captions or lead-ins, sentence-case headers where title case is expected, unexplained empty cells, and code or links that would be clearer as prose.
Write procedure steps as imperative ...

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}

⚙️ CodeRabbit configuration file

{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}: Review documentation for technical accuracy against the current API, command correctness, and consistency across language bindings.
Flag stale examples, missing SPDX headers where required, and instructions that no longer match CI or pre-commit behavior.

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
🧠 Learnings (1)
📚 Learning: 2026-08-03T19:55:03.931Z
Learnt from: afourniernv
Repo: NVIDIA/NeMo-Relay PR: 558
File: crates/pii-redaction/src/rampart/mod.rs:265-274
Timestamp: 2026-08-03T19:55:03.931Z
Learning: In NeMo Relay first-party plugin registration helpers, treat the documented duplicate-registration `PluginError::RegistrationFailed` result from `register_plugin` as success when registration is intended to be idempotent. Do not locally reclassify this as `PluginError::Conflict`; changing the classification requires a core-wide review of the public API and FFI behavior.

Applied to files:

  • crates/cli/src/diagnostics/mod.rs
  • crates/cli/tests/coverage/commands/main_tests.rs
  • crates/cli/src/commands/mod.rs
  • crates/cli/tests/coverage/shared/invocation_diagnostic_tests.rs
  • crates/cli/src/commands/run.rs
  • crates/cli/src/commands/diagnostics.rs
  • crates/cli/tests/cli_tests.rs
  • crates/cli/src/diagnostics/invocation.rs
🔇 Additional comments (10)
crates/cli/src/diagnostics/invocation.rs (2)

164-166: 📐 Maintainability & Code Quality

Validate the Rust change with the required checks.

The validation report notes an existing workspace Clippy failure. Provide results for cargo fmt --all, just test-rust, and cargo clippy --workspace --all-targets -- -D warnings. If Clippy still fails, show that the failure also occurs on the current main baseline or resolve it before merge.

Source: Coding guidelines


1-161: LGTM!

crates/cli/src/diagnostics/mod.rs (1)

13-13: LGTM!

crates/cli/src/commands/diagnostics.rs (1)

7-18: LGTM!

Also applies to: 34-53, 66-68, 83-106

crates/cli/src/commands/mod.rs (1)

105-107: LGTM!

crates/cli/src/commands/run.rs (1)

63-69: LGTM!

Also applies to: 89-93, 118-129

docs/nemo-relay-cli/basic-usage.mdx (1)

77-93: LGTM!

crates/cli/tests/cli_tests.rs (1)

3867-3905: LGTM!

Also applies to: 3907-3945, 3987-4014

crates/cli/tests/coverage/commands/main_tests.rs (1)

348-373: LGTM!

crates/cli/tests/coverage/shared/invocation_diagnostic_tests.rs (1)

1-8: LGTM!

Also applies to: 32-86

Comment on lines +3817 to +3865
#[test]
fn invocation_diagnostic_cli_warns_without_rewriting_the_command() {
let temp = tempfile::tempdir().unwrap();
let config = temp.path().join("config.toml");
std::fs::write(
&config,
r#"
[upstream]
openai_base_url = "http://127.0.0.1:1"
anthropic_base_url = "http://127.0.0.1:1"
"#,
)
.unwrap();

let output = Command::new(gateway_bin())
.current_dir(temp.path())
.env("XDG_CONFIG_HOME", temp.path().join("xdg"))
.env("HOME", temp.path())
.args([
"--config",
config.to_str().unwrap(),
"run",
"--agent",
"claude",
"--dry-run",
"--",
"/opt/bin/claude-code.exe",
"-p",
"synthetic prompt",
])
.output()
.unwrap();

assert!(output.status.success());
let stderr = String::from_utf8_lossy(&output.stderr);
assert!(
stderr.contains("possible_duplicate_agent_executable"),
"{stderr}"
);
assert!(stderr.contains("Relay will continue without modifying the command"));
assert!(!stderr.contains("/opt/bin/claude-code.exe"));
assert!(!stderr.contains("synthetic prompt"));

let stdout = String::from_utf8_lossy(&output.stdout);
assert!(
stdout.contains("/opt/bin/claude-code.exe -p synthetic prompt"),
"{stdout}"
);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Assert redaction in structured diagnostic logs.

warn_for_possible_duplicate calls diagnostic.log() before it writes the warning. These tests only inspect stderr. A structured-log regression can expose forwarded command data while these rendered-warning assertions still pass.

  • crates/cli/tests/cli_tests.rs#L3817-L3865: Capture normal-run structured logs and assert that the raw executable path and forwarded arguments are absent.
  • crates/cli/tests/cli_tests.rs#L3947-L3985: Capture shortcut structured logs and assert that the forwarded arguments are absent.
📍 Affects 1 file
  • crates/cli/tests/cli_tests.rs#L3817-L3865 (this comment)
  • crates/cli/tests/cli_tests.rs#L3947-L3985
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/cli/tests/cli_tests.rs` around lines 3817 - 3865, Extend
invocation_diagnostic_cli_warns_without_rewriting_the_command to capture
normal-run structured logs, then assert the raw executable path and forwarded
arguments are absent from those logs in addition to stderr. At
crates/cli/tests/cli_tests.rs lines 3947-3985, apply the same structured-log
capture and assert the forwarded arguments are absent; preserve the existing
rendered-warning assertions.

Comment on lines +12 to +17
let cases = [
(CodingAgent::ClaudeCode, "claude"),
(CodingAgent::ClaudeCode, "/opt/bin/claude-code.exe"),
(CodingAgent::Codex, r"C:\\tools\\CODEX.CMD"),
(CodingAgent::Hermes, "hermes-agent"),
];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Cover every supported executable form for each agent.

This matrix has only one positive form for Codex and Hermes. A broken match for another documented name, alias, or path form can pass these tests. Add table cases for every supported form of each agent.

As per path instructions, “Tests should cover the behavior promised by the changed API surface.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/cli/tests/coverage/shared/invocation_diagnostic_tests.rs` around lines
12 - 17, Expand the cases matrix in the invocation diagnostic tests to include
every documented executable name, alias, and path form for each CodingAgent, not
just the current Codex and Hermes examples. Reuse the supported forms defined by
the matching implementation so the tests cover the complete promised API surface
while retaining the existing ClaudeCode cases.

Source: Path instructions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature a new feature lang:rust PR changes/introduces Rust code size:L PR is large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant