Skip to content

feat(relay): NeMo Relay Rust plugin scaffold - #2489

Merged
tgasser-nv merged 7 commits into
developfrom
feat/relay-rust-client
Oct 27, 2026
Merged

tgasser-nv merged 7 commits into
developfrom
feat/relay-rust-client

Conversation

@tgasser-nv

@tgasser-nv tgasser-nv commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Description

This PR is the first in a stack-of-5 to adds a Rust native plugin for NeMo Relay which calls the Guardrails hooks server /v1/hooks/nemo-relay endpoint. The line-count in the PR is inflated by the Cargo.lock file which is 3,459 lines long. Actual code is ~470 lines, tests ~680 lines, misc files ~210.

The functionality builds up in the stack as below:

Related Issue(s)

Verification

Pre-commit

$ uv run pre-commit run --all-files
check yaml...............................................................Passed
fix end of files.........................................................Passed
trim trailing whitespace.................................................Passed
ruff (legacy alias)......................................................Passed
ruff format..............................................................Passed
Insert license in comments...............................................Passed
zizmor...................................................................Passed
ty.......................................................................Passed

Unit-tests

$ cargo test -p nemo-guardrails-relay-plugin
    Finished `test` profile [unoptimized + debuginfo] target(s) in 9.36s
     Running unittests src/lib.rs (target/debug/deps/nemo_guardrails_relay_plugin-9341a014c3c8bb84)

running 12 tests
.....
test result: ok. 12 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running tests/lifecycle.rs (target/debug/deps/lifecycle-c7975f94b358de3d)

running 8 tests
.....
test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 5.34s

   Doc-tests nemo_guardrails_relay_plugin

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s```

AI Assistance

  • No AI tools were used.
  • AI tools were used; a human reviewed and can explain every change (tool: ___).

Checklist

  • I've read the CONTRIBUTING guidelines.
  • This PR links to a triaged issue assigned to me.
  • My PR title follows the project commit convention.
  • I've updated the documentation if applicable.
  • I've added tests if applicable.
  • I've noted any verification beyond CI and any checks I couldn't run.
  • I did not update generated changelog files manually.
  • I addressed all CodeRabbit, Greptile, and other review comments, or replied with why no change is needed.
  • @mentions of the person or team responsible for reviewing proposed changes.

Summary by CodeRabbit

  • New Features
    • Added an early-stage NeMo Guardrails checks plugin for Relay, with configuration for an endpoint, request headers, timeout, and priority. Invalid settings are reported during validation; checks are not yet registered.
    • Added tools to package the plugin as a directory or .tar.gz/.zip archive, with integrity information included in the bundle.
  • Documentation
    • Added setup, configuration, compatibility, build, and packaging guidance.
  • Chores
    • Added Rust build and formatting support.

@github-actions github-actions Bot added status: needs triage New issues that have not yet been reviewed or categorized. size: XL labels Oct 22, 2026
@tgasser-nv tgasser-nv self-assigned this Oct 22, 2026
@tgasser-nv tgasser-nv added status: triaged Triaged by a maintainer; eligible for automated review (CodeRabbit/Greptile). and removed status: needs triage New issues that have not yet been reviewed or categorized. labels Oct 22, 2026
@tgasser-nv
tgasser-nv marked this pull request as ready for review October 22, 2026 20:23
@greptile-apps

greptile-apps Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge as a scaffold.

Summary

Adds the Rust plugin scaffold, configuration checks, bundle packaging, and Relay host tests. The plugin does not call the Guardrails service yet.

  • Relay can load and validate the Guardrails plugin.
  • The packaging script creates repeatable Relay plugin bundles.
  • The repository now builds the Relay plugin in a Rust workspace.

Reviews (6) · Last reviewed commit: "Remove endpoint validation from schema a..." · Reviewed by Greptile

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

ℹ️ Recent review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between 61f1013 and eeaa5c8.

⛔ Files ignored due to path filters: 1
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing: 16
  • .cargo/config.toml
  • .dockerignore
  • .gitattributes
  • .gitignore
  • .pre-commit-config.yaml
  • Cargo.toml
  • crates/nemo-guardrails-relay-plugin/Cargo.toml
  • crates/nemo-guardrails-relay-plugin/README.md
  • crates/nemo-guardrails-relay-plugin/config.schema.json
  • crates/nemo-guardrails-relay-plugin/relay-plugin.toml
  • crates/nemo-guardrails-relay-plugin/scripts/package_bundle.py
  • crates/nemo-guardrails-relay-plugin/scripts/test_package_bundle.py
  • crates/nemo-guardrails-relay-plugin/src/config.rs
  • crates/nemo-guardrails-relay-plugin/src/lib.rs
  • crates/nemo-guardrails-relay-plugin/tests/lifecycle.rs
  • rust-toolchain.toml

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

Walkthrough

This change adds a Rust workspace and a NeMo Guardrails Relay plugin scaffold. It defines plugin configuration and validation, integrates the plugin with Relay, adds lifecycle and packaging tests, and provides a script to create plugin bundles.

Changes: NeMo Guardrails Relay plugin

Layer / File(s) Summary
Workspace and crate setup
Cargo.toml, crates/nemo-guardrails-relay-plugin/Cargo.toml, rust-toolchain.toml, .cargo/config.toml, .dockerignore, .gitattributes, .gitignore, .pre-commit-config.yaml
Adds the Rust workspace and plugin crate, sets build dependencies and toolchain, and updates repository settings for Rust builds and files.
Configuration schema and validation
crates/nemo-guardrails-relay-plugin/config.schema.json, crates/nemo-guardrails-relay-plugin/src/config.rs, crates/nemo-guardrails-relay-plugin/README.md
Defines the configuration fields and defaults. Parses and validates endpoints, headers, timeout, and priority, with tests for valid and invalid values.
Relay registration and lifecycle
crates/nemo-guardrails-relay-plugin/relay-plugin.toml, crates/nemo-guardrails-relay-plugin/src/lib.rs, crates/nemo-guardrails-relay-plugin/tests/lifecycle.rs, crates/nemo-guardrails-relay-plugin/README.md
Adds the plugin manifest and registration entry point. Reports configuration diagnostics and tests Relay compatibility, configuration rejection, activation, and unloading.
Bundle creation and archive tests
crates/nemo-guardrails-relay-plugin/scripts/*, crates/nemo-guardrails-relay-plugin/README.md
Packages the compiled library, schema, and license files. Supports tar.gz and ZIP archives with normalized metadata; tests validation and repeatable archive output.

Priority: Low

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

Change: Feature

Merge Risk: Minimal · up to eeaa5

The scaffold is mergeable after normal checks; it does not register checks yet, as intended for this stage.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the main change: an initial Rust plugin scaffold for NeMo Relay. It matches the workspace, plugin crate, manifest, configuration, packaging, and lifecycle test additions.
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.
Test Results For Major Changes Passed The PR introduces a new Rust plugin and packaging flow, so it is a major change. The description documents testing information, including successful pre-commit checks and `cargo test -p nemo-guardrail…
Full details: Test Results For Major Changes

Explanation

The PR introduces a new Rust plugin and packaging flow, so it is a major change. The description documents testing information, including successful pre-commit checks and cargo test -p nemo-guardrails-relay-plugin results with 12 unit tests and 7 lifecycle tests passing. Numeric or convergence changes are not applicable, and no performance-impact requirement is indicated.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@willkill07 willkill07 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The scaffolding overall looks great

Comment thread .cargo/config.toml Resolved
Comment thread Cargo.toml Resolved
@tgasser-nv
tgasser-nv force-pushed the feat/relay-rust-client branch from d584c3e to 031e443 Compare October 27, 2026 17:16
@tgasser-nv
tgasser-nv merged commit 97dd804 into develop Oct 27, 2026
20 checks passed
@tgasser-nv
tgasser-nv deleted the feat/relay-rust-client branch October 27, 2026 21:59
@tgasser-nv tgasser-nv mentioned this pull request Oct 29, 2026
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: XL status: triaged Triaged by a maintainer; eligible for automated review (CodeRabbit/Greptile).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants