Skip to content

feat(plugin): support pending marks from LLM intercepts#327

Open
bbednarski9 wants to merge 4 commits into
NVIDIA:mainfrom
bbednarski9:feat/llm-intercept-pending-marks
Open

feat(plugin): support pending marks from LLM intercepts#327
bbednarski9 wants to merge 4 commits into
NVIDIA:mainfrom
bbednarski9:feat/llm-intercept-pending-marks

Conversation

@bbednarski9

@bbednarski9 bbednarski9 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Overview

Allow LLM request interceptors to schedule marks that Relay emits under the LLM scope created after interception.

  • 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 PendingMarkSpec and LlmRequestInterceptOutcome as typed contracts for request rewrites, annotations, and deferred marks.
  • Add global, scope-local, built-in plugin, and native plugin registration APIs while preserving the existing request-interceptor APIs.
  • Accumulate marks in interceptor order, honor break_chain, and discard pending marks if the interceptor chain fails.
  • Emit pending marks after the LLM start event and before provider execution, using the new LLM scope as their parent.
  • Carry native plugin outcomes through a tagged envelope in the existing annotation return channel, leaving the native ABI v1 layout and provider request payload unchanged.
  • Update the native plugin example and add coverage for serialization, ordering, lifecycle parenting, streaming, failure behavior, and legacy compatibility.

Request interceptors execute before Relay creates the managed LLM scope. Emitting a mark directly from an interceptor therefore cannot reliably attach it to that future scope. Returning a pending mark lets the lifecycle owner materialize it at the correct boundary.

Where should the reviewer start?

Start with crates/types/src/api/llm.rs and crates/core/src/api/llm.rs. The native compatibility adapter is in crates/core/src/plugin/dynamic/native.rs, and the lifecycle contract tests are in crates/core/tests/integration/middleware_tests.rs.

Testing

  • cargo test -p nemo-relay-types
  • cargo test -p nemo-relay-plugin
  • cargo test -p nemo-relay
  • cargo fmt --all -- --check
  • cargo clippy -p nemo-relay-types -p nemo-relay-plugin -p nemo-relay --all-targets -- -D warnings
  • pre-commit run --from-ref github/main --to-ref HEAD

The repository-wide pre-commit run --all-files also completed all checks except the existing attributions-rust drift, which rewrites the unrelated md-5 license entry. That generated change is not included here.

Breaking changes

None. Existing request-interceptor APIs and the native ABI v1 layout remain supported.

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

Summary by CodeRabbit

  • New Features

    • Added marks-capable LLM request intercepts that can rewrite requests and schedule pending lifecycle marks.
    • Marks are emitted after the LLM start event, with ordering/parenting preserved and optional category/category-profile plus data/metadata.
    • Introduced PendingMarkSpec/LlmRequestInterceptOutcome support in native plugin APIs and examples.
  • Bug Fixes

    • Improved intercept chaining so break/priority behavior is respected and failures prevent provider execution and any start/mark events.
    • Expanded streaming and non-streaming tests to validate mark emission timing.

Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: a81b1da5-ecd0-446c-8a88-657ad18a5419

📥 Commits

Reviewing files that changed from the base of the PR and between 97c0bd1 and 6e45f14.

📒 Files selected for processing (5)
  • crates/core/src/api/shared.rs
  • crates/core/src/plugin/dynamic/native.rs
  • crates/core/tests/unit/shared_tests.rs
  • crates/plugin/tests/typed_callbacks.rs
  • crates/types/tests/serialization_tests.rs
📜 Recent review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: Check / Run
  • GitHub Check: Preview docs
🧰 Additional context used
📓 Path-based instructions (15)
**/*.rs

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

Use snake_case naming convention for Rust identifiers (e.g., nemo_relay_tool_call)

**/*.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: Run cargo fmt --all to format all Rust code
Run cargo clippy --workspace --all-targets -- -D warnings to enforce all clippy lints as errors

**/*.rs: Run cargo fmt --all when Rust files changed as part of WebAssembly work
Run cargo clippy --workspace --all-targets -- -D warnings when Rust files changed as part of WebAssembly 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
Run Rust formatting with cargo fmt --all
Run Rust linting with cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Use cargo fmt for Rust code formatting
Run cargo clippy -- -D warnings to lint Rust code and treat all warnings as errors
Use Rust snake_case naming convention for Rust identifiers
Include SPDX license header in all Rust source files using double-slash comment syntax
Validate Rust code with uv run pre-commit run --all-files to enforce cargo fmt formatting check, cargo clippy lints, and cargo deny aud...

Files:

  • crates/types/tests/serialization_tests.rs
  • crates/plugin/tests/typed_callbacks.rs
  • crates/core/src/api/shared.rs
  • crates/core/tests/unit/shared_tests.rs
  • crates/core/src/plugin/dynamic/native.rs
{crates/adaptive/**/*.rs,**/*test*.{rs,py,go,ts,js},**/*adaptive*test*.{rs,py,go,ts,js},docs/plugins/adaptive/**}

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

Maintain documented and tested validation and report behavior for adaptive surfaces

Files:

  • crates/types/tests/serialization_tests.rs
  • crates/core/tests/unit/shared_tests.rs
**/{Cargo.toml,**/*.rs}

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

Maintain consistency between Rust package names in Cargo.toml and their actual usage across the codebase

Files:

  • crates/types/tests/serialization_tests.rs
  • crates/plugin/tests/typed_callbacks.rs
  • crates/core/src/api/shared.rs
  • crates/core/tests/unit/shared_tests.rs
  • crates/core/src/plugin/dynamic/native.rs
**/*.{h,hpp,c,cpp,rs}

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

Ensure FFI header and library naming follows consistent conventions across platform-specific builds

Files:

  • crates/types/tests/serialization_tests.rs
  • crates/plugin/tests/typed_callbacks.rs
  • crates/core/src/api/shared.rs
  • crates/core/tests/unit/shared_tests.rs
  • crates/core/src/plugin/dynamic/native.rs
**/*.{rs,toml}

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

Update Rust crate names and module prefixes during coordinated rename operations

Files:

  • crates/types/tests/serialization_tests.rs
  • crates/plugin/tests/typed_callbacks.rs
  • crates/core/src/api/shared.rs
  • crates/core/tests/unit/shared_tests.rs
  • crates/core/src/plugin/dynamic/native.rs
**/*.{rs,py,js,ts,tsx,jsx,go,sh,toml,yaml,yml,md}

📄 CodeRabbit inference engine (AGENTS.md)

Keep SPDX headers on source, docs, scripts, and configuration files. The project is Apache-2.0.

Files:

  • crates/types/tests/serialization_tests.rs
  • crates/plugin/tests/typed_callbacks.rs
  • crates/core/src/api/shared.rs
  • crates/core/tests/unit/shared_tests.rs
  • crates/core/src/plugin/dynamic/native.rs
**/*.{rs,py,go,js,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Follow binding naming conventions: Rust and Python use snake_case, C FFI exports prefixed nemo_relay_, Go uses PascalCase for public APIs, Node.js uses camelCase.

Files:

  • crates/types/tests/serialization_tests.rs
  • crates/plugin/tests/typed_callbacks.rs
  • crates/core/src/api/shared.rs
  • crates/core/tests/unit/shared_tests.rs
  • crates/core/src/plugin/dynamic/native.rs
crates/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

crates/**/*.rs: Keep async behavior on the existing tokio-based model. Bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.
Use Json = serde_json::Value in Rust-facing runtime APIs for JSON payload handling.

Files:

  • crates/types/tests/serialization_tests.rs
  • crates/plugin/tests/typed_callbacks.rs
  • crates/core/src/api/shared.rs
  • crates/core/tests/unit/shared_tests.rs
  • crates/core/src/plugin/dynamic/native.rs
**

⚙️ CodeRabbit configuration file

**:

AGENTS.md

This file provides guidance to agents, including Claude Code and OpenAI Codex, when working in this repository.

Project Overview

NeMo Relay is a multi-language agent runtime framework for execution scopes, lifecycle events, middleware, plugins, and observability around tool and LLM calls. The core runtime is Rust. Primary supported bindings are Rust, Python, and Node.js. Go, WebAssembly, and the raw C FFI are experimental and source-first.

The shared runtime model is:

  1. Scope stacks decide where work belongs and which scope-local behavior is visible.
  2. Middleware registries decide what guardrails and intercepts run around managed calls.
  3. Plugins install reusable runtime behavior from configuration.
  4. Events record runtime behavior in ATOF form.
  5. Subscribers and exporters consume events in-process or export them to ATIF, OpenTelemetry, OpenInference, or other backends.

Repository Structure

The repository layout separates the Rust runtime, language bindings, documentation,
integration patches, and agent-facing skills.

crates/
  core/       # Rust core runtime crate, published as nemo-relay
  adaptive/   # Adaptive runtime primitives and plugin components
  python/     # PyO3 native extension for the Python package
  ffi/        # Raw C ABI layer used by downstream bindings such as Go
  node/       # NAPI Node.js binding and JavaScript/TypeScript entry points
  wasm/       # wasm-bindgen WebAssembly binding and JS wrappers
python/
  nemo_relay/  # Python wrapper package: scopes, tools, LLM, middleware, typed helpers, plugins, adaptive helpers
  tests/      # Python tests
go/
  nemo_relay/  # Experimental Go CGo binding and tests
fern/         # Fern documentation site
scripts/      # Stable wrappers and helper scripts; build/test/docs entry points live in justfile
third_party/  # P...

Files:

  • crates/types/tests/serialization_tests.rs
  • crates/plugin/tests/typed_callbacks.rs
  • crates/core/src/api/shared.rs
  • crates/core/tests/unit/shared_tests.rs
  • crates/core/src/plugin/dynamic/native.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/types/tests/serialization_tests.rs
  • crates/plugin/tests/typed_callbacks.rs
  • crates/core/tests/unit/shared_tests.rs
crates/core/src/api/**/*.rs

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

Implement behavior first in Rust core API modules: crates/core/src/api/ and related core modules such as crates/core/src/api/runtime/, crates/core/src/codec/, or crates/core/src/json.rs

Files:

  • crates/core/src/api/shared.rs
{crates/core,crates/adaptive}/**/*

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

Changes to crates/core or crates/adaptive must run the full language matrix

Files:

  • crates/core/src/api/shared.rs
  • crates/core/tests/unit/shared_tests.rs
  • crates/core/src/plugin/dynamic/native.rs
crates/core/**/*.rs

📄 CodeRabbit inference engine (.agents/skills/test-go-binding/SKILL.md)

If the change touched crates/core or shared runtime semantics, also use validate-change for broader validation

crates/core/**/*.rs: 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. Keep errors explicit and binding-appropriate at the wrapper layer.

Files:

  • crates/core/src/api/shared.rs
  • crates/core/tests/unit/shared_tests.rs
  • crates/core/src/plugin/dynamic/native.rs
crates/{core,adaptive}/**

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

If crates/core or crates/adaptive changed, run the full matrix across Rust, Python, Go, Node.js, and WebAssembly

Files:

  • crates/core/src/api/shared.rs
  • crates/core/tests/unit/shared_tests.rs
  • crates/core/src/plugin/dynamic/native.rs
crates/{core,adaptive}/**/*.rs

⚙️ CodeRabbit configuration file

crates/{core,adaptive}/**/*.rs: Review the Rust runtime for async correctness, scope isolation, middleware ordering, and event lifecycle regressions.
Pay close attention to task-local/thread-local scope propagation, callback lifetimes, stream finalization, and root_uuid isolation.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.

Files:

  • crates/core/src/api/shared.rs
  • crates/core/tests/unit/shared_tests.rs
  • crates/core/src/plugin/dynamic/native.rs
🔇 Additional comments (7)
crates/core/tests/unit/shared_tests.rs (2)

148-228: 📐 Maintainability & Code Quality

Please confirm the required Rust validation ran.

This PR touches Rust code, so just test-rust, cargo fmt --all, and cargo clippy --workspace --all-targets -- -D warnings should be part of the pre-merge validation. As per coding guidelines, "Any Rust change must run just test-rust", "Run cargo fmt --all to format all Rust code", and "Run cargo clippy --workspace --all-targets -- -D warnings to enforce all clippy lints as errors".

Source: Coding guidelines


159-186: LGTM!

Also applies to: 203-228

crates/core/src/plugin/dynamic/native.rs (1)

1789-1808: 📐 Maintainability & Code Quality

Confirm required Rust/core validation was run.

No code change requested here; please confirm cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings, just test-rust, and the broader crates/core validation/full language matrix were run for this runtime change. As per coding guidelines, "**/*.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", and "{crates/core,crates/adaptive}/**/*: Changes to crates/core or crates/adaptive must run the full language matrix".

Source: Coding guidelines

crates/plugin/tests/typed_callbacks.rs (1)

4392-4458: LGTM!

crates/types/tests/serialization_tests.rs (1)

110-119: LGTM!

crates/core/src/api/shared.rs (2)

73-81: 📐 Maintainability & Code Quality

Confirm the required Rust validation ran.

Please include or confirm cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings, and just test-rust for this Rust change before merge. 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


107-113: LGTM!


Walkthrough

Introduces PendingMarkSpec and LlmRequestInterceptOutcome so LLM request interceptors can schedule lifecycle marks. The intercept chain, callback aliases, state registries, shared codec helper, and sync/stream LLM execution paths are updated to carry and emit pending marks after the LLM-start event. Plugin registration, native ABI handling, and example/test coverage are updated accordingly.

LLM Request Intercept Pending Marks

Layer / File(s) Summary
Pending mark and intercept outcome types
crates/types/src/api/event.rs, crates/types/src/api/llm.rs, crates/types/tests/serialization_tests.rs
Defines PendingMarkSpec and LlmRequestInterceptOutcome, adds PartialEq to LlmRequest, introduces NATIVE_LLM_INTERCEPT_OUTCOME_FIELD, and round-trips the new outcome shape in serialization tests.
Callback alias and public re-exports
crates/core/src/api/runtime/callbacks.rs, crates/core/src/api/runtime.rs, crates/core/src/api/llm.rs
Adds LlmRequestInterceptWithMarksFn and re-exports it alongside LlmRequestInterceptOutcome on the public API surface.
Runtime state and intercept chain
crates/core/src/api/runtime/state.rs, crates/core/src/context/registries.rs
Updates the LLM request intercept registries to store LlmRequestInterceptWithMarksFn and refactors the snapshot chain to return LlmRequestInterceptOutcome while accumulating pending_marks and honoring break_chain.
Global and scope registration wrappers
crates/core/src/api/registry.rs
Adds register_llm_request_intercept_with_marks and scope_register_llm_request_intercept_with_marks, and rewrites the legacy registration functions to delegate through Arc-wrapped callbacks and Into::into.
Shared codec helper and LLM execution emission
crates/core/src/api/shared.rs, crates/core/src/api/llm.rs
Extends run_request_intercepts_with_codec to return pending_marks, adds emit_pending_request_marks, updates sync and stream execution to emit marks after emit_llm_start, and exposes llm_request_intercepts_with_marks.
Plugin registration and native loader
crates/core/src/plugin.rs, crates/core/src/plugin/dynamic/native.rs
Adds PluginRegistrationContext::register_llm_request_intercept_with_marks. Updates the native loader to use LlmRequestInterceptWithMarksFn, parse NativeLlmRequestInterceptOutcome, and extract pending_marks from the tagged ABI payload.
Plugin crate typed API and trampoline
crates/plugin/src/lib.rs, crates/plugin/tests/typed_callbacks.rs
Expands plugin re-exports, adds PluginContext::register_llm_request_intercept_with_marks, and implements the typed native trampoline plus serialized outcome struct for the marks-capable ABI.
Example plugin and native fixture
examples/rust-native-plugin/..., crates/core/tests/fixtures/native_plugin/src/lib.rs
Updates the example and native fixture to register marks-capable intercepts that return LlmRequestInterceptOutcome, and updates the README to describe the new and legacy request-intercept APIs.
Integration and unit coverage
crates/core/tests/integration/..., crates/core/tests/unit/shared_tests.rs
Adds middleware tests for pending-mark ordering, break_chain, emitted mark parenting and timestamps, and failure handling; updates native plugin integration assertions; and adjusts shared unit tests for the new 3-value codec return.

Changes

LLM Request Intercept Pending Marks

Layer / File(s) Summary
Pending mark and intercept outcome types
crates/types/src/api/event.rs, crates/types/src/api/llm.rs, crates/types/tests/serialization_tests.rs
Defines PendingMarkSpec and LlmRequestInterceptOutcome, adds PartialEq to LlmRequest, introduces NATIVE_LLM_INTERCEPT_OUTCOME_FIELD, and round-trips the new outcome shape in serialization tests.
Callback alias and public re-exports
crates/core/src/api/runtime/callbacks.rs, crates/core/src/api/runtime.rs, crates/core/src/api/llm.rs
Adds LlmRequestInterceptWithMarksFn and re-exports it alongside LlmRequestInterceptOutcome on the public API surface.
Runtime state and intercept chain
crates/core/src/api/runtime/state.rs, crates/core/src/context/registries.rs
Updates the LLM request intercept registries to store LlmRequestInterceptWithMarksFn and refactors the snapshot chain to return LlmRequestInterceptOutcome while accumulating pending_marks and honoring break_chain.
Global and scope registration wrappers
crates/core/src/api/registry.rs
Adds register_llm_request_intercept_with_marks and scope_register_llm_request_intercept_with_marks, and rewrites the legacy registration functions to delegate through Arc-wrapped callbacks and Into::into.
Shared codec helper and LLM execution emission
crates/core/src/api/shared.rs, crates/core/src/api/llm.rs
Extends run_request_intercepts_with_codec to return pending_marks, adds emit_pending_request_marks, updates sync and stream execution to emit marks after emit_llm_start, and exposes llm_request_intercepts_with_marks.
Plugin registration and native loader
crates/core/src/plugin.rs, crates/core/src/plugin/dynamic/native.rs
Adds PluginRegistrationContext::register_llm_request_intercept_with_marks. Updates the native loader to use LlmRequestInterceptWithMarksFn, parse NativeLlmRequestInterceptOutcome, and extract pending_marks from the tagged ABI payload.
Plugin crate typed API and trampoline
crates/plugin/src/lib.rs, crates/plugin/tests/typed_callbacks.rs
Expands plugin re-exports, adds PluginContext::register_llm_request_intercept_with_marks, and implements the typed native trampoline plus serialized outcome struct for the marks-capable ABI.
Example plugin and native fixture
examples/rust-native-plugin/..., crates/core/tests/fixtures/native_plugin/src/lib.rs
Updates the example and native fixture to register marks-capable intercepts that return LlmRequestInterceptOutcome, and updates the README to describe the new and legacy request-intercept APIs.
Integration and unit coverage
crates/core/tests/integration/..., crates/core/tests/unit/shared_tests.rs
Adds middleware tests for pending-mark ordering, break_chain, emitted mark parenting and timestamps, and failure handling; updates native plugin integration assertions; and adjusts shared unit tests for the new 3-value codec return.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title follows Conventional Commits and accurately summarizes the main change with a valid scope.
Description check ✅ Passed The description includes the required Overview, Details, reviewer-start, checklist, and related-issue sections, with extra testing notes.
Docstring Coverage ✅ Passed Docstring coverage is 80.77% 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.
✨ 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 size:L PR is large Feature a new feature lang:rust PR changes/introduces Rust code labels Jun 29, 2026
@github-actions

Copy link
Copy Markdown

@bbednarski9 bbednarski9 marked this pull request as ready for review June 29, 2026 22:00
@bbednarski9 bbednarski9 requested a review from a team as a code owner June 29, 2026 22:00

@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: 5

Caution

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

⚠️ Outside diff range comments (1)
crates/core/tests/unit/shared_tests.rs (1)

196-221: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Add a positive pending-mark case for the codec branch.

This only checks that the new third return value is empty. The codec path is the branch that changed, and a regression that drops pending_marks after codec.encode would still pass here. Add one intercept that returns a real PendingMarkSpec and assert it survives the Some(codec) path.

Suggested test shape
-    register_llm_request_intercept(
+    register_llm_request_intercept_with_marks(
         "shared-codec",
         1,
         false,
         Arc::new(|_name, mut request, annotated| {
             let mut annotated = annotated.expect("codec should provide annotated request");
             annotated.model = Some("intercepted-model".into());
             request.headers.insert("x-codec".into(), json!(true));
-            Ok((request, Some(annotated)))
+            Ok(
+                LlmRequestInterceptOutcome::new(request, Some(annotated))
+                    .with_pending_mark(PendingMarkSpec::builder().name("codec.mark").build()),
+            )
         }),
     )
     .unwrap();
@@
-    assert!(pending_marks_with_codec.is_empty());
+    assert_eq!(pending_marks_with_codec.len(), 1);
+    assert_eq!(pending_marks_with_codec[0].name, "codec.mark");

As per path instructions, "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."

🤖 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/core/tests/unit/shared_tests.rs` around lines 196 - 221, Add a
positive assertion for the codec branch in shared_tests by exercising
run_request_intercepts_with_codec with an interceptor that returns a real
PendingMarkSpec, then verify pending_marks_with_codec still contains that mark
after codec.encode runs. Keep the existing assertions on request_with_codec and
annotated_with_codec, but replace the shallow is_empty check with a check that
the pending mark survives the Some(codec) path so the regression around dropping
pending_marks is covered.

Source: Path instructions

🤖 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/core/src/api/shared.rs`:
- Around line 107-113: The fallback branch in the request encoding flow drops
LlmRequestInterceptOutcome.annotated_request whenever no codec is configured,
which loses interceptor-produced annotations. Update the matching logic around
the codec/annotated_request handling so the branch in shared response building
preserves and returns the annotated_request even when codec is None, using the
existing codec/encode path and outcome.request tuple assembly as the place to
adjust.

In `@crates/core/src/plugin/dynamic/native.rs`:
- Around line 1788-1794: The NativeLlmRequestInterceptOutcome deserialization is
too strict for pending_marks, causing empty marked outcomes from
LlmRequestInterceptOutcome to fail. Update NativeLlmRequestInterceptOutcome to
default pending_marks when omitted, alongside the existing annotated_request
handling, so the native intercept outcome can deserialize the empty form safely.

In `@crates/core/tests/integration/native_plugin_tests.rs`:
- Around line 421-427: The stream test currently checks only that
fixture.native.llm_request.mark is parented to native-fixture-llm-stream, which
can miss incorrect emission order. In
native_plugin_tests::llm_stream_call_execute, add the same timestamp comparison
used in the non-stream path by capturing the ScopeCategory::Start event for
native-fixture-llm-stream and asserting the mark event occurs after that start
event, not just that it shares the start UUID. Keep the existing parent_uuid
assertion and extend it with the ordering check so the test covers lifecycle
sequencing as well as attachment.

In `@crates/plugin/tests/typed_callbacks.rs`:
- Around line 4396-4446: The trampoline test for
register_llm_request_intercept_with_marks only covers a null annotated request,
so it misses the envelope path where an existing AnnotatedLlmRequest could be
dropped. Update the test to pass a non-null annotation through the registration
callback and verify the resulting metadata from the LlmRequestInterceptOutcome
path preserves it under metadata["annotated_request"], while still checking the
pending mark and rewritten request behavior.

In `@crates/types/tests/serialization_tests.rs`:
- Around line 82-113: The serialization test for LlmRequestInterceptOutcome only
covers the case where pending_marks is present; add a backward-compatibility
assertion in llm_request_intercept_outcome_round_trips_pending_marks that
deserializing JSON without pending_marks still succeeds and yields an empty
pending_marks vector. Reuse the existing LlmRequestInterceptOutcome serde
round-trip setup in crates/types/tests/serialization_tests.rs to verify the
omitted-field decode path explicitly.

---

Outside diff comments:
In `@crates/core/tests/unit/shared_tests.rs`:
- Around line 196-221: Add a positive assertion for the codec branch in
shared_tests by exercising run_request_intercepts_with_codec with an interceptor
that returns a real PendingMarkSpec, then verify pending_marks_with_codec still
contains that mark after codec.encode runs. Keep the existing assertions on
request_with_codec and annotated_with_codec, but replace the shallow is_empty
check with a check that the pending mark survives the Some(codec) path so the
regression around dropping pending_marks is covered.
🪄 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: 182915b6-f580-4ff4-b702-8f61bf5d9a0a

📥 Commits

Reviewing files that changed from the base of the PR and between bb20b13 and 97c0bd1.

📒 Files selected for processing (20)
  • crates/core/src/api/llm.rs
  • crates/core/src/api/registry.rs
  • crates/core/src/api/runtime.rs
  • crates/core/src/api/runtime/callbacks.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/context/registries.rs
  • crates/core/src/plugin.rs
  • crates/core/src/plugin/dynamic/native.rs
  • crates/core/tests/fixtures/native_plugin/src/lib.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • crates/core/tests/unit/shared_tests.rs
  • crates/plugin/src/lib.rs
  • crates/plugin/tests/typed_callbacks.rs
  • crates/types/src/api/event.rs
  • crates/types/src/api/llm.rs
  • crates/types/tests/serialization_tests.rs
  • examples/rust-native-plugin/README.md
  • examples/rust-native-plugin/src/lib.rs
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: Check / Run
  • GitHub Check: Preview docs
🧰 Additional context used
📓 Path-based instructions (31)
**/*.rs

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

Use snake_case naming convention for Rust identifiers (e.g., nemo_relay_tool_call)

**/*.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: Run cargo fmt --all to format all Rust code
Run cargo clippy --workspace --all-targets -- -D warnings to enforce all clippy lints as errors

**/*.rs: Run cargo fmt --all when Rust files changed as part of WebAssembly work
Run cargo clippy --workspace --all-targets -- -D warnings when Rust files changed as part of WebAssembly 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
Run Rust formatting with cargo fmt --all
Run Rust linting with cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Use cargo fmt for Rust code formatting
Run cargo clippy -- -D warnings to lint Rust code and treat all warnings as errors
Use Rust snake_case naming convention for Rust identifiers
Include SPDX license header in all Rust source files using double-slash comment syntax
Validate Rust code with uv run pre-commit run --all-files to enforce cargo fmt formatting check, cargo clippy lints, and cargo deny aud...

Files:

  • crates/core/tests/unit/shared_tests.rs
  • crates/core/src/context/registries.rs
  • examples/rust-native-plugin/src/lib.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/plugin.rs
  • crates/types/src/api/event.rs
  • crates/core/src/api/runtime/callbacks.rs
  • crates/plugin/tests/typed_callbacks.rs
  • crates/core/tests/fixtures/native_plugin/src/lib.rs
  • crates/core/src/api/runtime.rs
  • crates/types/tests/serialization_tests.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • crates/plugin/src/lib.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/types/src/api/llm.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/registry.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/plugin/dynamic/native.rs
{crates/adaptive/**/*.rs,**/*test*.{rs,py,go,ts,js},**/*adaptive*test*.{rs,py,go,ts,js},docs/plugins/adaptive/**}

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

Maintain documented and tested validation and report behavior for adaptive surfaces

Files:

  • crates/core/tests/unit/shared_tests.rs
  • crates/types/tests/serialization_tests.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • crates/core/tests/integration/middleware_tests.rs
**/{Cargo.toml,**/*.rs}

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

Maintain consistency between Rust package names in Cargo.toml and their actual usage across the codebase

Files:

  • crates/core/tests/unit/shared_tests.rs
  • crates/core/src/context/registries.rs
  • examples/rust-native-plugin/src/lib.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/plugin.rs
  • crates/types/src/api/event.rs
  • crates/core/src/api/runtime/callbacks.rs
  • crates/plugin/tests/typed_callbacks.rs
  • crates/core/tests/fixtures/native_plugin/src/lib.rs
  • crates/core/src/api/runtime.rs
  • crates/types/tests/serialization_tests.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • crates/plugin/src/lib.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/types/src/api/llm.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/registry.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/plugin/dynamic/native.rs
**/*.{h,hpp,c,cpp,rs}

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

Ensure FFI header and library naming follows consistent conventions across platform-specific builds

Files:

  • crates/core/tests/unit/shared_tests.rs
  • crates/core/src/context/registries.rs
  • examples/rust-native-plugin/src/lib.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/plugin.rs
  • crates/types/src/api/event.rs
  • crates/core/src/api/runtime/callbacks.rs
  • crates/plugin/tests/typed_callbacks.rs
  • crates/core/tests/fixtures/native_plugin/src/lib.rs
  • crates/core/src/api/runtime.rs
  • crates/types/tests/serialization_tests.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • crates/plugin/src/lib.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/types/src/api/llm.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/registry.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/plugin/dynamic/native.rs
{crates/core,crates/adaptive}/**/*

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

Changes to crates/core or crates/adaptive must run the full language matrix

Files:

  • crates/core/tests/unit/shared_tests.rs
  • crates/core/src/context/registries.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/plugin.rs
  • crates/core/src/api/runtime/callbacks.rs
  • crates/core/tests/fixtures/native_plugin/src/lib.rs
  • crates/core/src/api/runtime.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/registry.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/plugin/dynamic/native.rs
**/*.{rs,toml}

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

Update Rust crate names and module prefixes during coordinated rename operations

Files:

  • crates/core/tests/unit/shared_tests.rs
  • crates/core/src/context/registries.rs
  • examples/rust-native-plugin/src/lib.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/plugin.rs
  • crates/types/src/api/event.rs
  • crates/core/src/api/runtime/callbacks.rs
  • crates/plugin/tests/typed_callbacks.rs
  • crates/core/tests/fixtures/native_plugin/src/lib.rs
  • crates/core/src/api/runtime.rs
  • crates/types/tests/serialization_tests.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • crates/plugin/src/lib.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/types/src/api/llm.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/registry.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/plugin/dynamic/native.rs
crates/core/**/*.rs

📄 CodeRabbit inference engine (.agents/skills/test-go-binding/SKILL.md)

If the change touched crates/core or shared runtime semantics, also use validate-change for broader validation

crates/core/**/*.rs: 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. Keep errors explicit and binding-appropriate at the wrapper layer.

Files:

  • crates/core/tests/unit/shared_tests.rs
  • crates/core/src/context/registries.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/plugin.rs
  • crates/core/src/api/runtime/callbacks.rs
  • crates/core/tests/fixtures/native_plugin/src/lib.rs
  • crates/core/src/api/runtime.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/registry.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/plugin/dynamic/native.rs
crates/{core,adaptive}/**

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

If crates/core or crates/adaptive changed, run the full matrix across Rust, Python, Go, Node.js, and WebAssembly

Files:

  • crates/core/tests/unit/shared_tests.rs
  • crates/core/src/context/registries.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/plugin.rs
  • crates/core/src/api/runtime/callbacks.rs
  • crates/core/tests/fixtures/native_plugin/src/lib.rs
  • crates/core/src/api/runtime.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/registry.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/plugin/dynamic/native.rs
**/*.{rs,py,js,ts,tsx,jsx,go,sh,toml,yaml,yml,md}

📄 CodeRabbit inference engine (AGENTS.md)

Keep SPDX headers on source, docs, scripts, and configuration files. The project is Apache-2.0.

Files:

  • crates/core/tests/unit/shared_tests.rs
  • crates/core/src/context/registries.rs
  • examples/rust-native-plugin/src/lib.rs
  • crates/core/src/api/shared.rs
  • examples/rust-native-plugin/README.md
  • crates/core/src/plugin.rs
  • crates/types/src/api/event.rs
  • crates/core/src/api/runtime/callbacks.rs
  • crates/plugin/tests/typed_callbacks.rs
  • crates/core/tests/fixtures/native_plugin/src/lib.rs
  • crates/core/src/api/runtime.rs
  • crates/types/tests/serialization_tests.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • crates/plugin/src/lib.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/types/src/api/llm.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/registry.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/plugin/dynamic/native.rs
**/*.{rs,py,go,js,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Follow binding naming conventions: Rust and Python use snake_case, C FFI exports prefixed nemo_relay_, Go uses PascalCase for public APIs, Node.js uses camelCase.

Files:

  • crates/core/tests/unit/shared_tests.rs
  • crates/core/src/context/registries.rs
  • examples/rust-native-plugin/src/lib.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/plugin.rs
  • crates/types/src/api/event.rs
  • crates/core/src/api/runtime/callbacks.rs
  • crates/plugin/tests/typed_callbacks.rs
  • crates/core/tests/fixtures/native_plugin/src/lib.rs
  • crates/core/src/api/runtime.rs
  • crates/types/tests/serialization_tests.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • crates/plugin/src/lib.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/types/src/api/llm.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/registry.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/plugin/dynamic/native.rs
crates/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

crates/**/*.rs: Keep async behavior on the existing tokio-based model. Bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.
Use Json = serde_json::Value in Rust-facing runtime APIs for JSON payload handling.

Files:

  • crates/core/tests/unit/shared_tests.rs
  • crates/core/src/context/registries.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/plugin.rs
  • crates/types/src/api/event.rs
  • crates/core/src/api/runtime/callbacks.rs
  • crates/plugin/tests/typed_callbacks.rs
  • crates/core/tests/fixtures/native_plugin/src/lib.rs
  • crates/core/src/api/runtime.rs
  • crates/types/tests/serialization_tests.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • crates/plugin/src/lib.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/types/src/api/llm.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/registry.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/plugin/dynamic/native.rs
**

⚙️ CodeRabbit configuration file

**:

AGENTS.md

This file provides guidance to agents, including Claude Code and OpenAI Codex, when working in this repository.

Project Overview

NeMo Relay is a multi-language agent runtime framework for execution scopes, lifecycle events, middleware, plugins, and observability around tool and LLM calls. The core runtime is Rust. Primary supported bindings are Rust, Python, and Node.js. Go, WebAssembly, and the raw C FFI are experimental and source-first.

The shared runtime model is:

  1. Scope stacks decide where work belongs and which scope-local behavior is visible.
  2. Middleware registries decide what guardrails and intercepts run around managed calls.
  3. Plugins install reusable runtime behavior from configuration.
  4. Events record runtime behavior in ATOF form.
  5. Subscribers and exporters consume events in-process or export them to ATIF, OpenTelemetry, OpenInference, or other backends.

Repository Structure

The repository layout separates the Rust runtime, language bindings, documentation,
integration patches, and agent-facing skills.

crates/
  core/       # Rust core runtime crate, published as nemo-relay
  adaptive/   # Adaptive runtime primitives and plugin components
  python/     # PyO3 native extension for the Python package
  ffi/        # Raw C ABI layer used by downstream bindings such as Go
  node/       # NAPI Node.js binding and JavaScript/TypeScript entry points
  wasm/       # wasm-bindgen WebAssembly binding and JS wrappers
python/
  nemo_relay/  # Python wrapper package: scopes, tools, LLM, middleware, typed helpers, plugins, adaptive helpers
  tests/      # Python tests
go/
  nemo_relay/  # Experimental Go CGo binding and tests
fern/         # Fern documentation site
scripts/      # Stable wrappers and helper scripts; build/test/docs entry points live in justfile
third_party/  # P...

Files:

  • crates/core/tests/unit/shared_tests.rs
  • crates/core/src/context/registries.rs
  • examples/rust-native-plugin/src/lib.rs
  • crates/core/src/api/shared.rs
  • examples/rust-native-plugin/README.md
  • crates/core/src/plugin.rs
  • crates/types/src/api/event.rs
  • crates/core/src/api/runtime/callbacks.rs
  • crates/plugin/tests/typed_callbacks.rs
  • crates/core/tests/fixtures/native_plugin/src/lib.rs
  • crates/core/src/api/runtime.rs
  • crates/types/tests/serialization_tests.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • crates/plugin/src/lib.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/types/src/api/llm.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/registry.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/plugin/dynamic/native.rs
crates/{core,adaptive}/**/*.rs

⚙️ CodeRabbit configuration file

crates/{core,adaptive}/**/*.rs: Review the Rust runtime for async correctness, scope isolation, middleware ordering, and event lifecycle regressions.
Pay close attention to task-local/thread-local scope propagation, callback lifetimes, stream finalization, and root_uuid isolation.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.

Files:

  • crates/core/tests/unit/shared_tests.rs
  • crates/core/src/context/registries.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/plugin.rs
  • crates/core/src/api/runtime/callbacks.rs
  • crates/core/tests/fixtures/native_plugin/src/lib.rs
  • crates/core/src/api/runtime.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/registry.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/plugin/dynamic/native.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/core/tests/unit/shared_tests.rs
  • crates/plugin/tests/typed_callbacks.rs
  • crates/core/tests/fixtures/native_plugin/src/lib.rs
  • crates/types/tests/serialization_tests.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • crates/core/tests/integration/middleware_tests.rs
{docs/**,examples/**,README.md}

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

Verify examples still run with documented commands for large or public-facing changes

Files:

  • examples/rust-native-plugin/src/lib.rs
  • examples/rust-native-plugin/README.md
crates/core/src/api/**/*.rs

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

Implement behavior first in Rust core API modules: crates/core/src/api/ and related core modules such as crates/core/src/api/runtime/, crates/core/src/codec/, or crates/core/src/json.rs

Files:

  • crates/core/src/api/shared.rs
  • crates/core/src/api/runtime/callbacks.rs
  • crates/core/src/api/runtime.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/registry.rs
  • crates/core/src/api/llm.rs
**/*.{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:

  • examples/rust-native-plugin/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:

  • examples/rust-native-plugin/README.md
**/*.md

📄 CodeRabbit inference engine (.agents/skills/contribute-integration/SKILL.md)

Documentation must be updated if activation or usage changed

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

Files:

  • examples/rust-native-plugin/README.md
**/{docs,examples,**/*.md,*.patch,*.diff,.github,*.sh,*.yaml,*.yml}

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

Update documentation, examples, CI configuration, and patch artifacts when performing rename operations

Files:

  • examples/rust-native-plugin/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:

  • examples/rust-native-plugin/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:

  • examples/rust-native-plugin/README.md
{docs/**,README.md,CONTRIBUTING.md,**/*.md}

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

Run docs link validation with just docs-linkcheck when links change

Files:

  • examples/rust-native-plugin/README.md
{docs/**,README.md,**/Cargo.toml,**/package.json,**/*.md}

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

Ensure renamed public surfaces are reflected consistently in manifests and docs for large or public-facing changes

Files:

  • examples/rust-native-plugin/README.md
**/*.{md,mdx,py,sh,yaml,yml,toml,json}

📄 CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md)

Keep package names, repo references, and build commands current

Files:

  • examples/rust-native-plugin/README.md
**/*.{html,md,mdx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Include SPDX license header in HTML and Markdown files using HTML comment syntax

Files:

  • examples/rust-native-plugin/README.md
**/README.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Update relevant crate or package README when that surface changed

Files:

  • examples/rust-native-plugin/README.md
crates/core/src/api/runtime/callbacks.rs

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

Define or reuse callback type aliases in crates/core/src/api/runtime/callbacks.rs using Box<dyn Fn(...)> pattern for new middleware types

Files:

  • crates/core/src/api/runtime/callbacks.rs
crates/core/src/api/runtime/state.rs

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

crates/core/src/api/runtime/state.rs: Add registry fields as SortedRegistry<GuardrailEntry<T>> or SortedRegistry<Intercept<T>> to NemoRelayContextState in crates/core/src/api/runtime/state.rs
Add chain execution helpers to NemoRelayContextState following the pattern of existing methods like tool_sanitize_request_chain or tool_request_intercepts_chain

Files:

  • crates/core/src/api/runtime/state.rs
crates/core/src/api/registry.rs

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

Use existing global_*_registry_api! and scope_*_registry_api! macro patterns in crates/core/src/api/registry.rs for both global and scope-local registration APIs unless design explicitly rules one out

Files:

  • crates/core/src/api/registry.rs
crates/core/src/api/{tool,llm}.rs

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

Wire the new middleware chain into the execute path in crates/core/src/api/tool.rs or crates/core/src/api/llm.rs at the appropriate pipeline stage

Files:

  • crates/core/src/api/llm.rs
🔇 Additional comments (19)
crates/core/tests/fixtures/native_plugin/src/lib.rs (1)

8-11: LGTM!

Also applies to: 117-139

examples/rust-native-plugin/src/lib.rs (1)

5-7: LGTM!

Also applies to: 236-255

examples/rust-native-plugin/README.md (1)

87-101: LGTM!

crates/core/src/plugin.rs (2)

30-39: LGTM!


354-384: 📐 Maintainability & Code Quality

Verify required Rust and core-runtime validation before merge.

This PR touches Rust and crates/core, so please confirm cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings, just test-rust, and the affected binding matrix passed. As per coding guidelines, "**/*.rs: Any Rust change must run just test-rust, cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings" and "{crates/core,crates/adaptive}/**/*: Changes to crates/core or crates/adaptive must run the full language matrix."

Source: Coding guidelines

crates/core/src/plugin/dynamic/native.rs (1)

29-41: LGTM!

Also applies to: 1336-1341, 1689-1786

crates/plugin/src/lib.rs (1)

19-22: LGTM!

Also applies to: 1495-1527, 2227-2294

crates/core/tests/integration/middleware_tests.rs (1)

17-24: LGTM!

Also applies to: 33-40, 2594-2782

crates/core/tests/integration/native_plugin_tests.rs (1)

345-362: LGTM!

crates/types/src/api/event.rs (1)

367-389: LGTM!

crates/types/src/api/llm.rs (1)

10-18: LGTM!

Also applies to: 32-75

crates/core/src/api/runtime/callbacks.rs (1)

18-18: LGTM!

Also applies to: 180-189

crates/core/src/api/registry.rs (1)

550-573: 📐 Maintainability & Code Quality

Confirm the required core validation matrix ran.

This changes crates/core request-intercept registration and shared runtime behavior, so please verify the broader repo checks ran, not just local Rust compilation: validate-change, just test-rust, cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings, and the affected binding tests.

As per coding guidelines, "If the change touched crates/core or shared runtime semantics, also use validate-change for broader validation" and "Changes to crates/core or crates/adaptive must run the full language matrix."

Also applies to: 672-697

Source: Coding guidelines

crates/core/src/api/runtime.rs (1)

14-16: LGTM!

crates/core/src/api/llm.rs (2)

6-12: LGTM!

Also applies to: 32-32, 302-330, 620-639, 777-796, 852-876


620-639: 🩺 Stability & Availability

Run the Rust and binding validation matrix for this LLM lifecycle change. This touches crates/core LLM start/end emission on sync and streaming paths, so include cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings, just test-rust, and the affected binding suites (just test-python, just test-go, just test-node, just test-wasm).

crates/core/src/api/runtime/state.rs (1)

23-26: LGTM!

Also applies to: 66-66, 1014-1015, 1044-1062

crates/core/src/context/registries.rs (1)

14-14: LGTM!

Also applies to: 44-44

crates/core/src/api/shared.rs (1)

77-81: LGTM!

Comment thread crates/core/src/api/shared.rs Outdated
Comment thread crates/core/src/plugin/dynamic/native.rs
Comment thread crates/core/tests/integration/native_plugin_tests.rs
Comment thread crates/plugin/tests/typed_callbacks.rs
Comment thread crates/types/tests/serialization_tests.rs
Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
@github-actions

Copy link
Copy Markdown

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