Skip to content

fix: fail closed on sanitizer callback errors - #607

Merged
rapids-bot[bot] merged 3 commits into
NVIDIA:release/0.7from
willkill07:fix/relay-600-sanitizer-fail-closed
Aug 1, 2026
Merged

fix: fail closed on sanitizer callback errors#607
rapids-bot[bot] merged 3 commits into
NVIDIA:release/0.7from
willkill07:fix/relay-600-sanitizer-fail-closed

Conversation

@willkill07

@willkill07 willkill07 commented Jul 31, 2026

Copy link
Copy Markdown
Member

Overview

Fail closed when observability sanitizer callbacks reject, return invalid values, or panic.

  • 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

  • Clear event sanitization fields and omit tool/LLM payloads and annotations on sanitizer failure.
  • Stop the remaining sanitizer chain and retain execution behavior.
  • Cover native, worker, Python, Node, and Go surfaces; update docs and public docstrings.

Where should the reviewer start?

Start with crates/core/src/api/runtime/state.rs, which defines the shared fail-closed sanitizer-chain behavior.

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

  • Fixes RELAY-600

Summary by CodeRabbit

  • Bug Fixes

    • Sanitizer failures and panics now fail closed by clearing or omitting affected observability payloads and annotations.
    • Previously valid sensitive data is no longer preserved after sanitizer errors.
    • Application, tool, and provider execution continues unaffected, with failures recorded.
    • Remaining sanitizers stop after a failure, while codec fallback behavior remains unchanged.
  • Documentation

    • Updated SDK and Relay documentation to describe fail-closed behavior across event, tool, and LLM workflows.

@willkill07
willkill07 requested review from a team as code owners July 31, 2026 19:50
@github-actions github-actions Bot added size:L PR is large Bug issue describes bug; PR fixes bug lang:go PR changes/introduces Go code lang:js PR changes/introduces Javascript/Typescript code lang:python PR changes/introduces Python code lang:rust PR changes/introduces Rust code labels Jul 31, 2026
@coderabbitai

coderabbitai Bot commented Jul 31, 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: efcc13ea-915c-4980-9748-58b411850d05

📥 Commits

Reviewing files that changed from the base of the PR and between c39d11f and 84e4722.

📒 Files selected for processing (1)
  • crates/core/src/api/runtime/state.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 (16)
**/*.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/core/src/api/runtime/state.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/runtime/state.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

Files:

  • crates/core/src/api/runtime/state.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • crates/core/src/api/runtime/state.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/core/src/api/runtime/state.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/core/src/api/runtime/state.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/core/src/api/runtime/state.rs
crates/core/src/{api/**/*.rs,api/runtime/**/*.rs,codec/**/*.rs,json.rs}

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

Implement the new or changed public runtime behavior first in the Rust core, especially under crates/core/src/api/ and related core modules such as crates/core/src/api/runtime/, crates/core/src/codec/, and crates/core/src/json.rs.

Files:

  • crates/core/src/api/runtime/state.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/core/src/api/runtime/state.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/core/src/api/runtime/state.rs
crates/{core,adaptive}/**/*

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

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

Files:

  • crates/core/src/api/runtime/state.rs
**/*.{rs,py,go,js,ts}

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

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

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

Files:

  • crates/core/src/api/runtime/state.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 a SortedRegistry<GuardrailEntry<...>> or SortedRegistry<Intercept<...>> field to NemoRelayContextState for the new middleware type.
Add chain-execution helpers to NemoRelayContextState, following existing helpers such as tool_sanitize_request_chain or tool_request_intercepts_chain.

Files:

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

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

Preserve the documented pipeline order: conditional guardrails, request intercepts, request sanitization, execution intercepts, and response sanitization for tool and LLM execution; specialized sanitization, event creation, and dispatch for mark and scope events.

Files:

  • crates/core/src/api/runtime/state.rs
**/*.{rs,py,js,ts,tsx,go,java,kt,swift}

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

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

Files:

  • crates/core/src/api/runtime/state.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/runtime/state.rs
🧠 Learnings (2)
📚 Learning: 2026-07-28T03:31:05.964Z
Learnt from: willkill07
Repo: NVIDIA/NeMo-Relay PR: 564
File: crates/core/src/api/runtime/subscriber_dispatcher.rs:297-314
Timestamp: 2026-07-28T03:31:05.964Z
Learning: In this codebase’s runtime API, do not implement incremental native LLM stream forwarding via the native ABI v3 asynchronous middleware protocol (it can only settle a single JSON value via a one-shot completion handle and cannot forward stream chunks incrementally). If a latency-sensitive plugin needs streaming behavior, review for use of synchronous native stream intercepts or worker plugins instead of trying to chunk-deliver or incrementally forward over the ABI v3 async path.

Applied to files:

  • crates/core/src/api/runtime/state.rs
📚 Learning: 2026-07-28T20:07:29.880Z
Learnt from: willkill07
Repo: NVIDIA/NeMo-Relay PR: 571
File: crates/core/src/api/runtime/state.rs:996-1020
Timestamp: 2026-07-28T20:07:29.880Z
Learning: In NeMo Relay (RELAY-509), sanitizer callback failures must be treated as intentional fail-open behavior. When an event/tool (request/response) or LLM (request/response) sanitizer callback fails, the sanitizer chain should retain and publish the last valid event/payload snapshot (rather than dropping/invalidating the data) and log the failure including callback context (e.g., which sanitizer/callback failed and relevant identifiers). Apply this consistently across all sanitizer chains mentioned in the RELAY-509 documentation/migration guide.

Applied to files:

  • crates/core/src/api/runtime/state.rs
🔇 Additional comments (6)
crates/core/src/api/runtime/state.rs (6)

23-25: LGTM!


1242-1243: LGTM!

Also applies to: 1310-1311


814-835: 📐 Maintainability & Code Quality

Run the required Rust core validation before handoff.

Run cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings, just test-rust, cargo deny check, validate-change, just test-python, just test-go, just test-node, and uv run pre-commit run --all-files.

The supplied context contains no results for these checks.

As per coding guidelines, Rust changes require the Rust formatter, clippy, and Rust tests; core changes also require broader core validation, the full language matrix, and pre-commit.

Source: Coding guidelines


868-899: 🔒 Security & Privacy

No caller restores a failed sanitizer payload. Tool, LLM, and stream paths preserve None as omitted data and suppress related annotations.

			> Likely an incorrect or invalid review comment.

814-835: 🔒 Security & Privacy

No change required. EventSanitizeFields::default() clears data, category_profile, and metadata, including profile annotations. The dispatcher publishes the sanitized event returned by sanitize_event_snapshot.

			> Likely an incorrect or invalid review comment.

814-835: 🎯 Functional Correctness

Keep the structured logging calls.

crates/core/Cargo.toml enables the kv feature, and Cargo.lock resolves log to 0.4.29. These calls are supported.

			> Likely an incorrect or invalid review comment.

Walkthrough

Sanitizer failures now fail closed across core, Node.js, Python, and Go integrations. Event fields are cleared, while tool and LLM payloads and annotations are omitted. Errors remain logged or recorded, and application execution continues.

Changes

Fail-closed sanitizer handling

Layer / File(s) Summary
Core sanitizer runtime behavior
crates/core/src/api/{llm.rs,runtime/state.rs,runtime/subscriber_dispatcher.rs,shared.rs,tool.rs,stream.rs}
Event failures clear governed fields. Tool and LLM failures omit payloads and stop remaining sanitizers. Stream finalization skips sanitization when snapshot collection fails.
Binding contracts and documentation
crates/python/src/py_callable.rs, crates/node/src/{api/mod.rs,callable.rs}, python/nemo_relay/*
Python wrappers log callback and conversion errors. Node.js and Python documentation describes fail-closed handling.
Cross-language validation
crates/core/tests/*, crates/node/tests/*, python/tests/*, go/nemo_relay/*, crates/ffi/tests/*
Tests assert cleared event fields or omitted tool and LLM payloads after failures, panics, invalid results, and marshal failures.
Behavior documentation
docs/about-nemo-relay/*, docs/build-plugins/*, docs/instrument-applications/*, docs/reference/*
Documentation describes fail-closed behavior and preserves the documented codec fallback behavior.

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

Sequence Diagram(s)

sequenceDiagram
  participant Application
  participant SanitizerChain
  participant ObservabilityPublisher
  Application->>SanitizerChain: Submit event, tool, or LLM payload
  SanitizerChain->>SanitizerChain: Run callbacks
  SanitizerChain-->>ObservabilityPublisher: Clear fields or omit payload on failure
  ObservabilityPublisher-->>Application: Publish observability result
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title follows Conventional Commits format, uses an allowed type, stays under 72 characters, and summarizes the fail-closed sanitizer change.
Description check ✅ Passed The description includes all required sections, completed confirmations, implementation details, reviewer guidance, and a valid related issue reference.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% 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

Copy link
Copy Markdown

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

Caution

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

⚠️ Outside diff range comments (2)
go/nemo_relay/event_sanitizers_test.go (1)

34-56: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Cover populated category_profile in fail-closed tests.

Chain a successful sanitizer that sets category_profile before the failing sanitizer in both go/nemo_relay/event_sanitizers_test.go and python/tests/test_event_sanitizers.py. Assert that sanitizer failure clears data, category_profile, and metadata.

🤖 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 `@go/nemo_relay/event_sanitizers_test.go` around lines 34 - 56, The fail-closed
sanitizer tests must also cover populated category_profile. In
go/nemo_relay/event_sanitizers_test.go, chain a successful sanitizer that sets
category_profile before the failing sanitizer and extend the assertions to
require data, category_profile, and metadata are cleared; apply the same setup
and assertions in python/tests/test_event_sanitizers.py.

Sources: Coding guidelines, Path instructions

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

1241-1242: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

LLM sanitizer chain # Returns docs are stale relative to the fail-closed implementation. Both llm_sanitize_request_snapshot_chain and llm_sanitize_response_snapshot_chain can now return None when a sanitizer errors or panics, but neither doc comment says so, unlike the sibling tool_sanitize_request_snapshot_chain/tool_sanitize_response_snapshot_chain docs that were updated in this same PR.

  • crates/core/src/api/runtime/state.rs#L1241-L1242: update the # Returns doc on llm_sanitize_request_snapshot_chain to mention that a sanitizer failure produces None.
  • crates/core/src/api/runtime/state.rs#L1308-L1309: update the # Returns doc on llm_sanitize_response_snapshot_chain to mention that a sanitizer failure produces None.
🤖 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/src/api/runtime/state.rs` around lines 1241 - 1242, The Returns
documentation for llm_sanitize_request_snapshot_chain and
llm_sanitize_response_snapshot_chain is incomplete: update both documented sites
in crates/core/src/api/runtime/state.rs (lines 1241-1242 and 1308-1309) to state
that sanitizer errors or panics produce None, while successful sanitization
returns the sanitized request or response.
🤖 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/tests/unit/runtime_state_tests.rs`:
- Line 12: Extend sanitizer_snapshot_chains_fail_closed_on_callback_panics with
a second callback in every sanitizer chain that records whether it runs, then
assert each recorded flag remains false after the first callback panics. Keep
the existing output-clearing assertions and verify subsequent callbacks are
skipped for every chain.

In `@crates/node/src/api/mod.rs`:
- Around line 2822-2826: Update the callback error documentation near the global
and scope-local event guardrails to state that, when publication is queued,
callers must await flushSubscribers() before reading getLastCallbackError() or
asserting that emitted event fields were cleared.

In `@python/nemo_relay/__init__.py`:
- Around line 169-170: Update the sanitizer payload documentation in
python/nemo_relay/__init__.py at lines 169-170 to state that exceptions omit the
observability payload and stop the remaining sanitizer chain. Add identical
chain-termination wording in python/nemo_relay/__init__.pyi at lines 174-174 so
both public surfaces document the same fail-closed contract.

---

Outside diff comments:
In `@crates/core/src/api/runtime/state.rs`:
- Around line 1241-1242: The Returns documentation for
llm_sanitize_request_snapshot_chain and llm_sanitize_response_snapshot_chain is
incomplete: update both documented sites in crates/core/src/api/runtime/state.rs
(lines 1241-1242 and 1308-1309) to state that sanitizer errors or panics produce
None, while successful sanitization returns the sanitized request or response.

In `@go/nemo_relay/event_sanitizers_test.go`:
- Around line 34-56: The fail-closed sanitizer tests must also cover populated
category_profile. In go/nemo_relay/event_sanitizers_test.go, chain a successful
sanitizer that sets category_profile before the failing sanitizer and extend the
assertions to require data, category_profile, and metadata are cleared; apply
the same setup and assertions in python/tests/test_event_sanitizers.py.
🪄 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: d1576755-e04a-4428-8dbd-145c6988bee3

📥 Commits

Reviewing files that changed from the base of the PR and between 262337e and 0dd056f.

📒 Files selected for processing (31)
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/stream.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • crates/core/tests/integration/subscriber_dispatcher_tests.rs
  • crates/core/tests/unit/dynamic_worker_tests.rs
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/node/src/api/mod.rs
  • crates/node/src/callable.rs
  • crates/node/tests/event_sanitizers_tests.mjs
  • crates/node/tests/llm_tests.mjs
  • crates/node/tests/tools_tests.mjs
  • crates/python/src/py_callable.rs
  • docs/about-nemo-relay/concepts/middleware.mdx
  • docs/about-nemo-relay/release-notes/index.mdx
  • docs/build-plugins/dynamic-plugins/native-dynamic/about.mdx
  • docs/instrument-applications/advanced-guide.mdx
  • docs/reference/event-sanitizers.mdx
  • docs/reference/migration-guides.mdx
  • go/nemo_relay/event_sanitizers_test.go
  • python/nemo_relay/__init__.py
  • python/nemo_relay/__init__.pyi
  • python/nemo_relay/llm.py
  • python/nemo_relay/tools.py
  • python/tests/test_event_sanitizers.py
  • python/tests/test_llm.py
  • python/tests/test_tools.py
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Check / Run
🧰 Additional context used
📓 Path-based instructions (41)
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • python/nemo_relay/tools.py
  • crates/node/src/callable.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • python/nemo_relay/llm.py
  • python/tests/test_tools.py
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/src/stream.rs
  • python/nemo_relay/__init__.py
  • crates/core/tests/unit/dynamic_worker_tests.rs
  • crates/core/src/api/shared.rs
  • python/tests/test_event_sanitizers.py
  • python/tests/test_llm.py
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/node/src/api/mod.rs
  • crates/python/src/py_callable.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/tests/integration/subscriber_dispatcher_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:

  • python/nemo_relay/tools.py
  • crates/node/src/callable.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • python/nemo_relay/llm.py
  • python/tests/test_tools.py
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/node/tests/llm_tests.mjs
  • crates/core/src/stream.rs
  • python/nemo_relay/__init__.py
  • crates/core/tests/unit/dynamic_worker_tests.rs
  • crates/core/src/api/shared.rs
  • python/tests/test_event_sanitizers.py
  • crates/node/tests/tools_tests.mjs
  • python/tests/test_llm.py
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/node/src/api/mod.rs
  • crates/python/src/py_callable.rs
  • crates/core/src/api/llm.rs
  • crates/node/tests/event_sanitizers_tests.mjs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/tests/integration/subscriber_dispatcher_tests.rs
python/nemo_relay/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Python wrapper modules live under python/nemo_relay/, and the native extension is built from crates/python with maturin.

Files:

  • python/nemo_relay/tools.py
  • python/nemo_relay/llm.py
  • python/nemo_relay/__init__.py
**/*.py

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.py: When changing the Python wrapper package, tests, or docs tooling, lint with Ruff (E, F, W, I), format with Ruff formatter (120-character lines, double quotes), and pass ty type checking.
Add the SPDX license header to all Python source files using the # comment form.

Files:

  • python/nemo_relay/tools.py
  • python/nemo_relay/llm.py
  • python/tests/test_tools.py
  • python/nemo_relay/__init__.py
  • python/tests/test_event_sanitizers.py
  • python/tests/test_llm.py
**/*.{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:

  • python/nemo_relay/tools.py
  • crates/node/src/callable.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • go/nemo_relay/event_sanitizers_test.go
  • python/nemo_relay/llm.py
  • python/tests/test_tools.py
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/src/stream.rs
  • python/nemo_relay/__init__.py
  • crates/core/tests/unit/dynamic_worker_tests.rs
  • crates/core/src/api/shared.rs
  • python/tests/test_event_sanitizers.py
  • python/tests/test_llm.py
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/node/src/api/mod.rs
  • crates/python/src/py_callable.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/tests/integration/subscriber_dispatcher_tests.rs
{crates/python/src/py_api/mod.rs,python/nemo_relay/**/*.py,python/nemo_relay/**/*.pyi,go/nemo_relay/**/*.go,crates/node/src/api/**/*.rs}

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

Update the language-native bindings for every exposed surface in Python, Go, and Node.js.

Files:

  • python/nemo_relay/tools.py
  • go/nemo_relay/event_sanitizers_test.go
  • python/nemo_relay/llm.py
  • python/nemo_relay/__init__.py
  • python/nemo_relay/__init__.pyi
  • crates/node/src/api/mod.rs
{python/nemo_relay/**/*.py,python/nemo_relay/**/*.pyi,go/nemo_relay/**/*.go}

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

Update language wrapper helpers such as Python wrapper modules, Python type stubs, and Go shorthand packages when the new behavior belongs in those helper layers.

Files:

  • python/nemo_relay/tools.py
  • go/nemo_relay/event_sanitizers_test.go
  • python/nemo_relay/llm.py
  • python/nemo_relay/__init__.py
  • python/nemo_relay/__init__.pyi
{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:

  • python/nemo_relay/tools.py
  • crates/node/src/callable.rs
  • python/nemo_relay/llm.py
  • python/tests/test_tools.py
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/core/src/stream.rs
  • python/nemo_relay/__init__.py
  • crates/core/src/api/shared.rs
  • python/tests/test_event_sanitizers.py
  • python/tests/test_llm.py
  • crates/node/src/api/mod.rs
  • crates/python/src/py_callable.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime/state.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:

  • python/nemo_relay/tools.py
  • docs/about-nemo-relay/release-notes/index.mdx
  • docs/about-nemo-relay/concepts/middleware.mdx
  • crates/node/src/callable.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • go/nemo_relay/event_sanitizers_test.go
  • python/nemo_relay/llm.py
  • python/tests/test_tools.py
  • docs/build-plugins/dynamic-plugins/native-dynamic/about.mdx
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • docs/reference/event-sanitizers.mdx
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/node/tests/llm_tests.mjs
  • crates/core/src/stream.rs
  • python/nemo_relay/__init__.py
  • docs/reference/migration-guides.mdx
  • docs/instrument-applications/advanced-guide.mdx
  • crates/core/tests/unit/dynamic_worker_tests.rs
  • crates/core/src/api/shared.rs
  • python/tests/test_event_sanitizers.py
  • crates/node/tests/tools_tests.mjs
  • python/tests/test_llm.py
  • python/nemo_relay/__init__.pyi
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/node/src/api/mod.rs
  • crates/python/src/py_callable.rs
  • crates/core/src/api/llm.rs
  • crates/node/tests/event_sanitizers_tests.mjs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/tests/integration/subscriber_dispatcher_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.

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

Files:

  • python/nemo_relay/tools.py
  • crates/node/src/callable.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • go/nemo_relay/event_sanitizers_test.go
  • python/nemo_relay/llm.py
  • python/tests/test_tools.py
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/src/stream.rs
  • python/nemo_relay/__init__.py
  • crates/core/tests/unit/dynamic_worker_tests.rs
  • crates/core/src/api/shared.rs
  • python/tests/test_event_sanitizers.py
  • python/tests/test_llm.py
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/node/src/api/mod.rs
  • crates/python/src/py_callable.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/tests/integration/subscriber_dispatcher_tests.rs
**/*.{rs,py,js,ts,tsx,go,java,kt,swift}

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

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

Files:

  • python/nemo_relay/tools.py
  • crates/node/src/callable.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • go/nemo_relay/event_sanitizers_test.go
  • python/nemo_relay/llm.py
  • python/tests/test_tools.py
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/src/stream.rs
  • python/nemo_relay/__init__.py
  • crates/core/tests/unit/dynamic_worker_tests.rs
  • crates/core/src/api/shared.rs
  • python/tests/test_event_sanitizers.py
  • python/tests/test_llm.py
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/node/src/api/mod.rs
  • crates/python/src/py_callable.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/tests/integration/subscriber_dispatcher_tests.rs
**/*.{md,mdx,py,go,js,ts}

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

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

Files:

  • python/nemo_relay/tools.py
  • docs/about-nemo-relay/release-notes/index.mdx
  • docs/about-nemo-relay/concepts/middleware.mdx
  • go/nemo_relay/event_sanitizers_test.go
  • python/nemo_relay/llm.py
  • python/tests/test_tools.py
  • docs/build-plugins/dynamic-plugins/native-dynamic/about.mdx
  • docs/reference/event-sanitizers.mdx
  • python/nemo_relay/__init__.py
  • docs/reference/migration-guides.mdx
  • docs/instrument-applications/advanced-guide.mdx
  • python/tests/test_event_sanitizers.py
  • python/tests/test_llm.py
python/nemo_relay/**/*

⚙️ CodeRabbit configuration file

python/nemo_relay/**/*: Review Python wrapper changes for typed API consistency, contextvars-based scope isolation, async behavior, and parity with the native extension.
Stubs and runtime implementations should stay aligned.

Files:

  • python/nemo_relay/tools.py
  • python/nemo_relay/llm.py
  • python/nemo_relay/__init__.py
  • python/nemo_relay/__init__.pyi
**/*.mdx

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

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

In MDX files, top-of-file comments must use JSX comment delimiters ({/* to open and */} to close); do not use HTML comments for MDX SPDX headers

Files:

  • docs/about-nemo-relay/release-notes/index.mdx
  • docs/about-nemo-relay/concepts/middleware.mdx
  • docs/build-plugins/dynamic-plugins/native-dynamic/about.mdx
  • docs/reference/event-sanitizers.mdx
  • docs/reference/migration-guides.mdx
  • docs/instrument-applications/advanced-guide.mdx
**/*.{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:

  • docs/about-nemo-relay/release-notes/index.mdx
  • docs/about-nemo-relay/concepts/middleware.mdx
  • docs/build-plugins/dynamic-plugins/native-dynamic/about.mdx
  • docs/reference/event-sanitizers.mdx
  • docs/reference/migration-guides.mdx
  • docs/instrument-applications/advanced-guide.mdx
**/*.{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:

  • docs/about-nemo-relay/release-notes/index.mdx
  • docs/about-nemo-relay/concepts/middleware.mdx
  • docs/build-plugins/dynamic-plugins/native-dynamic/about.mdx
  • docs/reference/event-sanitizers.mdx
  • docs/reference/migration-guides.mdx
  • docs/instrument-applications/advanced-guide.mdx
docs/about-nemo-relay/release-notes/{index,highlights,known-issues}.mdx

📄 CodeRabbit inference engine (.agents/skills/draft-release-notes/SKILL.md)

docs/about-nemo-relay/release-notes/{index,highlights,known-issues}.mdx: Update only docs/about-nemo-relay/release-notes/index.mdx, docs/about-nemo-relay/release-notes/highlights.mdx, and docs/about-nemo-relay/release-notes/known-issues.mdx unless the release changes their route or entry points.
Preserve the existing MDX front matter and the JSX SPDX comment in the release-notes pages.

Files:

  • docs/about-nemo-relay/release-notes/index.mdx
{docs,examples}/**/*

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

Update docs and examples.

Files:

  • docs/about-nemo-relay/release-notes/index.mdx
  • docs/about-nemo-relay/concepts/middleware.mdx
  • docs/build-plugins/dynamic-plugins/native-dynamic/about.mdx
  • docs/reference/event-sanitizers.mdx
  • docs/reference/migration-guides.mdx
  • docs/instrument-applications/advanced-guide.mdx
docs/**/*

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

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

Files:

  • docs/about-nemo-relay/release-notes/index.mdx
  • docs/about-nemo-relay/concepts/middleware.mdx
  • docs/build-plugins/dynamic-plugins/native-dynamic/about.mdx
  • docs/reference/event-sanitizers.mdx
  • docs/reference/migration-guides.mdx
  • docs/instrument-applications/advanced-guide.mdx
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}

⚙️ CodeRabbit configuration file

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

Files:

  • docs/about-nemo-relay/release-notes/index.mdx
  • docs/about-nemo-relay/concepts/middleware.mdx
  • docs/build-plugins/dynamic-plugins/native-dynamic/about.mdx
  • docs/reference/event-sanitizers.mdx
  • docs/reference/migration-guides.mdx
  • docs/instrument-applications/advanced-guide.mdx
**/*.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/node/src/callable.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/src/stream.rs
  • crates/core/tests/unit/dynamic_worker_tests.rs
  • crates/core/src/api/shared.rs
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/node/src/api/mod.rs
  • crates/python/src/py_callable.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/tests/integration/subscriber_dispatcher_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/node/src/callable.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • go/nemo_relay/event_sanitizers_test.go
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/src/stream.rs
  • crates/core/tests/unit/dynamic_worker_tests.rs
  • crates/core/src/api/shared.rs
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/node/src/api/mod.rs
  • crates/python/src/py_callable.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/tests/integration/subscriber_dispatcher_tests.rs
crates/{python,ffi,node}/**/*

⚙️ CodeRabbit configuration file

crates/{python,ffi,node}/**/*: Treat binding changes as public API changes. Check for parity with the other language bindings, FFI ownership/lifetime safety,
callback error propagation, stable type conversion, and consistent async/stream semantics.
Flag changes that update one binding without corresponding tests or documentation for the same surface elsewhere.

Files:

  • crates/node/src/callable.rs
  • crates/node/tests/llm_tests.mjs
  • crates/node/tests/tools_tests.mjs
  • crates/node/src/api/mod.rs
  • crates/python/src/py_callable.rs
  • crates/node/tests/event_sanitizers_tests.mjs
{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/integration/native_plugin_tests.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/src/stream.rs
  • crates/core/tests/unit/dynamic_worker_tests.rs
  • crates/core/src/api/shared.rs
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/tests/integration/subscriber_dispatcher_tests.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

Files:

  • crates/core/tests/integration/native_plugin_tests.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/src/stream.rs
  • crates/core/tests/unit/dynamic_worker_tests.rs
  • crates/core/src/api/shared.rs
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/tests/integration/subscriber_dispatcher_tests.rs
crates/{core,adaptive}/**/*

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

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

Files:

  • crates/core/tests/integration/native_plugin_tests.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/src/stream.rs
  • crates/core/tests/unit/dynamic_worker_tests.rs
  • crates/core/src/api/shared.rs
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/tests/integration/subscriber_dispatcher_tests.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/integration/native_plugin_tests.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/src/stream.rs
  • crates/core/tests/unit/dynamic_worker_tests.rs
  • crates/core/src/api/shared.rs
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/tests/integration/subscriber_dispatcher_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/core/tests/integration/native_plugin_tests.rs
  • go/nemo_relay/event_sanitizers_test.go
  • python/tests/test_tools.py
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/node/tests/llm_tests.mjs
  • crates/core/tests/unit/dynamic_worker_tests.rs
  • python/tests/test_event_sanitizers.py
  • crates/node/tests/tools_tests.mjs
  • python/tests/test_llm.py
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/node/tests/event_sanitizers_tests.mjs
  • crates/core/tests/integration/subscriber_dispatcher_tests.rs
go/nemo_relay/**/*.go

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

go/nemo_relay/**/*.go: Format changed Go packages with cd go/nemo_relay && go fmt ./...
Run Go tests with just test-go to build and test the NeMo Relay Go binding
Use just build-go when you want an explicit build-only pass or need the artifact for other work
Use just ci=true test-go when you need the CI-style coverage and JUnit path
On macOS, set DYLD_LIBRARY_PATH to the ../../target/release directory before running the raw go test command directly

Use PascalCase for public Go APIs.

Files:

  • go/nemo_relay/event_sanitizers_test.go
**/*.go

📄 CodeRabbit inference engine (CONTRIBUTING.md)

When changing the experimental Go binding, format Go code with gofmt and keep go vet ./... passing.

Files:

  • go/nemo_relay/event_sanitizers_test.go
go/nemo_relay/**

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

Keep shared plugin helpers in go/nemo_relay aligned with plugin registration, composition, and lifecycle behavior.

Files:

  • go/nemo_relay/event_sanitizers_test.go
go/nemo_relay/**/*

⚙️ CodeRabbit configuration file

go/nemo_relay/**/*: Review Go binding changes for cgo memory ownership, race safety, callback cleanup, idiomatic exported APIs, and parity with Rust/FFI behavior.
Any API change should include focused Go tests and consider race-test behavior.

Files:

  • go/nemo_relay/event_sanitizers_test.go
python/tests/**/*.py

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

python/tests/**/*.py: Pytest is used to run tests.
Do not add @pytest.mark.asyncio to any test; async tests are automatically detected and run by the async runner.
Do not add a -> None return type annotation to test functions.
When mocking a class, do not define a new class; use unittest.mock.MagicMock or unittest.mock.AsyncMock, with the spec constructor argument when necessary.
Name mocked classes with the mock prefix, not fake.
Prefer pytest fixtures over helper methods.
Do not repeat fixtures; if a fixture is needed in multiple test files, place it in a conftest.py file.
When creating a fixture, use @pytest.fixture(name="<fixture_name>"[, scope="<scope>"]) and define the fixture function as def <fixture_name>_fixture() -> <return_type>:; only specify scope when it is not function.
Prefer pytest.mark.parametrize over creating individual tests for different input types.

Files:

  • python/tests/test_tools.py
  • python/tests/test_event_sanitizers.py
  • python/tests/test_llm.py
{crates/core/src/plugin/dynamic/**,crates/plugin/**,crates/worker/**,crates/worker-proto/**,crates/types/**,python/plugin/**,examples/rust-native-plugin/**,examples/python-grpc-worker-plugin/**,docs/build-plugins/**}

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

Keep the stable boundary explicit: native plugins cross a C ABI, and worker plugins cross grpc-v1.

Files:

  • docs/build-plugins/dynamic-plugins/native-dynamic/about.mdx
{crates/core/src/plugin/dynamic/**,examples/rust-native-plugin/**,examples/python-grpc-worker-plugin/**,docs/build-plugins/**}

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

Native and worker plugins are trusted extensions; document that native plugins are in-process and unsandboxed, and worker plugins provide process isolation but not a security sandbox.

Files:

  • docs/build-plugins/dynamic-plugins/native-dynamic/about.mdx
{docs/build-plugins/**,examples/rust-native-plugin/**,examples/python-grpc-worker-plugin/**}

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

When detailed dynamic plugin guides exist, keep Rust native, Python worker, and grpc-v1 protocol details on separate pages.

Files:

  • docs/build-plugins/dynamic-plugins/native-dynamic/about.mdx
crates/core/src/{api/**/*.rs,api/runtime/**/*.rs,codec/**/*.rs,json.rs}

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

Implement the new or changed public runtime behavior first in the Rust core, especially under crates/core/src/api/ and related core modules such as crates/core/src/api/runtime/, crates/core/src/codec/, and crates/core/src/json.rs.

Files:

  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime/state.rs
crates/core/src/api/**/*.rs

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

Preserve the documented pipeline order: conditional guardrails, request intercepts, request sanitization, execution intercepts, and response sanitization for tool and LLM execution; specialized sanitization, event creation, and dispatch for mark and scope events.

Files:

  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime/state.rs
crates/node/**/*.{js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use camelCase for Node.js public APIs.

Files:

  • crates/node/tests/llm_tests.mjs
  • crates/node/tests/tools_tests.mjs
  • crates/node/tests/event_sanitizers_tests.mjs
crates/core/src/api/{tool,llm,shared,scope}.rs

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

Wire the new middleware chain into the appropriate lifecycle owner and pipeline stage: tool and LLM execution paths use tool.rs or llm.rs; shared mark and scope event sanitization uses shared.rs and is called from scope.rs.

Files:

  • crates/core/src/api/shared.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/tool.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 a SortedRegistry<GuardrailEntry<...>> or SortedRegistry<Intercept<...>> field to NemoRelayContextState for the new middleware type.
Add chain-execution helpers to NemoRelayContextState, following existing helpers such as tool_sanitize_request_chain or tool_request_intercepts_chain.

Files:

  • crates/core/src/api/runtime/state.rs
🧠 Learnings (4)
📚 Learning: 2026-07-28T20:33:25.156Z
Learnt from: willkill07
Repo: NVIDIA/NeMo-Relay PR: 572
File: go/nemo_relay/adaptive_runtime_test.go:214-238
Timestamp: 2026-07-28T20:33:25.156Z
Learning: When adding/adjusting Go unit tests for `BuildCacheRequestFacts` (request-ID validation and related request parsing), set `CacheRequestFactsInput.Provider` to a valid provider in all tests that are intended to isolate request-ID behavior—because `BuildCacheRequestFacts` does not validate `Provider`. Then add separate test coverage for malformed `AnnotatedRequest` JSON so JSON parsing failures are not conflated with `Provider`-related inputs.

Applied to files:

  • go/nemo_relay/event_sanitizers_test.go
📚 Learning: 2026-07-28T03:31:05.964Z
Learnt from: willkill07
Repo: NVIDIA/NeMo-Relay PR: 564
File: crates/core/src/api/runtime/subscriber_dispatcher.rs:297-314
Timestamp: 2026-07-28T03:31:05.964Z
Learning: In this codebase’s runtime API, do not implement incremental native LLM stream forwarding via the native ABI v3 asynchronous middleware protocol (it can only settle a single JSON value via a one-shot completion handle and cannot forward stream chunks incrementally). If a latency-sensitive plugin needs streaming behavior, review for use of synchronous native stream intercepts or worker plugins instead of trying to chunk-deliver or incrementally forward over the ABI v3 async path.

Applied to files:

  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/core/src/api/runtime/state.rs
📚 Learning: 2026-07-28T20:07:29.880Z
Learnt from: willkill07
Repo: NVIDIA/NeMo-Relay PR: 571
File: crates/core/src/api/runtime/state.rs:996-1020
Timestamp: 2026-07-28T20:07:29.880Z
Learning: In NeMo Relay (RELAY-509), sanitizer callback failures must be treated as intentional fail-open behavior. When an event/tool (request/response) or LLM (request/response) sanitizer callback fails, the sanitizer chain should retain and publish the last valid event/payload snapshot (rather than dropping/invalidating the data) and log the failure including callback context (e.g., which sanitizer/callback failed and relevant identifiers). Apply this consistently across all sanitizer chains mentioned in the RELAY-509 documentation/migration guide.

Applied to files:

  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/core/src/stream.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime/state.rs
📚 Learning: 2026-07-28T23:57:11.641Z
Learnt from: willkill07
Repo: NVIDIA/NeMo-Relay PR: 570
File: crates/node/src/api/mod.rs:3265-3282
Timestamp: 2026-07-28T23:57:11.641Z
Learning: In the Node.js binding, `flushSubscribers()` is Promise-based/async and must be awaited. Any session-close or teardown path (e.g., the OpenClaw live smoke session-close flow) must await `flushSubscribers()` before continuing to live ATIF export assertions and before teardown, so queued subscriber delivery fully completes and tests/assertions observe the final state.

Applied to files:

  • crates/node/src/api/mod.rs
🪛 Ruff (0.16.0)
python/tests/test_event_sanitizers.py

[warning] 66-66: Avoid specifying long messages outside the exception class

(TRY003)

🔇 Additional comments (30)
crates/core/tests/integration/native_plugin_tests.rs (1)

935-935: LGTM!

Also applies to: 976-977

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

371-385: LGTM!

Also applies to: 410-414, 444-444, 481-481

crates/core/tests/unit/dynamic_worker_tests.rs (1)

1577-1578: LGTM!

Also applies to: 1588-1588, 1597-1597, 1606-1606, 1615-1615

crates/core/tests/unit/subscriber_dispatcher_tests.rs (1)

535-535: LGTM!

Also applies to: 544-546, 564-567

crates/node/tests/event_sanitizers_tests.mjs (1)

34-38: LGTM!

Also applies to: 370-370, 398-398, 426-426, 456-464, 483-483, 552-552, 577-577

crates/node/tests/llm_tests.mjs (1)

834-834: LGTM!

Also applies to: 852-852, 947-947, 965-965

crates/node/tests/tools_tests.mjs (1)

683-683: LGTM!

Also applies to: 700-700

python/tests/test_llm.py (1)

363-363: LGTM!

Also applies to: 386-389, 412-415, 434-437, 456-456

python/tests/test_tools.py (1)

279-279: LGTM!

Also applies to: 296-298, 315-315

docs/about-nemo-relay/concepts/middleware.mdx (1)

196-197: LGTM!

docs/about-nemo-relay/release-notes/index.mdx (1)

39-41: LGTM!

docs/build-plugins/dynamic-plugins/native-dynamic/about.mdx (1)

246-248: LGTM!

docs/instrument-applications/advanced-guide.mdx (1)

205-206: LGTM!

docs/reference/event-sanitizers.mdx (1)

55-61: LGTM!

Also applies to: 84-84

docs/reference/migration-guides.mdx (1)

119-121: LGTM!

Also applies to: 222-223

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

799-839: 🗄️ Data Integrity & Integration

Confirm the fail-closed reversal is intentional and coordinated.

event_sanitize_snapshot_chain now clears observability fields and stops the chain on any sanitizer error or panic. This is the opposite of the fail-open, retain-last-valid-snapshot behavior recorded for this exact function family in a prior learning (RELAY-509). The PR objective states this is an intentional reversal for RELAY-600, and unit tests in crates/core/tests/unit/runtime_state_tests.rs already assert the new behavior.

Confirm that this reversal is coordinated with all layers that reference the old fail-open contract: the RELAY-509 migration guide, docs/reference/event-sanitizers.mdx, and any external plugin authors who relied on last-valid-snapshot retention during sanitizer failures. This same pattern applies to the tool and LLM sanitizer chains in this file, subscriber_dispatcher.rs, shared.rs, and stream.rs.

Based on retrieved learnings: "sanitizer callback failures must be treated as intentional fail-open behavior... the sanitizer chain should retain and publish the last valid event/payload snapshot... Apply this consistently across all sanitizer chains mentioned in the RELAY-509 documentation/migration guide."

Source: Learnings


850-967: LGTM!

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

968-1069: LGTM!

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

53-120: LGTM!

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

248-249: LGTM!

Also applies to: 320-323, 380-380, 436-437


486-492: 🗄️ Data Integrity & Integration

Confirm dropping the caller-supplied fallback on sanitizer failure is intended. Both sites use sanitized.and_then(|value| if value.is_null() { fallback } else { Some(value) }). When the sanitizer chain fails (sanitized == None), .and_then short-circuits and the caller-supplied fallback/data is dropped along with the raw sanitized result, even though fallback is application-owned, not the risky raw tool output.

  • crates/core/src/api/tool.rs#L486-L492: confirm that tool_call_end should omit fallback (not just the sanitized result) when the response sanitizer chain fails.
  • crates/core/src/api/tool.rs#L535-L541: confirm the same for tool_call_end_with_pending_marks, which duplicates the identical fallback-clearing expression.
crates/core/src/stream.rs (1)

240-282: LGTM!

python/nemo_relay/llm.py (1)

170-171: LGTM!

python/nemo_relay/tools.py (1)

130-130: LGTM!

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

709-711: 🗄️ Data Integrity & Integration

Verify the intentional fail-closed contract migration.

These comments change the public sanitizer contract from fail-open to fail-closed. Confirm that RELAY-600 intentionally supersedes the earlier contract, and verify that every sanitizer chain, binding, migration guide, and test uses the same semantics. The local LLM flow is consistent with omitting the sanitized payload and annotation, but this file cannot establish cross-layer compatibility.

Based on learnings, RELAY-509/PR 571 required retaining the last valid sanitizer snapshot after callback failure. Confirm that this change is an intentional migration, not a regression. As per path instructions, public API changes should preserve existing behavior unless tests and documentation show the intended migration path. The supplied PR objective identifies RELAY-600 as the intended fail-closed migration.

Also applies to: 933-940

Sources: Path instructions, Learnings

crates/node/src/callable.rs (1)

575-576: LGTM!

crates/node/src/api/mod.rs (1)

2904-2904: LGTM!

Also applies to: 2921-2921, 3074-3075, 3108-3109, 3463-3463, 3481-3481, 3656-3656, 3701-3701

python/nemo_relay/__init__.py (1)

172-174: LGTM!

Also applies to: 183-192

python/nemo_relay/__init__.pyi (1)

189-190: LGTM!

Also applies to: 216-219, 236-239

crates/python/src/py_callable.rs (1)

840-850: 🩺 Stability & Availability

Keep the current sanitizer error handling. The core sanitizer chains wrap each complete callback future in catch_unwind(), so an eprintln! panic follows the existing sanitizer-panic path and preserves fail-closed behavior.

			> Likely an incorrect or invalid review comment.

Comment thread crates/core/tests/unit/runtime_state_tests.rs
Comment thread crates/node/src/api/mod.rs Outdated
Comment thread python/nemo_relay/__init__.py Outdated
@willkill07 willkill07 self-assigned this Jul 31, 2026
@willkill07 willkill07 added this to the 0.7 milestone Jul 31, 2026
Signed-off-by: Will Killian <wkillian@nvidia.com>
@willkill07
willkill07 force-pushed the fix/relay-600-sanitizer-fail-closed branch from 0dd056f to c913cb2 Compare July 31, 2026 20:18

@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

🤖 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/tests/unit/subscriber_dispatcher_tests.rs`:
- Around line 564-567: Add an invocation flag to the callback setup in the
runtime-failure test and set it when the callback executes; after dispatch,
assert the flag remains unset to verify the sanitizer runtime failure prevents
callback invocation, while retaining the existing published event shell and
cleared-field assertions.

In `@crates/ffi/tests/unit/api/registry_tests.rs`:
- Around line 439-444: Update the assertions for invalid_callback_event to
verify key presence separately from value equality, using key-aware assertions
that distinguish an explicitly present Json::Null from a missing field. Apply
this to data, json.category_profile, and metadata while preserving their
expected null values.

In `@crates/node/src/api/mod.rs`:
- Line 2904: Expand the sanitizer documentation so fail-closed behavior includes
callback errors, serialization or conversion failures, invalid results, and
related sanitizer failures, not only thrown callbacks. Apply this wording to
tool request and response sanitizers at crates/node/src/api/mod.rs lines 2904
and 2921, LLM request and response sanitizers at lines 3074-3075 and 3108-3109,
and scope-local tool and LLM request/response sanitizers at lines 3463, 3481,
3656, and 3701; preserve the documented outcome that failures omit or clear the
affected observability data.

In `@python/nemo_relay/__init__.py`:
- Around line 169-174: Update the sanitizer callback documentation to state that
invalid return values, like exceptions, fail closed according to the current
API. Apply this to ToolSanitizeGuardrail and the event/LLM sanitizer aliases in
python/nemo_relay/__init__.py at lines 169-174 and 183-192, and document invalid
tool, event, LLM request, and LLM response results in
python/nemo_relay/__init__.pyi at lines 174, 189-190, 216-219, and 236-239; keep
the descriptions technically accurate without changing behavior.

In `@python/nemo_relay/llm.py`:
- Around line 170-171: Update the documentation near the sanitizer/codec
error-handling statements to distinguish the behaviors: sanitizer callback
failures must fail closed, while response-codec failures retain their existing
documented fallback behavior. Avoid describing codec failures as fail-closed.
🪄 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: 35a02311-437b-4793-8597-7d875dbcc223

📥 Commits

Reviewing files that changed from the base of the PR and between 0dd056f and c913cb2.

📒 Files selected for processing (32)
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/stream.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • crates/core/tests/integration/subscriber_dispatcher_tests.rs
  • crates/core/tests/unit/dynamic_worker_tests.rs
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/ffi/tests/unit/api/registry_tests.rs
  • crates/node/src/api/mod.rs
  • crates/node/src/callable.rs
  • crates/node/tests/event_sanitizers_tests.mjs
  • crates/node/tests/llm_tests.mjs
  • crates/node/tests/tools_tests.mjs
  • crates/python/src/py_callable.rs
  • docs/about-nemo-relay/concepts/middleware.mdx
  • docs/about-nemo-relay/release-notes/index.mdx
  • docs/build-plugins/dynamic-plugins/native-dynamic/about.mdx
  • docs/instrument-applications/advanced-guide.mdx
  • docs/reference/event-sanitizers.mdx
  • docs/reference/migration-guides.mdx
  • go/nemo_relay/event_sanitizers_test.go
  • python/nemo_relay/__init__.py
  • python/nemo_relay/__init__.pyi
  • python/nemo_relay/llm.py
  • python/nemo_relay/tools.py
  • python/tests/test_event_sanitizers.py
  • python/tests/test_llm.py
  • python/tests/test_tools.py
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: Check / Run
  • GitHub Check: Preview docs
🧰 Additional context used
📓 Path-based instructions (43)
crates/node/**/*.{js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use camelCase for Node.js public APIs.

Files:

  • crates/node/tests/tools_tests.mjs
  • crates/node/tests/llm_tests.mjs
  • crates/node/tests/event_sanitizers_tests.mjs
**/*.{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/node/tests/tools_tests.mjs
  • crates/ffi/tests/unit/api/registry_tests.rs
  • python/nemo_relay/tools.py
  • crates/core/tests/integration/native_plugin_tests.rs
  • python/tests/test_event_sanitizers.py
  • crates/node/tests/llm_tests.mjs
  • crates/core/src/stream.rs
  • crates/core/src/api/llm.rs
  • python/nemo_relay/__init__.py
  • python/tests/test_tools.py
  • crates/core/tests/integration/subscriber_dispatcher_tests.rs
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/node/src/callable.rs
  • python/nemo_relay/llm.py
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/api/tool.rs
  • crates/node/src/api/mod.rs
  • python/tests/test_llm.py
  • crates/node/tests/event_sanitizers_tests.mjs
  • crates/core/tests/unit/dynamic_worker_tests.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/python/src/py_callable.rs
  • crates/core/src/api/runtime/state.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/node/tests/tools_tests.mjs
  • crates/ffi/tests/unit/api/registry_tests.rs
  • docs/instrument-applications/advanced-guide.mdx
  • python/nemo_relay/tools.py
  • crates/core/tests/integration/native_plugin_tests.rs
  • python/tests/test_event_sanitizers.py
  • docs/about-nemo-relay/concepts/middleware.mdx
  • docs/reference/event-sanitizers.mdx
  • crates/node/tests/llm_tests.mjs
  • crates/core/src/stream.rs
  • crates/core/src/api/llm.rs
  • python/nemo_relay/__init__.py
  • python/tests/test_tools.py
  • crates/core/tests/integration/subscriber_dispatcher_tests.rs
  • go/nemo_relay/event_sanitizers_test.go
  • docs/reference/migration-guides.mdx
  • python/nemo_relay/__init__.pyi
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/node/src/callable.rs
  • python/nemo_relay/llm.py
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/src/api/shared.rs
  • docs/build-plugins/dynamic-plugins/native-dynamic/about.mdx
  • crates/core/src/api/tool.rs
  • crates/node/src/api/mod.rs
  • python/tests/test_llm.py
  • crates/node/tests/event_sanitizers_tests.mjs
  • crates/core/tests/unit/dynamic_worker_tests.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/python/src/py_callable.rs
  • docs/about-nemo-relay/release-notes/index.mdx
  • crates/core/src/api/runtime/state.rs
crates/{python,ffi,node}/**/*

⚙️ CodeRabbit configuration file

crates/{python,ffi,node}/**/*: Treat binding changes as public API changes. Check for parity with the other language bindings, FFI ownership/lifetime safety,
callback error propagation, stable type conversion, and consistent async/stream semantics.
Flag changes that update one binding without corresponding tests or documentation for the same surface elsewhere.

Files:

  • crates/node/tests/tools_tests.mjs
  • crates/ffi/tests/unit/api/registry_tests.rs
  • crates/node/tests/llm_tests.mjs
  • crates/node/src/callable.rs
  • crates/node/src/api/mod.rs
  • crates/node/tests/event_sanitizers_tests.mjs
  • crates/python/src/py_callable.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/node/tests/tools_tests.mjs
  • crates/ffi/tests/unit/api/registry_tests.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • python/tests/test_event_sanitizers.py
  • crates/node/tests/llm_tests.mjs
  • python/tests/test_tools.py
  • crates/core/tests/integration/subscriber_dispatcher_tests.rs
  • go/nemo_relay/event_sanitizers_test.go
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • python/tests/test_llm.py
  • crates/node/tests/event_sanitizers_tests.mjs
  • crates/core/tests/unit/dynamic_worker_tests.rs
**/*.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/ffi/tests/unit/api/registry_tests.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • crates/core/src/stream.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/integration/subscriber_dispatcher_tests.rs
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/node/src/callable.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/api/tool.rs
  • crates/node/src/api/mod.rs
  • crates/core/tests/unit/dynamic_worker_tests.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/python/src/py_callable.rs
  • crates/core/src/api/runtime/state.rs
crates/ffi/**

📄 CodeRabbit inference engine (.agents/skills/test-ffi-surface/SKILL.md)

Rebuild the FFI crate in release mode so the shared library and header stay in sync when making changes to crates/ffi

Files:

  • crates/ffi/tests/unit/api/registry_tests.rs
crates/ffi/**/*.rs

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

If the change touched crates/ffi, also use test-ffi-surface for validation

Use C FFI export names prefixed with nemo_relay_ in the raw C FFI layer.

Files:

  • crates/ffi/tests/unit/api/registry_tests.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • crates/ffi/tests/unit/api/registry_tests.rs
  • python/nemo_relay/tools.py
  • crates/core/tests/integration/native_plugin_tests.rs
  • python/tests/test_event_sanitizers.py
  • crates/core/src/stream.rs
  • crates/core/src/api/llm.rs
  • python/nemo_relay/__init__.py
  • python/tests/test_tools.py
  • crates/core/tests/integration/subscriber_dispatcher_tests.rs
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/node/src/callable.rs
  • python/nemo_relay/llm.py
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/api/tool.rs
  • crates/node/src/api/mod.rs
  • python/tests/test_llm.py
  • crates/core/tests/unit/dynamic_worker_tests.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/python/src/py_callable.rs
  • crates/core/src/api/runtime/state.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/ffi/tests/unit/api/registry_tests.rs
  • python/nemo_relay/tools.py
  • crates/core/tests/integration/native_plugin_tests.rs
  • python/tests/test_event_sanitizers.py
  • crates/core/src/stream.rs
  • crates/core/src/api/llm.rs
  • python/nemo_relay/__init__.py
  • python/tests/test_tools.py
  • crates/core/tests/integration/subscriber_dispatcher_tests.rs
  • go/nemo_relay/event_sanitizers_test.go
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/node/src/callable.rs
  • python/nemo_relay/llm.py
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/api/tool.rs
  • crates/node/src/api/mod.rs
  • python/tests/test_llm.py
  • crates/core/tests/unit/dynamic_worker_tests.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/python/src/py_callable.rs
  • crates/core/src/api/runtime/state.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/ffi/tests/unit/api/registry_tests.rs
  • crates/core/tests/integration/native_plugin_tests.rs
  • crates/core/src/stream.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/integration/subscriber_dispatcher_tests.rs
  • go/nemo_relay/event_sanitizers_test.go
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/node/src/callable.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/api/tool.rs
  • crates/node/src/api/mod.rs
  • crates/core/tests/unit/dynamic_worker_tests.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/python/src/py_callable.rs
  • crates/core/src/api/runtime/state.rs
**/*.{rs,py,go,js,ts}

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

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

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

Files:

  • crates/ffi/tests/unit/api/registry_tests.rs
  • python/nemo_relay/tools.py
  • crates/core/tests/integration/native_plugin_tests.rs
  • python/tests/test_event_sanitizers.py
  • crates/core/src/stream.rs
  • crates/core/src/api/llm.rs
  • python/nemo_relay/__init__.py
  • python/tests/test_tools.py
  • crates/core/tests/integration/subscriber_dispatcher_tests.rs
  • go/nemo_relay/event_sanitizers_test.go
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/node/src/callable.rs
  • python/nemo_relay/llm.py
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/api/tool.rs
  • crates/node/src/api/mod.rs
  • python/tests/test_llm.py
  • crates/core/tests/unit/dynamic_worker_tests.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/python/src/py_callable.rs
  • crates/core/src/api/runtime/state.rs
**/*.{rs,py,js,ts,tsx,go,java,kt,swift}

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

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

Files:

  • crates/ffi/tests/unit/api/registry_tests.rs
  • python/nemo_relay/tools.py
  • crates/core/tests/integration/native_plugin_tests.rs
  • python/tests/test_event_sanitizers.py
  • crates/core/src/stream.rs
  • crates/core/src/api/llm.rs
  • python/nemo_relay/__init__.py
  • python/tests/test_tools.py
  • crates/core/tests/integration/subscriber_dispatcher_tests.rs
  • go/nemo_relay/event_sanitizers_test.go
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/node/src/callable.rs
  • python/nemo_relay/llm.py
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/api/tool.rs
  • crates/node/src/api/mod.rs
  • python/tests/test_llm.py
  • crates/core/tests/unit/dynamic_worker_tests.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/python/src/py_callable.rs
  • crates/core/src/api/runtime/state.rs
**/*.mdx

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

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

In MDX files, top-of-file comments must use JSX comment delimiters ({/* to open and */} to close); do not use HTML comments for MDX SPDX headers

Files:

  • docs/instrument-applications/advanced-guide.mdx
  • docs/about-nemo-relay/concepts/middleware.mdx
  • docs/reference/event-sanitizers.mdx
  • docs/reference/migration-guides.mdx
  • docs/build-plugins/dynamic-plugins/native-dynamic/about.mdx
  • docs/about-nemo-relay/release-notes/index.mdx
**/*.{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:

  • docs/instrument-applications/advanced-guide.mdx
  • docs/about-nemo-relay/concepts/middleware.mdx
  • docs/reference/event-sanitizers.mdx
  • docs/reference/migration-guides.mdx
  • docs/build-plugins/dynamic-plugins/native-dynamic/about.mdx
  • docs/about-nemo-relay/release-notes/index.mdx
**/*.{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:

  • docs/instrument-applications/advanced-guide.mdx
  • docs/about-nemo-relay/concepts/middleware.mdx
  • docs/reference/event-sanitizers.mdx
  • docs/reference/migration-guides.mdx
  • docs/build-plugins/dynamic-plugins/native-dynamic/about.mdx
  • docs/about-nemo-relay/release-notes/index.mdx
{docs,examples}/**/*

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

Update docs and examples.

Files:

  • docs/instrument-applications/advanced-guide.mdx
  • docs/about-nemo-relay/concepts/middleware.mdx
  • docs/reference/event-sanitizers.mdx
  • docs/reference/migration-guides.mdx
  • docs/build-plugins/dynamic-plugins/native-dynamic/about.mdx
  • docs/about-nemo-relay/release-notes/index.mdx
docs/**/*

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

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

Files:

  • docs/instrument-applications/advanced-guide.mdx
  • docs/about-nemo-relay/concepts/middleware.mdx
  • docs/reference/event-sanitizers.mdx
  • docs/reference/migration-guides.mdx
  • docs/build-plugins/dynamic-plugins/native-dynamic/about.mdx
  • docs/about-nemo-relay/release-notes/index.mdx
**/*.{md,mdx,py,go,js,ts}

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

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

Files:

  • docs/instrument-applications/advanced-guide.mdx
  • python/nemo_relay/tools.py
  • python/tests/test_event_sanitizers.py
  • docs/about-nemo-relay/concepts/middleware.mdx
  • docs/reference/event-sanitizers.mdx
  • python/nemo_relay/__init__.py
  • python/tests/test_tools.py
  • go/nemo_relay/event_sanitizers_test.go
  • docs/reference/migration-guides.mdx
  • python/nemo_relay/llm.py
  • docs/build-plugins/dynamic-plugins/native-dynamic/about.mdx
  • python/tests/test_llm.py
  • docs/about-nemo-relay/release-notes/index.mdx
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}

⚙️ CodeRabbit configuration file

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

Files:

  • docs/instrument-applications/advanced-guide.mdx
  • docs/about-nemo-relay/concepts/middleware.mdx
  • docs/reference/event-sanitizers.mdx
  • docs/reference/migration-guides.mdx
  • docs/build-plugins/dynamic-plugins/native-dynamic/about.mdx
  • docs/about-nemo-relay/release-notes/index.mdx
python/nemo_relay/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Python wrapper modules live under python/nemo_relay/, and the native extension is built from crates/python with maturin.

Files:

  • python/nemo_relay/tools.py
  • python/nemo_relay/__init__.py
  • python/nemo_relay/llm.py
**/*.py

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.py: When changing the Python wrapper package, tests, or docs tooling, lint with Ruff (E, F, W, I), format with Ruff formatter (120-character lines, double quotes), and pass ty type checking.
Add the SPDX license header to all Python source files using the # comment form.

Files:

  • python/nemo_relay/tools.py
  • python/tests/test_event_sanitizers.py
  • python/nemo_relay/__init__.py
  • python/tests/test_tools.py
  • python/nemo_relay/llm.py
  • python/tests/test_llm.py
{crates/python/src/py_api/mod.rs,python/nemo_relay/**/*.py,python/nemo_relay/**/*.pyi,go/nemo_relay/**/*.go,crates/node/src/api/**/*.rs}

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

Update the language-native bindings for every exposed surface in Python, Go, and Node.js.

Files:

  • python/nemo_relay/tools.py
  • python/nemo_relay/__init__.py
  • go/nemo_relay/event_sanitizers_test.go
  • python/nemo_relay/__init__.pyi
  • python/nemo_relay/llm.py
  • crates/node/src/api/mod.rs
{python/nemo_relay/**/*.py,python/nemo_relay/**/*.pyi,go/nemo_relay/**/*.go}

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

Update language wrapper helpers such as Python wrapper modules, Python type stubs, and Go shorthand packages when the new behavior belongs in those helper layers.

Files:

  • python/nemo_relay/tools.py
  • python/nemo_relay/__init__.py
  • go/nemo_relay/event_sanitizers_test.go
  • python/nemo_relay/__init__.pyi
  • python/nemo_relay/llm.py
{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:

  • python/nemo_relay/tools.py
  • python/tests/test_event_sanitizers.py
  • crates/core/src/stream.rs
  • crates/core/src/api/llm.rs
  • python/nemo_relay/__init__.py
  • python/tests/test_tools.py
  • crates/node/src/callable.rs
  • python/nemo_relay/llm.py
  • crates/core/src/api/shared.rs
  • crates/core/src/api/tool.rs
  • crates/node/src/api/mod.rs
  • python/tests/test_llm.py
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/python/src/py_callable.rs
  • crates/core/src/api/runtime/state.rs
python/nemo_relay/**/*

⚙️ CodeRabbit configuration file

python/nemo_relay/**/*: Review Python wrapper changes for typed API consistency, contextvars-based scope isolation, async behavior, and parity with the native extension.
Stubs and runtime implementations should stay aligned.

Files:

  • python/nemo_relay/tools.py
  • python/nemo_relay/__init__.py
  • python/nemo_relay/__init__.pyi
  • python/nemo_relay/llm.py
{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/integration/native_plugin_tests.rs
  • crates/core/src/stream.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/integration/subscriber_dispatcher_tests.rs
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/api/tool.rs
  • crates/core/tests/unit/dynamic_worker_tests.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/core/src/api/runtime/state.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

Files:

  • crates/core/tests/integration/native_plugin_tests.rs
  • crates/core/src/stream.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/integration/subscriber_dispatcher_tests.rs
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/api/tool.rs
  • crates/core/tests/unit/dynamic_worker_tests.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/core/src/api/runtime/state.rs
crates/{core,adaptive}/**/*

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

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

Files:

  • crates/core/tests/integration/native_plugin_tests.rs
  • crates/core/src/stream.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/integration/subscriber_dispatcher_tests.rs
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/api/tool.rs
  • crates/core/tests/unit/dynamic_worker_tests.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/core/src/api/runtime/state.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/integration/native_plugin_tests.rs
  • crates/core/src/stream.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/integration/subscriber_dispatcher_tests.rs
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/api/tool.rs
  • crates/core/tests/unit/dynamic_worker_tests.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/core/src/api/runtime/state.rs
python/tests/**/*.py

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

python/tests/**/*.py: Pytest is used to run tests.
Do not add @pytest.mark.asyncio to any test; async tests are automatically detected and run by the async runner.
Do not add a -> None return type annotation to test functions.
When mocking a class, do not define a new class; use unittest.mock.MagicMock or unittest.mock.AsyncMock, with the spec constructor argument when necessary.
Name mocked classes with the mock prefix, not fake.
Prefer pytest fixtures over helper methods.
Do not repeat fixtures; if a fixture is needed in multiple test files, place it in a conftest.py file.
When creating a fixture, use @pytest.fixture(name="<fixture_name>"[, scope="<scope>"]) and define the fixture function as def <fixture_name>_fixture() -> <return_type>:; only specify scope when it is not function.
Prefer pytest.mark.parametrize over creating individual tests for different input types.

Files:

  • python/tests/test_event_sanitizers.py
  • python/tests/test_tools.py
  • python/tests/test_llm.py
crates/core/src/{api/**/*.rs,api/runtime/**/*.rs,codec/**/*.rs,json.rs}

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

Implement the new or changed public runtime behavior first in the Rust core, especially under crates/core/src/api/ and related core modules such as crates/core/src/api/runtime/, crates/core/src/codec/, and crates/core/src/json.rs.

Files:

  • crates/core/src/api/llm.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/core/src/api/runtime/state.rs
crates/core/src/api/{tool,llm,shared,scope}.rs

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

Wire the new middleware chain into the appropriate lifecycle owner and pipeline stage: tool and LLM execution paths use tool.rs or llm.rs; shared mark and scope event sanitization uses shared.rs and is called from scope.rs.

Files:

  • crates/core/src/api/llm.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/api/tool.rs
crates/core/src/api/**/*.rs

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

Preserve the documented pipeline order: conditional guardrails, request intercepts, request sanitization, execution intercepts, and response sanitization for tool and LLM execution; specialized sanitization, event creation, and dispatch for mark and scope events.

Files:

  • crates/core/src/api/llm.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/core/src/api/runtime/state.rs
go/nemo_relay/**/*.go

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

go/nemo_relay/**/*.go: Format changed Go packages with cd go/nemo_relay && go fmt ./...
Run Go tests with just test-go to build and test the NeMo Relay Go binding
Use just build-go when you want an explicit build-only pass or need the artifact for other work
Use just ci=true test-go when you need the CI-style coverage and JUnit path
On macOS, set DYLD_LIBRARY_PATH to the ../../target/release directory before running the raw go test command directly

Use PascalCase for public Go APIs.

Files:

  • go/nemo_relay/event_sanitizers_test.go
**/*.go

📄 CodeRabbit inference engine (CONTRIBUTING.md)

When changing the experimental Go binding, format Go code with gofmt and keep go vet ./... passing.

Files:

  • go/nemo_relay/event_sanitizers_test.go
go/nemo_relay/**

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

Keep shared plugin helpers in go/nemo_relay aligned with plugin registration, composition, and lifecycle behavior.

Files:

  • go/nemo_relay/event_sanitizers_test.go
go/nemo_relay/**/*

⚙️ CodeRabbit configuration file

go/nemo_relay/**/*: Review Go binding changes for cgo memory ownership, race safety, callback cleanup, idiomatic exported APIs, and parity with Rust/FFI behavior.
Any API change should include focused Go tests and consider race-test behavior.

Files:

  • go/nemo_relay/event_sanitizers_test.go
{crates/core/src/plugin/dynamic/**,crates/plugin/**,crates/worker/**,crates/worker-proto/**,crates/types/**,python/plugin/**,examples/rust-native-plugin/**,examples/python-grpc-worker-plugin/**,docs/build-plugins/**}

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

Keep the stable boundary explicit: native plugins cross a C ABI, and worker plugins cross grpc-v1.

Files:

  • docs/build-plugins/dynamic-plugins/native-dynamic/about.mdx
{crates/core/src/plugin/dynamic/**,examples/rust-native-plugin/**,examples/python-grpc-worker-plugin/**,docs/build-plugins/**}

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

Native and worker plugins are trusted extensions; document that native plugins are in-process and unsandboxed, and worker plugins provide process isolation but not a security sandbox.

Files:

  • docs/build-plugins/dynamic-plugins/native-dynamic/about.mdx
{docs/build-plugins/**,examples/rust-native-plugin/**,examples/python-grpc-worker-plugin/**}

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

When detailed dynamic plugin guides exist, keep Rust native, Python worker, and grpc-v1 protocol details on separate pages.

Files:

  • docs/build-plugins/dynamic-plugins/native-dynamic/about.mdx
docs/about-nemo-relay/release-notes/{index,highlights,known-issues}.mdx

📄 CodeRabbit inference engine (.agents/skills/draft-release-notes/SKILL.md)

docs/about-nemo-relay/release-notes/{index,highlights,known-issues}.mdx: Update only docs/about-nemo-relay/release-notes/index.mdx, docs/about-nemo-relay/release-notes/highlights.mdx, and docs/about-nemo-relay/release-notes/known-issues.mdx unless the release changes their route or entry points.
Preserve the existing MDX front matter and the JSX SPDX comment in the release-notes pages.

Files:

  • docs/about-nemo-relay/release-notes/index.mdx
crates/core/src/api/runtime/state.rs

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

crates/core/src/api/runtime/state.rs: Add a SortedRegistry<GuardrailEntry<...>> or SortedRegistry<Intercept<...>> field to NemoRelayContextState for the new middleware type.
Add chain-execution helpers to NemoRelayContextState, following existing helpers such as tool_sanitize_request_chain or tool_request_intercepts_chain.

Files:

  • crates/core/src/api/runtime/state.rs
🧠 Learnings (4)
📚 Learning: 2026-07-28T20:07:29.880Z
Learnt from: willkill07
Repo: NVIDIA/NeMo-Relay PR: 571
File: crates/core/src/api/runtime/state.rs:996-1020
Timestamp: 2026-07-28T20:07:29.880Z
Learning: In NeMo Relay (RELAY-509), sanitizer callback failures must be treated as intentional fail-open behavior. When an event/tool (request/response) or LLM (request/response) sanitizer callback fails, the sanitizer chain should retain and publish the last valid event/payload snapshot (rather than dropping/invalidating the data) and log the failure including callback context (e.g., which sanitizer/callback failed and relevant identifiers). Apply this consistently across all sanitizer chains mentioned in the RELAY-509 documentation/migration guide.

Applied to files:

  • crates/core/src/stream.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/shared.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/core/src/api/runtime/state.rs
📚 Learning: 2026-07-28T20:33:25.156Z
Learnt from: willkill07
Repo: NVIDIA/NeMo-Relay PR: 572
File: go/nemo_relay/adaptive_runtime_test.go:214-238
Timestamp: 2026-07-28T20:33:25.156Z
Learning: When adding/adjusting Go unit tests for `BuildCacheRequestFacts` (request-ID validation and related request parsing), set `CacheRequestFactsInput.Provider` to a valid provider in all tests that are intended to isolate request-ID behavior—because `BuildCacheRequestFacts` does not validate `Provider`. Then add separate test coverage for malformed `AnnotatedRequest` JSON so JSON parsing failures are not conflated with `Provider`-related inputs.

Applied to files:

  • go/nemo_relay/event_sanitizers_test.go
📚 Learning: 2026-07-28T23:57:11.641Z
Learnt from: willkill07
Repo: NVIDIA/NeMo-Relay PR: 570
File: crates/node/src/api/mod.rs:3265-3282
Timestamp: 2026-07-28T23:57:11.641Z
Learning: In the Node.js binding, `flushSubscribers()` is Promise-based/async and must be awaited. Any session-close or teardown path (e.g., the OpenClaw live smoke session-close flow) must await `flushSubscribers()` before continuing to live ATIF export assertions and before teardown, so queued subscriber delivery fully completes and tests/assertions observe the final state.

Applied to files:

  • crates/node/src/api/mod.rs
📚 Learning: 2026-07-28T03:31:05.964Z
Learnt from: willkill07
Repo: NVIDIA/NeMo-Relay PR: 564
File: crates/core/src/api/runtime/subscriber_dispatcher.rs:297-314
Timestamp: 2026-07-28T03:31:05.964Z
Learning: In this codebase’s runtime API, do not implement incremental native LLM stream forwarding via the native ABI v3 asynchronous middleware protocol (it can only settle a single JSON value via a one-shot completion handle and cannot forward stream chunks incrementally). If a latency-sensitive plugin needs streaming behavior, review for use of synchronous native stream intercepts or worker plugins instead of trying to chunk-deliver or incrementally forward over the ABI v3 async path.

Applied to files:

  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/core/src/api/runtime/state.rs
🪛 Ruff (0.16.0)
python/tests/test_event_sanitizers.py

[warning] 66-66: Avoid specifying long messages outside the exception class

(TRY003)

🔇 Additional comments (29)
docs/about-nemo-relay/concepts/middleware.mdx (1)

196-197: LGTM!

docs/about-nemo-relay/release-notes/index.mdx (1)

39-41: LGTM!

docs/build-plugins/dynamic-plugins/native-dynamic/about.mdx (1)

246-248: LGTM!

docs/instrument-applications/advanced-guide.mdx (1)

205-206: LGTM!

docs/reference/event-sanitizers.mdx (1)

55-61: LGTM!

Also applies to: 84-84

docs/reference/migration-guides.mdx (1)

119-121: LGTM!

Also applies to: 222-223

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

23-25: LGTM!

Also applies to: 814-835, 868-899, 932-963, 1265-1275, 1332-1342

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

6-6: LGTM!

Also applies to: 970-971, 1040-1045, 1062-1066

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

8-8: LGTM!

Also applies to: 64-70, 80-86

crates/core/src/stream.rs (1)

240-282: LGTM!

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

709-710: LGTM!

Also applies to: 933-940

crates/node/src/api/mod.rs (1)

2822-2826: Await flushSubscribers() before checking publication results.

The existing review comment at this range covers this unresolved documentation gap.

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

248-249: LGTM!

Also applies to: 322-322, 380-380, 436-437, 486-492, 535-541

crates/python/src/py_callable.rs (1)

840-850: LGTM!

Also applies to: 1348-1368, 1673-1688, 1817-1835

crates/node/src/callable.rs (1)

575-575: LGTM!

python/nemo_relay/tools.py (1)

130-130: LGTM!

crates/core/tests/unit/runtime_state_tests.rs (1)

12-12: Duplicate: assert that sanitizer chains stop after failure.

Each sanitizer chain still registers only the failing callback. The assertions prove field clearing and None results, but they do not prove that later callbacks are skipped. Add a second callback that records invocation and assert that it remains uncalled for the event, tool, and LLM sanitizer chains.

As per coding guidelines, tests must cover callback failure policy. As per path instructions, tests should cover error paths.

Also applies to: 29-30, 43-43, 59-59, 76-76, 92-92

Sources: Coding guidelines, Path instructions

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

935-935: LGTM!

Also applies to: 976-977

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

371-385: LGTM!

Also applies to: 410-414, 444-444, 481-481

crates/core/tests/unit/dynamic_worker_tests.rs (1)

1577-1578: LGTM!

Also applies to: 1588-1588, 1597-1597, 1606-1606, 1615-1615

crates/core/tests/unit/subscriber_dispatcher_tests.rs (1)

535-535: LGTM!

Also applies to: 544-546

crates/node/tests/event_sanitizers_tests.mjs (1)

34-38: LGTM!

Also applies to: 370-370, 398-398, 426-426, 456-464, 483-483, 552-552, 577-577

crates/node/tests/llm_tests.mjs (1)

834-834: LGTM!

Also applies to: 852-852, 947-947, 965-965

crates/node/tests/tools_tests.mjs (1)

683-683: LGTM!

Also applies to: 700-700

python/tests/test_event_sanitizers.py (2)

62-65: LGTM!

Also applies to: 67-78


66-66: 📐 Maintainability & Code Quality

Confirm the Ruff TRY003 configuration before changing this test.

Ruff reports TRY003 for raise RuntimeError("sanitize boom") at Line 66. The stated Python lint contract selects only E, F, W, and I. Verify whether TRY003 is enabled. If it is enabled, move the message into a custom exception or add a narrow suppression.

Source: Linters/SAST tools

python/tests/test_llm.py (1)

363-363: LGTM!

Also applies to: 386-389, 411-415, 433-437, 455-456

python/tests/test_tools.py (1)

279-279: LGTM!

Also applies to: 296-298, 315-315

go/nemo_relay/event_sanitizers_test.go (1)

28-28: LGTM!

Also applies to: 53-56

Comment thread crates/core/tests/unit/subscriber_dispatcher_tests.rs
Comment thread crates/ffi/tests/unit/api/registry_tests.rs
Comment thread crates/node/src/api/mod.rs
Comment thread python/nemo_relay/__init__.py
Comment thread python/nemo_relay/llm.py

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

LGTM!

Signed-off-by: Will Killian <wkillian@nvidia.com>

@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: 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/core/tests/unit/runtime_state_tests.rs`:
- Around line 27-43: Seed the asserted fields before sanitizer failures: in
crates/core/tests/unit/runtime_state_tests.rs lines 27-43, add a successful
sanitizer before the panicking sanitizer that sets category_profile, then assert
category_profile is cleared; in python/tests/test_event_sanitizers.py lines
79-87, pass non-empty metadata to scope.event and retain the assertion that
emitted metadata is None.
🪄 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: 87a2d6ba-e6d0-4c43-847e-bfd3611fa7d7

📥 Commits

Reviewing files that changed from the base of the PR and between c913cb2 and c39d11f.

📒 Files selected for processing (7)
  • crates/core/src/api/runtime/state.rs
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/node/src/api/mod.rs
  • go/nemo_relay/event_sanitizers_test.go
  • python/nemo_relay/__init__.py
  • python/nemo_relay/__init__.pyi
  • python/tests/test_event_sanitizers.py
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: Check / Run
  • GitHub Check: Preview docs
🧰 Additional context used
📓 Path-based instructions (29)
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • python/nemo_relay/__init__.py
  • crates/core/tests/unit/runtime_state_tests.rs
  • python/tests/test_event_sanitizers.py
  • crates/node/src/api/mod.rs
  • crates/core/src/api/runtime/state.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:

  • python/nemo_relay/__init__.py
  • crates/core/tests/unit/runtime_state_tests.rs
  • python/tests/test_event_sanitizers.py
  • crates/node/src/api/mod.rs
  • crates/core/src/api/runtime/state.rs
python/nemo_relay/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Python wrapper modules live under python/nemo_relay/, and the native extension is built from crates/python with maturin.

Files:

  • python/nemo_relay/__init__.py
**/*.py

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.py: When changing the Python wrapper package, tests, or docs tooling, lint with Ruff (E, F, W, I), format with Ruff formatter (120-character lines, double quotes), and pass ty type checking.
Add the SPDX license header to all Python source files using the # comment form.

Files:

  • python/nemo_relay/__init__.py
  • python/tests/test_event_sanitizers.py
**/*.{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:

  • python/nemo_relay/__init__.py
  • go/nemo_relay/event_sanitizers_test.go
  • crates/core/tests/unit/runtime_state_tests.rs
  • python/tests/test_event_sanitizers.py
  • crates/node/src/api/mod.rs
  • crates/core/src/api/runtime/state.rs
{crates/python/src/py_api/mod.rs,python/nemo_relay/**/*.py,python/nemo_relay/**/*.pyi,go/nemo_relay/**/*.go,crates/node/src/api/**/*.rs}

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

Update the language-native bindings for every exposed surface in Python, Go, and Node.js.

Files:

  • python/nemo_relay/__init__.py
  • go/nemo_relay/event_sanitizers_test.go
  • crates/node/src/api/mod.rs
  • python/nemo_relay/__init__.pyi
{python/nemo_relay/**/*.py,python/nemo_relay/**/*.pyi,go/nemo_relay/**/*.go}

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

Update language wrapper helpers such as Python wrapper modules, Python type stubs, and Go shorthand packages when the new behavior belongs in those helper layers.

Files:

  • python/nemo_relay/__init__.py
  • go/nemo_relay/event_sanitizers_test.go
  • python/nemo_relay/__init__.pyi
{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:

  • python/nemo_relay/__init__.py
  • python/tests/test_event_sanitizers.py
  • crates/node/src/api/mod.rs
  • crates/core/src/api/runtime/state.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:

  • python/nemo_relay/__init__.py
  • go/nemo_relay/event_sanitizers_test.go
  • crates/core/tests/unit/runtime_state_tests.rs
  • python/tests/test_event_sanitizers.py
  • crates/node/src/api/mod.rs
  • python/nemo_relay/__init__.pyi
  • crates/core/src/api/runtime/state.rs
**/*.{rs,py,go,js,ts}

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

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

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

Files:

  • python/nemo_relay/__init__.py
  • go/nemo_relay/event_sanitizers_test.go
  • crates/core/tests/unit/runtime_state_tests.rs
  • python/tests/test_event_sanitizers.py
  • crates/node/src/api/mod.rs
  • crates/core/src/api/runtime/state.rs
**/*.{rs,py,js,ts,tsx,go,java,kt,swift}

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

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

Files:

  • python/nemo_relay/__init__.py
  • go/nemo_relay/event_sanitizers_test.go
  • crates/core/tests/unit/runtime_state_tests.rs
  • python/tests/test_event_sanitizers.py
  • crates/node/src/api/mod.rs
  • crates/core/src/api/runtime/state.rs
**/*.{md,mdx,py,go,js,ts}

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

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

Files:

  • python/nemo_relay/__init__.py
  • go/nemo_relay/event_sanitizers_test.go
  • python/tests/test_event_sanitizers.py
python/nemo_relay/**/*

⚙️ CodeRabbit configuration file

python/nemo_relay/**/*: Review Python wrapper changes for typed API consistency, contextvars-based scope isolation, async behavior, and parity with the native extension.
Stubs and runtime implementations should stay aligned.

Files:

  • python/nemo_relay/__init__.py
  • python/nemo_relay/__init__.pyi
go/nemo_relay/**/*.go

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

go/nemo_relay/**/*.go: Format changed Go packages with cd go/nemo_relay && go fmt ./...
Run Go tests with just test-go to build and test the NeMo Relay Go binding
Use just build-go when you want an explicit build-only pass or need the artifact for other work
Use just ci=true test-go when you need the CI-style coverage and JUnit path
On macOS, set DYLD_LIBRARY_PATH to the ../../target/release directory before running the raw go test command directly

Use PascalCase for public Go APIs.

Files:

  • go/nemo_relay/event_sanitizers_test.go
**/*.go

📄 CodeRabbit inference engine (CONTRIBUTING.md)

When changing the experimental Go binding, format Go code with gofmt and keep go vet ./... passing.

Files:

  • go/nemo_relay/event_sanitizers_test.go
**/*.{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:

  • go/nemo_relay/event_sanitizers_test.go
  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/node/src/api/mod.rs
  • crates/core/src/api/runtime/state.rs
go/nemo_relay/**

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

Keep shared plugin helpers in go/nemo_relay aligned with plugin registration, composition, and lifecycle behavior.

Files:

  • go/nemo_relay/event_sanitizers_test.go
go/nemo_relay/**/*

⚙️ CodeRabbit configuration file

go/nemo_relay/**/*: Review Go binding changes for cgo memory ownership, race safety, callback cleanup, idiomatic exported APIs, and parity with Rust/FFI behavior.
Any API change should include focused Go tests and consider race-test behavior.

Files:

  • go/nemo_relay/event_sanitizers_test.go
{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:

  • go/nemo_relay/event_sanitizers_test.go
  • crates/core/tests/unit/runtime_state_tests.rs
  • python/tests/test_event_sanitizers.py
**/*.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/core/tests/unit/runtime_state_tests.rs
  • crates/node/src/api/mod.rs
  • crates/core/src/api/runtime/state.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/runtime_state_tests.rs
  • crates/core/src/api/runtime/state.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

Files:

  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/core/src/api/runtime/state.rs
crates/{core,adaptive}/**/*

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

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

Files:

  • crates/core/tests/unit/runtime_state_tests.rs
  • crates/core/src/api/runtime/state.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/runtime_state_tests.rs
  • crates/core/src/api/runtime/state.rs
python/tests/**/*.py

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

python/tests/**/*.py: Pytest is used to run tests.
Do not add @pytest.mark.asyncio to any test; async tests are automatically detected and run by the async runner.
Do not add a -> None return type annotation to test functions.
When mocking a class, do not define a new class; use unittest.mock.MagicMock or unittest.mock.AsyncMock, with the spec constructor argument when necessary.
Name mocked classes with the mock prefix, not fake.
Prefer pytest fixtures over helper methods.
Do not repeat fixtures; if a fixture is needed in multiple test files, place it in a conftest.py file.
When creating a fixture, use @pytest.fixture(name="<fixture_name>"[, scope="<scope>"]) and define the fixture function as def <fixture_name>_fixture() -> <return_type>:; only specify scope when it is not function.
Prefer pytest.mark.parametrize over creating individual tests for different input types.

Files:

  • python/tests/test_event_sanitizers.py
crates/{python,ffi,node}/**/*

⚙️ CodeRabbit configuration file

crates/{python,ffi,node}/**/*: Treat binding changes as public API changes. Check for parity with the other language bindings, FFI ownership/lifetime safety,
callback error propagation, stable type conversion, and consistent async/stream semantics.
Flag changes that update one binding without corresponding tests or documentation for the same surface elsewhere.

Files:

  • crates/node/src/api/mod.rs
crates/core/src/{api/**/*.rs,api/runtime/**/*.rs,codec/**/*.rs,json.rs}

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

Implement the new or changed public runtime behavior first in the Rust core, especially under crates/core/src/api/ and related core modules such as crates/core/src/api/runtime/, crates/core/src/codec/, and crates/core/src/json.rs.

Files:

  • crates/core/src/api/runtime/state.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 a SortedRegistry<GuardrailEntry<...>> or SortedRegistry<Intercept<...>> field to NemoRelayContextState for the new middleware type.
Add chain-execution helpers to NemoRelayContextState, following existing helpers such as tool_sanitize_request_chain or tool_request_intercepts_chain.

Files:

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

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

Preserve the documented pipeline order: conditional guardrails, request intercepts, request sanitization, execution intercepts, and response sanitization for tool and LLM execution; specialized sanitization, event creation, and dispatch for mark and scope events.

Files:

  • crates/core/src/api/runtime/state.rs
🧠 Learnings (4)
📚 Learning: 2026-07-28T20:33:25.156Z
Learnt from: willkill07
Repo: NVIDIA/NeMo-Relay PR: 572
File: go/nemo_relay/adaptive_runtime_test.go:214-238
Timestamp: 2026-07-28T20:33:25.156Z
Learning: When adding/adjusting Go unit tests for `BuildCacheRequestFacts` (request-ID validation and related request parsing), set `CacheRequestFactsInput.Provider` to a valid provider in all tests that are intended to isolate request-ID behavior—because `BuildCacheRequestFacts` does not validate `Provider`. Then add separate test coverage for malformed `AnnotatedRequest` JSON so JSON parsing failures are not conflated with `Provider`-related inputs.

Applied to files:

  • go/nemo_relay/event_sanitizers_test.go
📚 Learning: 2026-07-28T23:57:11.641Z
Learnt from: willkill07
Repo: NVIDIA/NeMo-Relay PR: 570
File: crates/node/src/api/mod.rs:3265-3282
Timestamp: 2026-07-28T23:57:11.641Z
Learning: In the Node.js binding, `flushSubscribers()` is Promise-based/async and must be awaited. Any session-close or teardown path (e.g., the OpenClaw live smoke session-close flow) must await `flushSubscribers()` before continuing to live ATIF export assertions and before teardown, so queued subscriber delivery fully completes and tests/assertions observe the final state.

Applied to files:

  • crates/node/src/api/mod.rs
📚 Learning: 2026-07-28T03:31:05.964Z
Learnt from: willkill07
Repo: NVIDIA/NeMo-Relay PR: 564
File: crates/core/src/api/runtime/subscriber_dispatcher.rs:297-314
Timestamp: 2026-07-28T03:31:05.964Z
Learning: In this codebase’s runtime API, do not implement incremental native LLM stream forwarding via the native ABI v3 asynchronous middleware protocol (it can only settle a single JSON value via a one-shot completion handle and cannot forward stream chunks incrementally). If a latency-sensitive plugin needs streaming behavior, review for use of synchronous native stream intercepts or worker plugins instead of trying to chunk-deliver or incrementally forward over the ABI v3 async path.

Applied to files:

  • crates/core/src/api/runtime/state.rs
📚 Learning: 2026-07-28T20:07:29.880Z
Learnt from: willkill07
Repo: NVIDIA/NeMo-Relay PR: 571
File: crates/core/src/api/runtime/state.rs:996-1020
Timestamp: 2026-07-28T20:07:29.880Z
Learning: In NeMo Relay (RELAY-509), sanitizer callback failures must be treated as intentional fail-open behavior. When an event/tool (request/response) or LLM (request/response) sanitizer callback fails, the sanitizer chain should retain and publish the last valid event/payload snapshot (rather than dropping/invalidating the data) and log the failure including callback context (e.g., which sanitizer/callback failed and relevant identifiers). Apply this consistently across all sanitizer chains mentioned in the RELAY-509 documentation/migration guide.

Applied to files:

  • crates/core/src/api/runtime/state.rs
🪛 Ruff (0.16.0)
python/tests/test_event_sanitizers.py

[warning] 73-73: Avoid specifying long messages outside the exception class

(TRY003)

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

814-835: 📐 Maintainability & Code Quality

Run the required core validation matrix.

No validation output is included. Before merge, run cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings, cargo deny check, just test-rust, validate-change, just test-python, just test-go, just test-node, and uv run pre-commit run --all-files. Also run cd go/nemo_relay && go fmt ./... for the changed Go package.

As per coding guidelines, “If crates/core or crates/adaptive changed, run the full validation matrix across Rust, Python, Go, and Node.js.”

Also applies to: 868-899, 932-963, 1266-1276, 1334-1344

Source: Coding guidelines

Comment thread crates/core/tests/unit/runtime_state_tests.rs
rapids-bot Bot pushed a commit that referenced this pull request Jul 31, 2026
#### Overview

Document the fail-closed exception contract for conditional-execution guardrails and request or execution intercepts in NeMo Relay 0.7.

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

#### Details

- Explain that callback errors, exceptions, and rejected `Promise` values stop the middleware chain at the failing stage and surface to the managed caller.
- Clarify that conditional-guardrail and request-intercept failures prevent the real callback from running.
- Clarify that an execution intercept cannot undo work from a `next` continuation that it already invoked.
- Document parity between callbacks that complete directly and callbacks that complete asynchronously.
- Update both the middleware concepts page and the v0.6-to-v0.7 migration guide.
- Leave sanitizer exception semantics to #607 to avoid conflicting guidance.

Validation:

- `just docs` passed with 0 errors. Fern skipped the authenticated redirects check because `FERN_TOKEN` was unavailable.
- Targeted pre-commit checks passed for both changed files, including the documentation link checker.
- The all-files pre-commit run passed formatting, Ruff, type checks, documentation links, lockfile checks, Cargo formatting/clippy/check, attribution checks, and Node checks. The `cargo-deny`, `go fmt`, and `go vet` hooks could not run because `cargo-deny` and Go are not installed in the local environment.

#### Where should the reviewer start?

Start with the **Callback Error Handling** section in `docs/about-nemo-relay/concepts/middleware.mdx`, then compare the matching upgrade guidance in `docs/reference/migration-guides.mdx`.

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

- Relates to: none



## Summary by CodeRabbit

* **Documentation**
  * Documented fail-closed behavior when middleware callbacks encounter errors, throw exceptions, or reject asynchronously.
  * Clarified that failed guards and request intercepts stop processing before the main callback runs.
  * Explained execution-intercept continuation behavior, including work already started by `next`.
  * Added corresponding guidance to the migration documentation.

Authors:
  - Yuchen Zhang (https://github.com/yczhang-nv)

Approvers:
  - Will Killian (https://github.com/willkill07)

URL: #613

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

just worried about that one path to leak sensitive data. Otherwise a solid change

Comment thread crates/core/src/api/runtime/state.rs Outdated
Comment thread crates/core/src/api/runtime/state.rs Outdated
Signed-off-by: Will Killian <wkillian@nvidia.com>
@willkill07

Copy link
Copy Markdown
Member Author

/merge

@rapids-bot
rapids-bot Bot merged commit 783bac7 into NVIDIA:release/0.7 Aug 1, 2026
79 of 80 checks passed
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:go PR changes/introduces Go code lang:js PR changes/introduces Javascript/Typescript code lang:python PR changes/introduces Python code 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.

4 participants