Skip to content

fix(switchyard): require healthy sidecar at activation - #438

Merged
rapids-bot[bot] merged 6 commits into
NVIDIA:mainfrom
bbednarski9:bbednarski/switchyard-startup-health-check
Jul 15, 2026
Merged

rapids-bot[bot] merged 6 commits into
NVIDIA:mainfrom
bbednarski9:bbednarski/switchyard-startup-health-check

Conversation

@bbednarski9

@bbednarski9 bbednarski9 commented Jul 15, 2026 •

Copy link
Copy Markdown
Collaborator

Overview

Require the experimental remote Switchyard plugin to confirm that its separately managed switchyard-server dependency is healthy before Relay activates the plugin.

Previously, Relay could register the Switchyard execution intercepts while the Decision API was unavailable. The first routed request would then encounter the connection failure and use the trusted fallback, which could hide a deployment or startup-order error. This PR makes service availability an activation prerequisite while retaining the existing runtime fallback if the service fails after activation.

  • 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

  • Derive the root /health endpoint from decision_api_url without adding another configuration flag.
  • Perform up to three bounded health requests during asynchronous plugin registration, retaining the existing two-second per-attempt timeout and using 100 ms/200 ms asynchronous backoff between attempts.
  • Require a successful JSON response containing {"status":"ok"} before registering buffered or streaming execution intercepts.
  • Apply the activation requirement to both enforce and observe_only; the routing rollout semantics themselves are unchanged.
  • Use a separate health client so Decision API credentials are not sent to the unauthenticated health endpoint.
  • Keep static configuration validation network-free and preserve trusted request-time fallback behavior after successful activation.
  • Document the sidecar startup requirement in the crate and example READMEs.

The health gate is router-neutral. Tests cover Random, LLM, and StageRouter profile IDs in both rollout modes, transient startup recovery, retry exhaustion, and non-success, malformed, non-ready, and unreachable health responses.

Validation:

  • cargo test -p nemo-relay-switchyard
  • cargo test -p nemo-relay-cli --features switchyard --test switchyard_process_e2e
  • cargo clippy -p nemo-relay-switchyard --all-targets -- -D warnings
  • cargo clippy -p nemo-relay-cli --features switchyard --test switchyard_process_e2e -- -D warnings
  • cargo fmt --all -- --check
  • examples/switchyard/run-real-e2e.sh against Switchyard 8f9db9a6a47f848cdff1d262276ba25a8ae9cbc8

Where should the reviewer start?

Start with SwitchyardRuntime::require_healthy_sidecar and its call from SwitchyardPlugin::register in crates/switchyard/src/component.rs, then review the activation cases in crates/switchyard/tests/unit/component_tests.rs.

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

Summary by CodeRabbit

  • New Features
    • Added Switchyard sidecar health validation during plugin activation via GET /health, requiring {"status":"ok"} with a short timeout and limited exponential-backoff retries.
  • Documentation
    • Updated Switchyard runtime documentation (including the example) to require a healthy /health endpoint before activation.
  • Tests
    • Expanded end-to-end and unit tests with local /health servers to cover retry success, retry exhaustion, and invalid/unreachable responses.
  • Automation
    • Updated the real E2E run script to wait for Switchyard health immediately after startup.

@copy-pr-bot

copy-pr-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the size:M PR is medium label Jul 15, 2026
@coderabbitai

coderabbitai Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Switchyard plugin registration now performs a bounded /health check with retries and requires an HTTP-success response containing {"status":"ok"} before installing intercepts. Tests cover successful, retrying, invalid, unhealthy, and unreachable sidecars, while startup scripts and documentation describe the readiness requirement.

Changes

Switchyard health-gated activation

Layer / File(s) Summary
Health check during registration
crates/switchyard/src/component.rs
Registration derives the health URL, performs bounded retries with backoff, validates the response, and rejects unhealthy sidecars.
Health-check test coverage
crates/switchyard/tests/unit/component_tests.rs, crates/cli/tests/switchyard_process_e2e.rs, examples/switchyard/run-real-e2e.sh
Tests cover healthy, retrying, exhausted, invalid, unhealthy, and unreachable services; test and real-service flows expose or await GET /health.
Runtime prerequisite documentation
crates/switchyard/README.md, examples/switchyard/README.md
Documentation requires Switchyard to be running and returning {"status":"ok"} before plugin activation.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SwitchyardPlugin
  participant SwitchyardRuntime
  participant SwitchyardService
  SwitchyardPlugin->>SwitchyardRuntime: register()
  SwitchyardRuntime->>SwitchyardService: GET /health with bounded retries
  SwitchyardService-->>SwitchyardRuntime: HTTP status and JSON body
  SwitchyardRuntime-->>SwitchyardPlugin: health-check result
  SwitchyardPlugin->>SwitchyardPlugin: install intercepts if healthy
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title follows Conventional Commits and clearly summarizes the main change.
Description check ✅ Passed The description matches the template with Overview, Details, reviewer start, checkboxes, and a related issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@github-actions github-actions Bot added Bug issue describes bug; PR fixes bug lang:rust PR changes/introduces Rust code labels Jul 15, 2026
@bbednarski9
bbednarski9 force-pushed the bbednarski/switchyard-startup-health-check branch from c66f401 to 6a90ef3 Compare July 15, 2026 18:26
@bbednarski9
bbednarski9 marked this pull request as ready for review July 15, 2026 18:34
@bbednarski9
bbednarski9 requested a review from a team as a code owner July 15, 2026 18:34

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 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/switchyard/src/component.rs`:
- Around line 516-545: Add a small bounded retry/backoff loop inside
require_healthy_sidecar for transient health-check failures during startup,
while keeping registration blocked until a successful status=ok response.
Preserve the existing timeout and error context, and return the final failure
after retries are exhausted; first verify whether register already retries to
avoid duplicating retry behavior.
🪄 Autofix (Beta)

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: 3de5a1cc-d78e-46f9-afda-169e274e8a44

📥 Commits

Reviewing files that changed from the base of the PR and between a164639 and 6a90ef3.

📒 Files selected for processing (5)
  • crates/cli/tests/switchyard_process_e2e.rs
  • crates/switchyard/README.md
  • crates/switchyard/src/component.rs
  • crates/switchyard/tests/unit/component_tests.rs
  • examples/switchyard/README.md
📜 Review details
🧰 Additional context used
📓 Path-based instructions (17)
**/*.{md,rst,html,txt}

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

**/*.{md,rst,html,txt}: Always spell NVIDIA in all caps. Do not use Nvidia, nvidia, nVidia, nVIDIA, or NV.
Use an NVIDIA before a noun because the name starts with an 'en' sound.
Do not add a registered trademark symbol after NVIDIA when referring to the company.
Use trademark symbols with product names only when the document type or legal guidance requires them.
Verify official capitalization, spacing, and hyphenation for product names.
Precede NVIDIA product names with NVIDIA on first mention when it is natural and accurate.
Do not rewrite product names for grammar or title-case rules.
Preserve third-party product names according to the owner's spelling.
Include the company name and full model qualifier on first use when it helps identify the model.
Preserve the official capitalization and punctuation of model names.
Use shorter family names only after the full name is established.
Spell out a term on first use and put the acronym in parentheses unless the acronym is widely understood by the intended audience.
Use the acronym on later mentions after it has been defined.
For long documents, reintroduce the full term if readers might lose context.
Form plurals of acronyms with s, not an apostrophe, such as GPUs.
In headings, common acronyms can remain abbreviated. Spell out the term in the first or second sentence of the body.
Common terms such as CPU, GPU, PC, API, and UI usually do not need to be spelled out for developer audiences.

Files:

  • crates/switchyard/README.md
  • examples/switchyard/README.md
**/*.{md,rst,html}

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

Link the first mention of a product name when the destination helps the reader.

Files:

  • crates/switchyard/README.md
  • examples/switchyard/README.md
**/*.{md,rst,txt}

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

Spell NVIDIA in all caps. Do not use Nvidia, nvidia, or NV.

Files:

  • crates/switchyard/README.md
  • examples/switchyard/README.md
**/*.{md,rst}

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

**/*.{md,rst}: Format commands, code elements, expressions, package names, file names, and paths as inline code.
Use descriptive link text. Avoid raw URLs and weak anchors such as "here" or "read more."
Use title case consistently for technical documentation headings.
Introduce code blocks, lists, tables, and images with complete sentences.
Write procedures as imperative steps. Keep steps parallel and split long procedures into smaller tasks.
Prefer active voice, present tense, short sentences, contractions, and plain English.
Use can for possibility and reserve may for permission.
Use after for temporal relationships instead of once.
Prefer refer to over see when the wording points readers to another resource.
Avoid culture-specific idioms, unnecessary Latinisms, jokes, and marketing exaggeration in technical docs.
Spell out months in body text, avoid ordinal dates, and use clear time zones.
Spell out whole numbers from zero through nine unless they are technical values, parameters, versions, or UI values.
Use numerals for 10 or greater and include commas in thousands.
Do not add trademark symbols to learning-oriented docs unless the source, platform, or legal guidance explicitly requires them.

Files:

  • crates/switchyard/README.md
  • examples/switchyard/README.md
**/*.md

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

**/*.md: Use title case consistently in technical documentation headings
Avoid quotation marks, ampersands, and exclamation marks in headings
Keep product, event, research, and whitepaper names in their official title case
Use title case for table headers
Do not force social-media sentence case into technical docs
Format code elements, commands, parameters, package names, and expressions in monospace
Format directories, file names, and paths in monospace using backticks
Use angle brackets inside monospace for variables inside paths, such as /home/<username>/.login
Format error messages and strings in quotation marks, keeping literal code strings in code formatting when clearer
Format UI buttons, menus, fields, and labels in bold
Use angle brackets between UI labels for menu paths, such as File > Save As
Use italics for new terms on first use, sparingly and only when introducing the term
Use italics for publication titles
Format keyboard shortcuts in plain text, such as Press Ctrl+Alt+Delete
Use owner/repo link text for GitHub repositories, preferring [NVIDIA/NeMo](link) over prose references like 'the GitHub repo'
Introduce every code block with a complete sentence
Do not make a code block complete the grammar of the previous sentence
Do not continue a sentence after a code block
Use syntax highlighting when the format supports it for code blocks
Avoid the word 'snippet' unless the surrounding docs already use it as a term of art
Keep inline method, function, and class references consistent with nearby docs, omitting empty parentheses for prose readability when no call is shown
Use descriptive anchor text that matches the destination title when possible for links
Avoid raw URLs in running text
Avoid generic anchor text such as 'here,' 'this page,' and 'read more'
Include acronyms in link text when a linked term includes an acronym
Do not link long sentences or multiple sentences
Avoid links that pull readers away from a procedure unless the link is a p...

Files:

  • crates/switchyard/README.md
  • examples/switchyard/README.md
**/*.{md,mdx}

📄 CodeRabbit inference engine (AGENTS.md)

Update README.md, fern/, package READMEs, and binding-support notes when public behavior, package names, examples, or supported bindings change.

**/*.{md,mdx}: Prefer the documented public API, not internal shortcuts
Keep package names, repo references, and build commands current
Keep release-process and release-notes guidance in repo-maintainer docs such as RELEASING.md, not as user-facing docs pages or CHANGELOG.md
Keep stable user-facing wrappers at scripts/ root in docs and examples; only point at namespaced helper paths when documenting internal maintenance work
When detailed dynamic plugin guides exist, keep Rust native plugin examples, Python worker plugin examples, and grpc-v1 protocol details on separate pages

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

Files:

  • crates/switchyard/README.md
  • examples/switchyard/README.md
**/*.{md,markdown,mdx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add the SPDX license header to all Markdown/MDX documentation files using the HTML comment block form.

Files:

  • crates/switchyard/README.md
  • examples/switchyard/README.md
**/*

📄 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.

Files:

  • crates/switchyard/README.md
  • examples/switchyard/README.md
  • crates/cli/tests/switchyard_process_e2e.rs
  • crates/switchyard/src/component.rs
  • crates/switchyard/tests/unit/component_tests.rs
{docs,examples}/**/*

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

Update docs and examples.

Files:

  • examples/switchyard/README.md
**/*.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

When changing the core Rust runtime or Rust-facing API surface, format Rust code with cargo fmt (rustfmt defaults), keep cargo clippy -- -D warnings clean, and satisfy cargo deny check per deny.toml.

**/*.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.

Files:

  • crates/cli/tests/switchyard_process_e2e.rs
  • crates/switchyard/src/component.rs
  • crates/switchyard/tests/unit/component_tests.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

Follow binding naming conventions in Rust and Python: use snake_case.

Files:

  • crates/cli/tests/switchyard_process_e2e.rs
  • crates/switchyard/src/component.rs
  • crates/switchyard/tests/unit/component_tests.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{rs,py,js,mjs,cjs,ts,tsx}: Use Json = serde_json::Value in Rust-facing runtime APIs where the existing code expects JSON payloads.
Use Result<T> with FlowError in core runtime paths, and keep errors explicit and binding-appropriate at the wrapper layer.
Keep async behavior on the existing tokio-based model; bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.

Files:

  • crates/cli/tests/switchyard_process_e2e.rs
  • crates/switchyard/src/component.rs
  • crates/switchyard/tests/unit/component_tests.rs
**/*.{rs,py,go,js,ts,c,h}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use language-appropriate naming conventions: Rust snake_case, C FFI exports prefixed nemo_relay_, Go PascalCase, Node.js camelCase, and Python snake_case.

Files:

  • crates/cli/tests/switchyard_process_e2e.rs
  • crates/switchyard/src/component.rs
  • crates/switchyard/tests/unit/component_tests.rs
**/*.{rs,go,js,ts}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add the SPDX license header to all Rust, Go, JavaScript, and TypeScript source files using the corresponding // comment form.

Files:

  • crates/cli/tests/switchyard_process_e2e.rs
  • crates/switchyard/src/component.rs
  • crates/switchyard/tests/unit/component_tests.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.

Files:

  • crates/cli/tests/switchyard_process_e2e.rs
  • crates/switchyard/src/component.rs
  • crates/switchyard/tests/unit/component_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/switchyard_process_e2e.rs
  • crates/switchyard/tests/unit/component_tests.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/switchyard/src/component.rs
🔇 Additional comments (3)
crates/switchyard/src/component.rs (1)

516-545: 📐 Maintainability & Code Quality

Confirm Rust validation commands were run for this change set. Per coding guidelines, any Rust change must run just test-rust, cargo fmt --all, and cargo clippy --workspace --all-targets -- -D warnings.

  • crates/switchyard/src/component.rs#L516-L545: core logic change (require_healthy_sidecar) — confirm cargo fmt --all and cargo clippy --workspace --all-targets -- -D warnings are clean.
  • crates/switchyard/tests/unit/component_tests.rs#L1005-L1020: new health_server helper and rewritten tests — confirm just test-rust passes.
  • crates/cli/tests/switchyard_process_e2e.rs#L74-L77: new switchyard_health route handler — confirm just test-rust passes for the e2e binary target.

As per coding guidelines, "Any Rust change must run just test-rust", "Any Rust change must run cargo fmt --all", and "Any Rust change must run cargo clippy --workspace --all-targets -- -D warnings."

Source: Coding guidelines

crates/switchyard/README.md (1)

64-67: LGTM!

examples/switchyard/README.md (1)

86-88: LGTM!

Comment thread crates/switchyard/src/component.rs Resolved

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/switchyard/tests/unit/component_tests.rs (1)

9-14: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Import std::sync::Arc for recovering_health_server. AtomicUsize, Ordering, and axum::Json are already present (AxumJson), but Arc is not in the shown imports and the test file will not compile without it.

🤖 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/switchyard/tests/unit/component_tests.rs` around lines 9 - 14, Update
the imports in component_tests.rs to include std::sync::Arc for use by
recovering_health_server, while preserving the existing AtomicUsize, Ordering,
and AxumJson imports.
🤖 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/switchyard/tests/unit/component_tests.rs`:
- Around line 248-265: Add a final assertion after rollback_registrations in
plugin_registration_retries_transient_sidecar_health_failures, verifying that
registrations.is_empty(), matching the sibling test’s lifecycle assertion.

---

Outside diff comments:
In `@crates/switchyard/tests/unit/component_tests.rs`:
- Around line 9-14: Update the imports in component_tests.rs to include
std::sync::Arc for use by recovering_health_server, while preserving the
existing AtomicUsize, Ordering, and AxumJson imports.
🪄 Autofix (Beta)

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: 8cc20643-c8ff-4b00-97ae-55ff5a9379d9

📥 Commits

Reviewing files that changed from the base of the PR and between 6a90ef3 and 4446896.

📒 Files selected for processing (2)
  • crates/switchyard/src/component.rs
  • crates/switchyard/tests/unit/component_tests.rs
📜 Review details
🧰 Additional context used
📓 Path-based instructions (9)
**/*.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

When changing the core Rust runtime or Rust-facing API surface, format Rust code with cargo fmt (rustfmt defaults), keep cargo clippy -- -D warnings clean, and satisfy cargo deny check per deny.toml.

**/*.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.

Files:

  • crates/switchyard/src/component.rs
  • crates/switchyard/tests/unit/component_tests.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

Follow binding naming conventions in Rust and Python: use snake_case.

Files:

  • crates/switchyard/src/component.rs
  • crates/switchyard/tests/unit/component_tests.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{rs,py,js,mjs,cjs,ts,tsx}: Use Json = serde_json::Value in Rust-facing runtime APIs where the existing code expects JSON payloads.
Use Result<T> with FlowError in core runtime paths, and keep errors explicit and binding-appropriate at the wrapper layer.
Keep async behavior on the existing tokio-based model; bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.

Files:

  • crates/switchyard/src/component.rs
  • crates/switchyard/tests/unit/component_tests.rs
**/*.{rs,py,go,js,ts,c,h}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use language-appropriate naming conventions: Rust snake_case, C FFI exports prefixed nemo_relay_, Go PascalCase, Node.js camelCase, and Python snake_case.

Files:

  • crates/switchyard/src/component.rs
  • crates/switchyard/tests/unit/component_tests.rs
**/*.{rs,go,js,ts}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add the SPDX license header to all Rust, Go, JavaScript, and TypeScript source files using the corresponding // comment form.

Files:

  • crates/switchyard/src/component.rs
  • crates/switchyard/tests/unit/component_tests.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/switchyard/src/component.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.

Files:

  • crates/switchyard/src/component.rs
  • crates/switchyard/tests/unit/component_tests.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.

Files:

  • crates/switchyard/src/component.rs
  • crates/switchyard/tests/unit/component_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/switchyard/tests/unit/component_tests.rs
🔇 Additional comments (3)
crates/switchyard/src/component.rs (2)

50-51: LGTM!

Also applies to: 352-355, 518-537, 1258-1284, 1286-1293


518-537: 📐 Maintainability & Code Quality

Reminder: run Rust validation commands for this change.

This is a Rust source change; per repo guidelines run cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings, and just test-rust before merge even if pre-commit is expected to catch it.

As per coding guidelines, "Any Rust change must run just test-rust" and "also run cargo fmt --all" and "also run cargo clippy --workspace --all-targets -- -D warnings".

crates/switchyard/tests/unit/component_tests.rs (1)

218-246: LGTM!

Also applies to: 268-287, 1063-1092

@willkill07 willkill07 added this to the 0.6 milestone Jul 15, 2026
bbednarski9 and others added 3 commits July 15, 2026 13:47
…al E2E

The new activation gate made run-real-e2e.sh order-dependent: Relay was
launched before the script waited for the sidecar's /health, so Relay
could activate before switchyard-server bound port 4000 and abort at
startup. Wait for the sidecar to be healthy before launching Relay,
mirroring run-hermes-ollama-smoke.sh.

Signed-off-by: Zhongxuan Wang <[email protected]>

@coderabbitai coderabbitai 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/switchyard/src/component.rs (1)

1336-1372: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Strip URL-embedded credentials from the health request.

switchyard_health_url preserves userinfo, and reqwest turns user:pass@host into a Basic Authorization header on the /health request. Remove the username/password from the derived URL and add a test that /health receives no auth header.

🤖 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/switchyard/src/component.rs` around lines 1336 - 1372, Update
switchyard_health_url to clear any URL-embedded username and password before
returning the derived health URL, while preserving the host, path, and existing
query/fragment removal. Add a test covering a decision_api_url with userinfo
that verifies the /health request contains no Authorization header.
🤖 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.

Outside diff comments:
In `@crates/switchyard/src/component.rs`:
- Around line 1336-1372: Update switchyard_health_url to clear any URL-embedded
username and password before returning the derived health URL, while preserving
the host, path, and existing query/fragment removal. Add a test covering a
decision_api_url with userinfo that verifies the /health request contains no
Authorization header.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: ce744be2-a0b6-46c5-9004-2ac1d4c589e2

📥 Commits

Reviewing files that changed from the base of the PR and between 1148b8c and c175dd3.

📒 Files selected for processing (1)
  • crates/switchyard/src/component.rs
📜 Review details
🧰 Additional context used
📓 Path-based instructions (8)
**/*.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

When changing the core Rust runtime or Rust-facing API surface, format Rust code with cargo fmt (rustfmt defaults), keep cargo clippy -- -D warnings clean, and satisfy cargo deny check per deny.toml.

**/*.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.

Files:

  • crates/switchyard/src/component.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

Follow binding naming conventions in Rust and Python: use snake_case.

Files:

  • crates/switchyard/src/component.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{rs,py,js,mjs,cjs,ts,tsx}: Use Json = serde_json::Value in Rust-facing runtime APIs where the existing code expects JSON payloads.
Use Result<T> with FlowError in core runtime paths, and keep errors explicit and binding-appropriate at the wrapper layer.
Keep async behavior on the existing tokio-based model; bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.

Files:

  • crates/switchyard/src/component.rs
**/*.{rs,py,go,js,ts,c,h}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use language-appropriate naming conventions: Rust snake_case, C FFI exports prefixed nemo_relay_, Go PascalCase, Node.js camelCase, and Python snake_case.

Files:

  • crates/switchyard/src/component.rs
**/*.{rs,go,js,ts}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add the SPDX license header to all Rust, Go, JavaScript, and TypeScript source files using the corresponding // comment form.

Files:

  • crates/switchyard/src/component.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/switchyard/src/component.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.

Files:

  • crates/switchyard/src/component.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.

Files:

  • crates/switchyard/src/component.rs
🔇 Additional comments (2)
crates/switchyard/src/component.rs (2)

48-51: 📐 Maintainability & Code Quality

Run the required Rust validation suite before handoff.

Please confirm cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings, just test-rust, cargo deny check, and uv run pre-commit run --all-files pass.

As per coding guidelines, any Rust change requires formatting, Clippy, and just test-rust; core runtime changes must satisfy cargo deny check, and handoff requires the all-files pre-commit pass.

Source: Coding guidelines


352-355: LGTM!

Also applies to: 493-518, 545-679, 719-880, 1385-1482

@zhongxuanwang-nv zhongxuanwang-nv 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.

Used powerful AIs to help review, added a small one-line fix that may prevent a race condition (alr committed), and everything else looks great!

@bbednarski9

Copy link
Copy Markdown
Collaborator Author

/ok to test 07665b8

@bbednarski9

Copy link
Copy Markdown
Collaborator Author

/ok to test 3cff727

@bbednarski9

Copy link
Copy Markdown
Collaborator Author

/merge

@rapids-bot
rapids-bot Bot merged commit d176dee into NVIDIA:main Jul 15, 2026
31 checks passed

This branch was previously deployed

1 inactive deployment
fern — 3cff727b Deployed Jul 15, 2026 by rapids-bot[bot] via Clean up docs preview #1809
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug issue describes bug; PR fixes bug lang:rust PR changes/introduces Rust code size:M PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants