Skip to content

feat: add cross-boundary Relay propagation - #562

Merged
rapids-bot[bot] merged 5 commits into
NVIDIA:mainfrom
willkill07:wkk_relay-485-cross-boundary-propagation
Jul 28, 2026
Merged

feat: add cross-boundary Relay propagation#562
rapids-bot[bot] merged 5 commits into
NVIDIA:mainfrom
willkill07:wkk_relay-485-cross-boundary-propagation

Conversation

@willkill07

@willkill07 willkill07 commented Jul 27, 2026

Copy link
Copy Markdown
Member

Overview

Implement RELAY-485 transport-neutral Relay propagation across Rust, the C FFI, Python, Node.js, Go, and observability exporters.

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

Details

  • Add versioned propagation contexts with strict UUID validation and isolated imported scope stacks.
  • Capture active managed tool/LLM events and provide scoped stack installation in Python and Node.
  • Expose JSON transport through the C FFI and typed wrappers in Python, Node, and Go.
  • Project imported parentage to OpenTelemetry and OpenInference without changing Relay event serialization.
  • Document the transport trust boundary and W3C sidecar guidance.

Where should the reviewer start?

Start with crates/core/src/api/runtime/scope_stack.rs for the context and imported-stack semantics, then review the exporter parent projection in crates/core/src/observability/otel.rs.

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

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • Added a versioned cross-process propagation context (parent + optional root) with JSON capture/validation.
    • Enabled creation of isolated scope stacks from propagation context across C, Go, Python, and Node.js.
    • Added callback/context-manager APIs to install and restore an isolated scope stack.
  • Bug Fixes / Improvements
    • Improved causal “active event” context handling for managed LLM and tool execution.
    • Refined OpenTelemetry/OpenInference parent span derivation for propagated events.
  • Documentation
    • Documented cross-process propagation rules and OTLP trace identity behavior.
  • Tests
    • Expanded validation, JSON round-trips, isolation, and restoration coverage (including FFI).

Signed-off-by: Will Killian <wkillian@nvidia.com>
@willkill07
willkill07 requested review from a team as code owners July 27, 2026 14:26
@github-actions github-actions Bot added size:L PR is large Feature a new feature 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 27, 2026
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

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

Use the following commands to manage reviews:

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

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Changes

Propagation Context

Layer / File(s) Summary
Core propagation runtime
crates/core/src/api/runtime/..., crates/core/tests/integration/..., docs/...
Adds validated propagation contexts, isolated scope-stack reconstruction, causal-parent capture, active event scoping, and propagation documentation.
Active event and trace parenting
crates/core/src/api/{llm,tool}.rs, crates/core/src/observability/...
Scopes tool and LLM execution by event UUID and derives telemetry parent contexts from propagated scope state.
C and Go propagation APIs
crates/ffi/..., go/nemo_relay/...
Adds JSON C ABI functions and Go wrappers for capturing and reconstructing propagation contexts.
Node.js propagation bindings
crates/node/...
Exposes propagation context and temporary scope-stack installation through N-API.
Python propagation bindings
crates/python/..., python/nemo_relay/..., python/tests/...
Adds Python propagation context types, helpers, scoped installation, type stubs, registration, and isolation coverage.

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

Sequence Diagram(s)

sequenceDiagram
  participant Application
  participant Binding
  participant CoreRuntime
  participant Observability
  Application->>Binding: capture propagation context
  Binding->>CoreRuntime: serialize or create propagation context
  Application->>Binding: create isolated scope stack
  Binding->>CoreRuntime: reconstruct scope stack from context
  CoreRuntime->>Observability: expose propagated parent
  Observability-->>Application: derive remote trace parent
Loading

Possibly related PRs

  • NVIDIA/NeMo-Relay#564: Modifies the same managed LLM and tool execution entrypoints with related async execution behavior.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is valid Conventional Commits syntax and matches the propagation-focused changeset.
Description check ✅ Passed The description includes the required overview, details, reviewer-start, and related-issues sections.
Linked Issues check ✅ Passed The PR adds propagation contexts, isolated stack seeding/restoration, binding parity, and exporter projection aligned with #444.
Out of Scope Changes check ✅ Passed The changes stay within the Relay propagation, binding, testing, and documentation scope of the linked issue.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


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: 8

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

Inline comments:
In `@crates/core/src/api/runtime/scope_stack.rs`:
- Around line 103-145: Update ScopeStack::from_propagation so
propagated_parent_uuid remains available when context.root_uuid equals
context.parent_uuid, preserving the single-scope propagation case. Update both
observability parent_context implementations in otel.rs and openinference.rs to
recognize that case and construct a self-referencing remote SpanContext with
trace_id and span_id derived from root_uuid instead of returning an empty
Context.

In `@crates/core/src/observability/openinference.rs`:
- Around line 792-816: The propagated-parent handling in
ScopeStack::from_propagation must retain propagated_parent_uuid when root_uuid
equals parent_uuid, so is_propagated_parent recognizes that context. Then adjust
the parent_uuid == root_uuid guard in the surrounding event context construction
to preserve the sender trace instead of returning an empty Context.

In `@crates/core/src/observability/otel.rs`:
- Around line 778-802: Update the parent-context logic in the shown
observability flow to preserve propagated trace continuity when parent_uuid
equals the propagation stack’s root_uuid. Adjust the ordering or conditions
around is_propagated_parent and the root_uuid check so this root-parent case
produces the appropriate propagated context instead of returning an empty
Context, matching the fix applied to openinference.rs and
ScopeStack::from_propagation.

In `@crates/core/tests/integration/context_isolation_tests.rs`:
- Around line 59-89: Extend the propagation-context tests around
test_propagation_context_seeds_a_synthetic_root_and_parent and
test_rootless_propagation_context_uses_the_parent_as_root to cover equal
root_uuid and parent_uuid, asserting trace continuity and the expected scope
structure. Add negative tests for PropagationContext::validate() covering an
unsupported version and nil or degenerate UUID values, asserting each invalid
context is rejected.

In `@crates/node/src/api/mod.rs`:
- Around line 1816-1825: Update with_scope_stack and its documentation so
asynchronous callbacks returning Promises cannot retain or rely on a
thread-local scope stack across await; either introduce an async-context-aware
boundary that reinstalls the correct native stack for each operation, or
explicitly restrict this API to synchronous callbacks and dedicated-thread
usage. Remove the guidance to use setThreadScopeStack for async handler
lifetimes.

In `@crates/node/tests/context_tests.mjs`:
- Around line 41-43: Make the manual stack installation assertions in the
context tests exception-safe by wrapping each setThreadScopeStack installation
and verification in try/finally, restoring original in the finally block. Add a
withScopeStack test whose callback throws, assert the error propagates, and
verify the surrounding stack is restored afterward.

In `@go/nemo_relay/context_test.go`:
- Around line 262-284: Expand tests around NewScopeStackFromPropagation to cover
both propagation capture APIs, including nil-root inputs, and verify malformed
UUIDs and unsupported versions are rejected. Add independent propagated-stack
cases to confirm cross-request state isolation, while preserving the existing
successful explicit-root/current-parent handle coverage.

In `@python/nemo_relay/__init__.py`:
- Around line 424-433: Update use_scope_stack so it captures the actual prior
native thread scope stack before installing the new stack, then restores that
captured stack on exit instead of deriving it from get_scope_stack(). Preserve
context-variable restoration and add a regression test covering
set_thread_scope_stack(previous) before entering the context, asserting previous
is reinstalled afterward.
🪄 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: 1303315d-d3c9-474b-a844-698f3cc253c1

📥 Commits

Reviewing files that changed from the base of the PR and between 42c7655 and e5db478.

📒 Files selected for processing (22)
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/observability/openinference.rs
  • crates/core/src/observability/otel.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • crates/ffi/nemo_relay.h
  • crates/ffi/src/api/scope_stack.rs
  • crates/node/src/api/mod.rs
  • crates/node/tests/context_tests.mjs
  • crates/python/src/py_api/mod.rs
  • crates/python/src/py_types/core.rs
  • crates/python/src/py_types/mod.rs
  • docs/about-nemo-relay/concepts/scopes.mdx
  • docs/configure-plugins/observability/opentelemetry.mdx
  • go/nemo_relay/context_test.go
  • go/nemo_relay/nemo_relay.go
  • python/nemo_relay/__init__.py
  • python/nemo_relay/__init__.pyi
  • python/nemo_relay/_native.pyi
  • python/tests/test_context_isolation.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 (41)
**/*.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/configure-plugins/observability/opentelemetry.mdx
  • docs/about-nemo-relay/concepts/scopes.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/configure-plugins/observability/opentelemetry.mdx
  • docs/about-nemo-relay/concepts/scopes.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/configure-plugins/observability/opentelemetry.mdx
  • docs/about-nemo-relay/concepts/scopes.mdx
{docs,examples}/**/*

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

Update docs and examples.

Files:

  • docs/configure-plugins/observability/opentelemetry.mdx
  • docs/about-nemo-relay/concepts/scopes.mdx
**/*

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

  • docs/configure-plugins/observability/opentelemetry.mdx
  • docs/about-nemo-relay/concepts/scopes.mdx
  • go/nemo_relay/context_test.go
  • crates/ffi/nemo_relay.h
  • python/nemo_relay/__init__.pyi
  • crates/python/src/py_types/mod.rs
  • crates/python/src/py_types/core.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • python/tests/test_context_isolation.py
  • crates/core/src/observability/otel.rs
  • crates/node/tests/context_tests.mjs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime.rs
  • python/nemo_relay/_native.pyi
  • go/nemo_relay/nemo_relay.go
  • crates/core/src/observability/openinference.rs
  • python/nemo_relay/__init__.py
  • crates/python/src/py_api/mod.rs
  • crates/ffi/src/api/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/node/src/api/mod.rs
  • crates/core/src/api/runtime/scope_stack.rs
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/configure-plugins/observability/opentelemetry.mdx
  • docs/about-nemo-relay/concepts/scopes.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/configure-plugins/observability/opentelemetry.mdx
  • docs/about-nemo-relay/concepts/scopes.mdx
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/context_test.go
  • go/nemo_relay/nemo_relay.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/context_test.go
  • go/nemo_relay/nemo_relay.go
**/*.{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:

  • go/nemo_relay/context_test.go
  • crates/ffi/nemo_relay.h
  • crates/python/src/py_types/mod.rs
  • crates/python/src/py_types/core.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • python/tests/test_context_isolation.py
  • crates/core/src/observability/otel.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime.rs
  • go/nemo_relay/nemo_relay.go
  • crates/core/src/observability/openinference.rs
  • python/nemo_relay/__init__.py
  • crates/python/src/py_api/mod.rs
  • crates/ffi/src/api/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/node/src/api/mod.rs
  • crates/core/src/api/runtime/scope_stack.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:

  • go/nemo_relay/context_test.go
  • crates/python/src/py_types/mod.rs
  • crates/python/src/py_types/core.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • crates/core/src/observability/otel.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime.rs
  • go/nemo_relay/nemo_relay.go
  • crates/core/src/observability/openinference.rs
  • crates/python/src/py_api/mod.rs
  • crates/ffi/src/api/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/node/src/api/mod.rs
  • crates/core/src/api/runtime/scope_stack.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:

  • go/nemo_relay/context_test.go
  • python/nemo_relay/__init__.pyi
  • python/nemo_relay/_native.pyi
  • go/nemo_relay/nemo_relay.go
  • python/nemo_relay/__init__.py
  • crates/python/src/py_api/mod.rs
  • 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:

  • go/nemo_relay/context_test.go
  • python/nemo_relay/__init__.pyi
  • python/nemo_relay/_native.pyi
  • go/nemo_relay/nemo_relay.go
  • python/nemo_relay/__init__.py
**/*.{py,go,js,ts}

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

Keep Python, Go, and Node.js config objects and subscriber/exporter methods aligned so all bindings expose the same logical knobs and semantics.

Files:

  • go/nemo_relay/context_test.go
  • python/tests/test_context_isolation.py
  • go/nemo_relay/nemo_relay.go
  • python/nemo_relay/__init__.py
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/context_test.go
  • go/nemo_relay/nemo_relay.go
**/*.{rs,py,go,js,ts}

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

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

Files:

  • go/nemo_relay/context_test.go
  • crates/python/src/py_types/mod.rs
  • crates/python/src/py_types/core.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • python/tests/test_context_isolation.py
  • crates/core/src/observability/otel.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime.rs
  • go/nemo_relay/nemo_relay.go
  • crates/core/src/observability/openinference.rs
  • python/nemo_relay/__init__.py
  • crates/python/src/py_api/mod.rs
  • crates/ffi/src/api/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/node/src/api/mod.rs
  • crates/core/src/api/runtime/scope_stack.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:

  • go/nemo_relay/context_test.go
  • crates/python/src/py_types/mod.rs
  • crates/python/src/py_types/core.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • python/tests/test_context_isolation.py
  • crates/core/src/observability/otel.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime.rs
  • go/nemo_relay/nemo_relay.go
  • crates/core/src/observability/openinference.rs
  • python/nemo_relay/__init__.py
  • crates/python/src/py_api/mod.rs
  • crates/ffi/src/api/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/node/src/api/mod.rs
  • crates/core/src/api/runtime/scope_stack.rs
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/context_test.go
  • go/nemo_relay/nemo_relay.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/context_test.go
  • crates/core/tests/integration/context_isolation_tests.rs
  • python/tests/test_context_isolation.py
  • crates/node/tests/context_tests.mjs
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/nemo_relay.h
  • crates/ffi/src/api/scope_stack.rs
crates/ffi/nemo_relay.h

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

Check the generated header diff when any exported symbol or type changed in the FFI surface

Update generated or generated-from-build surfaces such as crates/ffi/nemo_relay.h through the proper build step.

Files:

  • crates/ffi/nemo_relay.h
{crates/ffi/src/api/*.rs,crates/ffi/nemo_relay.h}

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

Add or update the shared C/FFI surface in the relevant crates/ffi/src/api/*.rs module, re-export it through crates/ffi/src/api/mod.rs, and keep the generated crates/ffi/nemo_relay.h header correct.

Files:

  • crates/ffi/nemo_relay.h
  • crates/ffi/src/api/scope_stack.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/ffi/nemo_relay.h
  • crates/python/src/py_types/mod.rs
  • crates/python/src/py_types/core.rs
  • crates/node/tests/context_tests.mjs
  • crates/python/src/py_api/mod.rs
  • crates/ffi/src/api/scope_stack.rs
  • crates/node/src/api/mod.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/__init__.pyi
  • python/nemo_relay/_native.pyi
  • python/nemo_relay/__init__.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/python/src/py_types/mod.rs
  • crates/python/src/py_types/core.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • crates/core/src/observability/otel.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime.rs
  • crates/core/src/observability/openinference.rs
  • crates/python/src/py_api/mod.rs
  • crates/ffi/src/api/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/node/src/api/mod.rs
  • crates/core/src/api/runtime/scope_stack.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • crates/python/src/py_types/mod.rs
  • crates/python/src/py_types/core.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • python/tests/test_context_isolation.py
  • crates/core/src/observability/otel.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime.rs
  • crates/core/src/observability/openinference.rs
  • python/nemo_relay/__init__.py
  • crates/python/src/py_api/mod.rs
  • crates/ffi/src/api/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/node/src/api/mod.rs
  • crates/core/src/api/runtime/scope_stack.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/python/src/py_types/mod.rs
  • crates/python/src/py_types/core.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • python/tests/test_context_isolation.py
  • crates/core/src/observability/otel.rs
  • crates/node/tests/context_tests.mjs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime.rs
  • crates/core/src/observability/openinference.rs
  • python/nemo_relay/__init__.py
  • crates/python/src/py_api/mod.rs
  • crates/ffi/src/api/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/node/src/api/mod.rs
  • crates/core/src/api/runtime/scope_stack.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/python/src/py_types/mod.rs
  • crates/python/src/py_types/core.rs
  • python/tests/test_context_isolation.py
  • crates/core/src/observability/otel.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime.rs
  • crates/core/src/observability/openinference.rs
  • python/nemo_relay/__init__.py
  • crates/python/src/py_api/mod.rs
  • crates/ffi/src/api/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/node/src/api/mod.rs
  • crates/core/src/api/runtime/scope_stack.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/integration/context_isolation_tests.rs
  • crates/core/src/observability/otel.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime.rs
  • crates/core/src/observability/openinference.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.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/context_isolation_tests.rs
  • crates/core/src/observability/otel.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime.rs
  • crates/core/src/observability/openinference.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.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/context_isolation_tests.rs
  • crates/core/src/observability/otel.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime.rs
  • crates/core/src/observability/openinference.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.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/context_isolation_tests.rs
  • crates/core/src/observability/otel.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime.rs
  • crates/core/src/observability/openinference.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
**/*.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/tests/test_context_isolation.py
  • python/nemo_relay/__init__.py
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_context_isolation.py
crates/core/src/observability/{atif,otel,openinference}.rs

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

When changing the core event model, emitted fields, exporter behavior, subscriber config, or lifecycle, keep the ATIF, OpenTelemetry, and OpenInference implementations in sync.

Files:

  • crates/core/src/observability/otel.rs
  • crates/core/src/observability/openinference.rs
crates/node/**/*.{js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use camelCase for Node.js public APIs.

Files:

  • crates/node/tests/context_tests.mjs
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/tool.rs
  • crates/core/src/api/runtime.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.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/tool.rs
  • crates/core/src/api/llm.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/tool.rs
  • crates/core/src/api/runtime.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.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
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/src/api/scope_stack.rs
🧠 Learnings (1)
📚 Learning: 2026-07-14T02:53:59.997Z
Learnt from: willkill07
Repo: NVIDIA/NeMo-Relay PR: 415
File: docs/configure-plugins/observability/opentelemetry.mdx:98-113
Timestamp: 2026-07-14T02:53:59.997Z
Learning: In NeMo-Relay’s OpenTelemetry/OpenInference observability projection docs under docs/configure-plugins/observability/, document the projected-attribute contract as follows: (1) emit scalar top-level `data`/`metadata` fields as typed dotted OTLP attributes (for example, `nemo_relay.start.metadata.tenant`); (2) keep nested objects/arrays as JSON strings at their top-level OTLP attribute (rather than expanding them into nested OTLP attributes); and (3) do not reference the legacy `*_json` payload attributes (e.g., `data_json`, `metadata_json`, `input_json`) because they were intentionally removed as a breaking change.

Applied to files:

  • docs/configure-plugins/observability/opentelemetry.mdx
🪛 ast-grep (0.44.1)
go/nemo_relay/nemo_relay.go

[warning] 1631-1631: Narrowing a non-constant integer to a smaller fixed-width type (int8/int16/int32, uint8/uint16/uint32) can silently overflow or wrap, yielding negative or truncated values that are dangerous in size, length, or index logic. Validate the source value is within the target type's range before converting (e.g. bounds-check, or use a checked helper), and avoid narrowing untrusted or len()/parsed values.
Context: int32(status)
Note: [CWE-190] Integer Overflow or Wraparound.

(integer-overflow-narrowing-conversion-go)

🔇 Additional comments (27)
crates/ffi/nemo_relay.h (1)

2344-2375: 📐 Maintainability & Code Quality

Validate the regenerated FFI surface.

These symbols change the generated C ABI; rebuild the FFI crate in release mode, regenerate and inspect crates/ffi/nemo_relay.h, then run cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings, just test-rust, and test-ffi-surface.

  • crates/ffi/nemo_relay.h#L2344-L2375: confirm the generated declarations and ownership documentation match the release artifact.
  • crates/ffi/src/api/scope_stack.rs#L50-L160: validate the exported implementations against the strict Rust and FFI test targets.

Source: Coding guidelines

crates/ffi/src/api/scope_stack.rs (1)

5-13: LGTM!

go/nemo_relay/nemo_relay.go (2)

232-234: 📐 Maintainability & Code Quality

Run the required Go binding validation.

Confirm cd go/nemo_relay && go fmt ./... && go vet ./..., just test-go, and final uv run pre-commit run --all-files completed after these cgo API additions. As per coding guidelines, changed Go bindings must be formatted, vetted, and tested; changed files require final pre-commit validation.

Source: Coding guidelines


1573-1633: LGTM!

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

39-45: 📐 Maintainability & Code Quality

Run the required Rust and Node validation targets.

Please confirm cargo fmt --all, just test-rust, and cargo clippy --workspace --all-targets -- -D warnings passed, plus the repository’s Node test target for this public binding change. As per coding guidelines, “Any Rust change must run just test-rust,” cargo fmt --all, and strict Clippy; language-surface changes must run that language’s test target.

Source: Coding guidelines

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

21-22: LGTM!

crates/python/src/py_api/mod.rs (1)

168-199: 📐 Maintainability & Code Quality

Run the required Rust validation before handoff.

  • crates/python/src/py_api/mod.rs#L168-L199: run cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings, and just test-rust.
  • crates/python/src/py_types/core.rs#L193-L234: run cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings, and just test-rust.
  • crates/python/src/py_types/mod.rs#L138-L150: run cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings, and just test-rust.

Source: Coding guidelines

python/nemo_relay/__init__.py (2)

82-82: LGTM!

Also applies to: 114-114, 124-133, 407-421, 504-513


407-435: 📐 Maintainability & Code Quality

Run the required Python wrapper validation.

  • python/nemo_relay/__init__.py#L407-L435: run Ruff (E, F, W, I), Ruff formatting with 120-character lines, and ty.
  • python/tests/test_context_isolation.py#L19-L30: run Ruff (E, F, W, I), Ruff formatting with 120-character lines, and ty.

Source: Coding guidelines

python/nemo_relay/__init__.pyi (1)

108-110: LGTM!

Also applies to: 373-376

python/nemo_relay/_native.pyi (1)

1328-1340: LGTM!

python/tests/test_context_isolation.py (1)

7-7: LGTM!

crates/core/src/api/runtime/scope_stack.rs (4)

13-16: LGTM!

Also applies to: 36-37, 39-53


55-81: validate() correctly enforces version + non-degenerate UUIDs.

Version check and per-UUID zero-byte checks look correct for the documented wire format.


193-197: LGTM!


390-432: Propagation capture/creation helpers and the ACTIVE_EVENT_UUID task-local look correct.

create_scope_stack_from_propagation, capture_propagation_context[_with_root], and with_active_event_uuid are straightforward and consistent with the task-local scoping pattern already used for TASK_SCOPE_STACK.

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

22-27: LGTM!

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

9-12: LGTM!

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

145-162: LGTM!

docs/configure-plugins/observability/opentelemetry.mdx (1)

77-82: LGTM!

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

25-25: LGTM!


1029-1048: Active-event scoping correctly wraps the full non-streaming execution chain.

event_uuid/with_active_event_uuid wraps request-intercept execution through to the provider call completing, so nested capture_propagation_context() calls made during this call will correctly resolve to this LLM handle.


1222-1241: 🎯 Functional Correctness

No active-event scope extension needed here. The streamed path carries the captured scope stack into LlmStreamWrapper for later polling and cleanup, and this code path does not read capture_propagation_context() during chunk polling. No change needed.

			> Likely an incorrect or invalid review comment.
crates/core/src/api/tool.rs (1)

10-10: LGTM!

Also applies to: 551-554

crates/core/src/observability/openinference.rs (2)

32-32: LGTM!

Also applies to: 45-46


788-817: 🎯 Functional Correctness

ATIF ancestry can stay parent_uuid-based; no extra propagated-parent handling is needed.

crates/core/src/observability/otel.rs (1)

32-40: LGTM!

Comment thread crates/core/src/api/runtime/scope_stack.rs
Comment thread crates/core/src/observability/openinference.rs
Comment thread crates/core/src/observability/otel.rs
Comment thread crates/core/tests/integration/context_isolation_tests.rs
Comment thread crates/node/src/api/mod.rs
Comment thread crates/node/tests/context_tests.mjs Outdated
Comment thread go/nemo_relay/context_test.go
Comment thread python/nemo_relay/__init__.py Outdated
@willkill07 willkill07 self-assigned this Jul 27, 2026
@willkill07 willkill07 added this to the 0.7 milestone Jul 27, 2026
Signed-off-by: Will Killian <wkillian@nvidia.com>
@github-actions github-actions Bot added size:XL PR is extra large and removed size:L PR is large labels Jul 27, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

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

Inline comments:
In `@crates/ffi/tests/unit/api_tests.rs`:
- Around line 235-267: Extend
propagation_context_json_round_trips_through_the_ffi with separate assertions
that nemo_relay_scope_stack_create_from_propagation_json rejects malformed JSON
and semantically invalid contexts such as an unsupported version or unusable
root_uuid. Verify each rejected input returns the appropriate non-Ok status and
does not produce a usable stack, while preserving the existing successful
round-trip assertions.

In `@crates/python/src/py_api/mod.rs`:
- Around line 214-218: Preserve the complete ThreadScopeStackBinding, including
its explicit flag, when capture_thread_scope_stack() creates the opaque
Python-facing binding; update python/nemo_relay/__init__.py lines 428-435 to
restore that binding through the native binding-restore path rather than only
synchronizing its stack handle, using contextvars-based scope isolation; update
python/tests/test_context_isolation.py lines 33-42 to assert explicit
native-stack activity is restored in addition to the handle UUID.
🪄 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: 89339006-41d9-4bfd-aba0-66dbf421d2a4

📥 Commits

Reviewing files that changed from the base of the PR and between e5db478 and cbc211a.

📒 Files selected for processing (10)
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • crates/ffi/tests/unit/api_tests.rs
  • crates/node/src/api/mod.rs
  • crates/node/tests/context_tests.mjs
  • crates/python/src/py_api/mod.rs
  • go/nemo_relay/context_test.go
  • python/nemo_relay/__init__.py
  • python/nemo_relay/_native.pyi
  • python/tests/test_context_isolation.py
📜 Review details
🧰 Additional context used
📓 Path-based instructions (31)
**/*.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_tests.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • crates/python/src/py_api/mod.rs
  • crates/node/src/api/mod.rs
  • crates/core/src/api/runtime/scope_stack.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_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_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_tests.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • python/nemo_relay/__init__.py
  • crates/python/src/py_api/mod.rs
  • crates/node/src/api/mod.rs
  • python/tests/test_context_isolation.py
  • crates/core/src/api/runtime/scope_stack.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/ffi/tests/unit/api_tests.rs
  • crates/node/tests/context_tests.mjs
  • crates/core/tests/integration/context_isolation_tests.rs
  • python/nemo_relay/__init__.py
  • crates/python/src/py_api/mod.rs
  • crates/node/src/api/mod.rs
  • python/tests/test_context_isolation.py
  • crates/core/src/api/runtime/scope_stack.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_tests.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • python/nemo_relay/__init__.py
  • go/nemo_relay/context_test.go
  • crates/python/src/py_api/mod.rs
  • crates/node/src/api/mod.rs
  • python/tests/test_context_isolation.py
  • crates/core/src/api/runtime/scope_stack.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_tests.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • go/nemo_relay/context_test.go
  • crates/python/src/py_api/mod.rs
  • crates/node/src/api/mod.rs
  • crates/core/src/api/runtime/scope_stack.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/ffi/tests/unit/api_tests.rs
  • crates/node/tests/context_tests.mjs
  • crates/core/tests/integration/context_isolation_tests.rs
  • python/nemo_relay/__init__.py
  • python/nemo_relay/_native.pyi
  • go/nemo_relay/context_test.go
  • crates/python/src/py_api/mod.rs
  • crates/node/src/api/mod.rs
  • python/tests/test_context_isolation.py
  • crates/core/src/api/runtime/scope_stack.rs
**/*.{rs,py,go,js,ts}

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

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

Files:

  • crates/ffi/tests/unit/api_tests.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • python/nemo_relay/__init__.py
  • go/nemo_relay/context_test.go
  • crates/python/src/py_api/mod.rs
  • crates/node/src/api/mod.rs
  • python/tests/test_context_isolation.py
  • crates/core/src/api/runtime/scope_stack.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_tests.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • python/nemo_relay/__init__.py
  • go/nemo_relay/context_test.go
  • crates/python/src/py_api/mod.rs
  • crates/node/src/api/mod.rs
  • python/tests/test_context_isolation.py
  • crates/core/src/api/runtime/scope_stack.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/ffi/tests/unit/api_tests.rs
  • crates/node/tests/context_tests.mjs
  • crates/python/src/py_api/mod.rs
  • crates/node/src/api/mod.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/ffi/tests/unit/api_tests.rs
  • crates/node/tests/context_tests.mjs
  • crates/core/tests/integration/context_isolation_tests.rs
  • go/nemo_relay/context_test.go
  • python/tests/test_context_isolation.py
crates/node/**/*.{js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use camelCase for Node.js public APIs.

Files:

  • crates/node/tests/context_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/context_isolation_tests.rs
  • crates/core/src/api/runtime/scope_stack.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/context_isolation_tests.rs
  • crates/core/src/api/runtime/scope_stack.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/context_isolation_tests.rs
  • crates/core/src/api/runtime/scope_stack.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/context_isolation_tests.rs
  • crates/core/src/api/runtime/scope_stack.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_context_isolation.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/__init__.py
  • python/nemo_relay/_native.pyi
  • go/nemo_relay/context_test.go
  • crates/python/src/py_api/mod.rs
  • 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/__init__.py
  • python/nemo_relay/_native.pyi
  • go/nemo_relay/context_test.go
{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
  • crates/python/src/py_api/mod.rs
  • crates/node/src/api/mod.rs
  • python/tests/test_context_isolation.py
  • crates/core/src/api/runtime/scope_stack.rs
**/*.{py,go,js,ts}

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

Keep Python, Go, and Node.js config objects and subscriber/exporter methods aligned so all bindings expose the same logical knobs and semantics.

Files:

  • python/nemo_relay/__init__.py
  • go/nemo_relay/context_test.go
  • python/tests/test_context_isolation.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/_native.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/context_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/context_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/context_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/context_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_context_isolation.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/runtime/scope_stack.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/scope_stack.rs
🔇 Additional comments (8)
go/nemo_relay/context_test.go (2)

286-320: Still missing nil-root and capture-side invalid UUID coverage.

The test covers rootless capture through CapturePropagationContext() and explicit-root capture, but not CapturePropagationContextWithRoot(nil) or an invalid root passed to that API.


322-347: LGTM!

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

1818-1819: LGTM!

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

41-63: LGTM!

Also applies to: 80-89

python/nemo_relay/_native.pyi (1)

1341-1341: LGTM!

crates/core/tests/integration/context_isolation_tests.rs (2)

90-103: 🎯 Functional Correctness

Assert causal-parent preservation in the equal-root case.

This test verifies only the one-scope shape, so it passes even when the imported parent marker is dropped and trace continuity is lost. Assert stack.is_propagated_parent(root_uuid) or add an end-to-end parent-context assertion.

Suggested assertion
     assert_eq!(stack.top().uuid, root_uuid);
     assert_eq!(stack.scopes().len(), 1);
+    assert!(stack.is_propagated_parent(root_uuid));

Source: Path instructions


105-126: LGTM!

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

376-382: LGTM!

Comment thread crates/ffi/tests/unit/api_tests.rs
Comment thread crates/python/src/py_api/mod.rs
@bbednarski9
bbednarski9 self-requested a review July 27, 2026 16:37
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/observability/openinference_tests.rs`:
- Around line 476-493: Make thread-local scope installation unwind-safe in the
OpenInference test around parent_context by restoring the captured stack from a
Drop-based RAII guard or existing scoped-install helper; update
crates/core/tests/unit/observability/openinference_tests.rs lines 476-493, and
apply the same pattern in crates/core/tests/unit/observability/otel_tests.rs
lines 341-358. Preserve cross-request scope isolation even when the test panics.
🪄 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: 5ee04e42-a7fa-43f5-a7f4-15121e17b3e4

📥 Commits

Reviewing files that changed from the base of the PR and between cbc211a and 5c22b8f.

📒 Files selected for processing (6)
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/observability/openinference.rs
  • crates/core/src/observability/otel.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • crates/core/tests/unit/observability/openinference_tests.rs
  • crates/core/tests/unit/observability/otel_tests.rs
💤 Files with no reviewable changes (2)
  • crates/core/src/observability/openinference.rs
  • crates/core/src/observability/otel.rs
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: Check / Run
  • GitHub Check: Preview docs
🧰 Additional context used
📓 Path-based instructions (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/tests/unit/observability/openinference_tests.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/src/api/runtime/scope_stack.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/observability/openinference_tests.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/src/api/runtime/scope_stack.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/observability/openinference_tests.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • crates/core/tests/unit/observability/openinference_tests.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/src/api/runtime/scope_stack.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/tests/unit/observability/openinference_tests.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/src/api/runtime/scope_stack.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/tests/unit/observability/openinference_tests.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/src/api/runtime/scope_stack.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/tests/unit/observability/openinference_tests.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/src/api/runtime/scope_stack.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/tests/unit/observability/openinference_tests.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/src/api/runtime/scope_stack.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/observability/openinference_tests.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
**/*.{rs,py,go,js,ts}

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

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

Files:

  • crates/core/tests/unit/observability/openinference_tests.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/src/api/runtime/scope_stack.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/tests/unit/observability/openinference_tests.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/src/api/runtime/scope_stack.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/observability/openinference_tests.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}

⚙️ CodeRabbit configuration file

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

Files:

  • crates/core/tests/unit/observability/openinference_tests.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • crates/core/tests/unit/observability/otel_tests.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/scope_stack.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/scope_stack.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/scope_stack.rs
🔇 Additional comments (3)
crates/core/src/api/runtime/scope_stack.rs (2)

45-80: LGTM!

Also applies to: 103-143, 190-193, 375-377


398-403: 📐 Maintainability & Code Quality

Confirm the required core validation matrix.

This changes core runtime semantics, but no validation output is included. Please provide results for cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings, just test-rust, cargo deny check, validate-change, the Rust/Python/Go/Node matrix, and final pre-commit checks. As per coding guidelines, “If crates/core or crates/adaptive changed, run the full validation matrix across Rust, Python, Go, and Node.js.”

Source: Coding guidelines

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

60-126: LGTM!

Comment thread crates/core/tests/unit/observability/openinference_tests.rs Outdated
@bbednarski9

Copy link
Copy Markdown
Contributor

Two CR comments above re: remote work invoked from the sender's root scope look legit. Will result in a new OTLP trace instead of linking the root

Comment thread crates/core/src/observability/openinference.rs
Comment thread crates/core/src/observability/otel.rs
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: 2

Caution

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

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

482-505: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Exercise distinct propagated root and parent UUIDs.

Using root_uuid == parent_uuid means these assertions pass even if trace and span derivation are swapped.

  • crates/core/tests/unit/observability/openinference_tests.rs#L482-L505: use a distinct parent_uuid; pass it to the event and assert trace ID from root_uuid and span ID from parent_uuid.
  • crates/core/tests/unit/observability/otel_tests.rs#L347-L370: use the same distinct-ID fixture and assertions.

As per path instructions, tests should cover behavior promised by the changed API surface, including event payload semantics.

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

In `@crates/core/tests/unit/observability/openinference_tests.rs` around lines 482
- 505, Update propagated-parent tests to use distinct root and parent UUIDs. In
crates/core/tests/unit/observability/openinference_tests.rs lines 482-505,
introduce a separate parent UUID, pass it to the event, and assert the trace ID
derives from root_uuid while the span ID derives from parent_uuid. Apply the
same fixture and assertions in
crates/core/tests/unit/observability/otel_tests.rs lines 347-370.

Source: Path instructions

python/nemo_relay/__init__.py (1)

427-436: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

Make use_scope_stack task-safe across await.

_scope_stack_var is task-local, but _sync_thread_scope_stack(stack) mutates OS-thread-local native state. When two asyncio tasks overlap this context manager across an await, one task can overwrite the other’s native stack, and a finally block can restore a stale binding while the other task is still active. Events and handles may then be attributed to the wrong request. Use a task-local native override or rebind native state before every call, and add an interleaving regression test.

As per path instructions, Python wrapper changes require “contextvars-based scope isolation”; the current implementation mixes task-local and thread-local state.

🤖 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 `@python/nemo_relay/__init__.py` around lines 427 - 436, Make use_scope_stack
task-safe by removing its direct reliance on persistent OS-thread-local native
state: use a contextvars-based native scope override, or ensure the native scope
is rebound from the current task before every native operation. Preserve nested
restoration semantics and add an asyncio interleaving regression test proving
overlapping use_scope_stack contexts cannot attribute events or handles to
another task.

Source: Path instructions

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

Inline comments:
In `@python/tests/test_context_isolation.py`:
- Around line 49-58: Make the invalid-input assertions in the
propagation-context tests specific: add matching error assertions for malformed
parent/root UUID parsing and separately verify the unsupported version case,
rather than relying on broad pytest.raises(ValueError) blocks. Apply the same
UUID-specific match to capture_propagation_context_with_root.
- Around line 73-102: Update
test_use_scope_stack_restores_a_previously_bound_native_stack and
test_use_scope_stack_restores_nested_and_failing_contexts to capture each test’s
initial native thread scope-stack binding before calling set_thread_scope_stack.
Restore that original binding in a finally block or shared fixture, while
preserving the existing assertions for nested, failing, and restored scope
behavior; ensure the tests remain isolated across requests and execution order.

---

Outside diff comments:
In `@crates/core/tests/unit/observability/openinference_tests.rs`:
- Around line 482-505: Update propagated-parent tests to use distinct root and
parent UUIDs. In crates/core/tests/unit/observability/openinference_tests.rs
lines 482-505, introduce a separate parent UUID, pass it to the event, and
assert the trace ID derives from root_uuid while the span ID derives from
parent_uuid. Apply the same fixture and assertions in
crates/core/tests/unit/observability/otel_tests.rs lines 347-370.

In `@python/nemo_relay/__init__.py`:
- Around line 427-436: Make use_scope_stack task-safe by removing its direct
reliance on persistent OS-thread-local native state: use a contextvars-based
native scope override, or ensure the native scope is rebound from the current
task before every native operation. Preserve nested restoration semantics and
add an asyncio interleaving regression test proving overlapping use_scope_stack
contexts cannot attribute events or handles to another task.
🪄 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: 6b88ee61-0dc5-4b64-bc6b-c8f9409621c4

📥 Commits

Reviewing files that changed from the base of the PR and between 5c22b8f and 780df65.

📒 Files selected for processing (11)
  • crates/core/tests/unit/observability/openinference_tests.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/ffi/tests/unit/api_tests.rs
  • crates/python/src/py_api/mod.rs
  • crates/python/src/py_types/core.rs
  • crates/python/src/py_types/mod.rs
  • crates/python/tests/coverage/py_api_coverage_tests.rs
  • go/nemo_relay/context_test.go
  • python/nemo_relay/__init__.py
  • python/nemo_relay/_native.pyi
  • python/tests/test_context_isolation.py
📜 Review details
🧰 Additional context used
📓 Path-based instructions (28)
**/*.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/python/src/py_types/mod.rs
  • crates/python/tests/coverage/py_api_coverage_tests.rs
  • crates/ffi/tests/unit/api_tests.rs
  • crates/python/src/py_types/core.rs
  • crates/core/tests/unit/observability/openinference_tests.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/python/src/py_api/mod.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • crates/python/src/py_types/mod.rs
  • crates/python/tests/coverage/py_api_coverage_tests.rs
  • crates/ffi/tests/unit/api_tests.rs
  • crates/python/src/py_types/core.rs
  • crates/core/tests/unit/observability/openinference_tests.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/python/src/py_api/mod.rs
  • python/nemo_relay/__init__.py
  • python/tests/test_context_isolation.py
**/*.{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/python/src/py_types/mod.rs
  • crates/python/tests/coverage/py_api_coverage_tests.rs
  • crates/ffi/tests/unit/api_tests.rs
  • crates/python/src/py_types/core.rs
  • crates/core/tests/unit/observability/openinference_tests.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/python/src/py_api/mod.rs
  • python/nemo_relay/__init__.py
  • python/tests/test_context_isolation.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:

  • crates/python/src/py_types/mod.rs
  • crates/python/tests/coverage/py_api_coverage_tests.rs
  • crates/ffi/tests/unit/api_tests.rs
  • crates/python/src/py_types/core.rs
  • crates/core/tests/unit/observability/openinference_tests.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • go/nemo_relay/context_test.go
  • crates/python/src/py_api/mod.rs
  • python/nemo_relay/__init__.py
  • python/tests/test_context_isolation.py
**/*.{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/python/src/py_types/mod.rs
  • crates/python/tests/coverage/py_api_coverage_tests.rs
  • crates/ffi/tests/unit/api_tests.rs
  • crates/python/src/py_types/core.rs
  • crates/core/tests/unit/observability/openinference_tests.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • go/nemo_relay/context_test.go
  • crates/python/src/py_api/mod.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/python/src/py_types/mod.rs
  • crates/python/src/py_types/core.rs
  • crates/python/src/py_api/mod.rs
  • python/nemo_relay/__init__.py
  • python/tests/test_context_isolation.py
**/*

📄 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/python/src/py_types/mod.rs
  • crates/python/tests/coverage/py_api_coverage_tests.rs
  • crates/ffi/tests/unit/api_tests.rs
  • crates/python/src/py_types/core.rs
  • crates/core/tests/unit/observability/openinference_tests.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • go/nemo_relay/context_test.go
  • crates/python/src/py_api/mod.rs
  • python/nemo_relay/__init__.py
  • python/tests/test_context_isolation.py
  • python/nemo_relay/_native.pyi
**/*.{rs,py,go,js,ts}

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

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

Files:

  • crates/python/src/py_types/mod.rs
  • crates/python/tests/coverage/py_api_coverage_tests.rs
  • crates/ffi/tests/unit/api_tests.rs
  • crates/python/src/py_types/core.rs
  • crates/core/tests/unit/observability/openinference_tests.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • go/nemo_relay/context_test.go
  • crates/python/src/py_api/mod.rs
  • python/nemo_relay/__init__.py
  • python/tests/test_context_isolation.py
**/*.{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/python/src/py_types/mod.rs
  • crates/python/tests/coverage/py_api_coverage_tests.rs
  • crates/ffi/tests/unit/api_tests.rs
  • crates/python/src/py_types/core.rs
  • crates/core/tests/unit/observability/openinference_tests.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • go/nemo_relay/context_test.go
  • crates/python/src/py_api/mod.rs
  • python/nemo_relay/__init__.py
  • python/tests/test_context_isolation.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/python/src/py_types/mod.rs
  • crates/python/tests/coverage/py_api_coverage_tests.rs
  • crates/ffi/tests/unit/api_tests.rs
  • crates/python/src/py_types/core.rs
  • crates/python/src/py_api/mod.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/python/tests/coverage/py_api_coverage_tests.rs
  • crates/ffi/tests/unit/api_tests.rs
  • crates/core/tests/unit/observability/openinference_tests.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • go/nemo_relay/context_test.go
  • python/tests/test_context_isolation.py
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_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_tests.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/observability/openinference_tests.rs
  • crates/core/tests/unit/observability/otel_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/unit/observability/openinference_tests.rs
  • crates/core/tests/unit/observability/otel_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/unit/observability/openinference_tests.rs
  • crates/core/tests/unit/observability/otel_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/unit/observability/openinference_tests.rs
  • crates/core/tests/unit/observability/otel_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/context_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/context_test.go
{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:

  • go/nemo_relay/context_test.go
  • crates/python/src/py_api/mod.rs
  • python/nemo_relay/__init__.py
  • python/nemo_relay/_native.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:

  • go/nemo_relay/context_test.go
  • python/nemo_relay/__init__.py
  • python/nemo_relay/_native.pyi
**/*.{py,go,js,ts}

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

Keep Python, Go, and Node.js config objects and subscriber/exporter methods aligned so all bindings expose the same logical knobs and semantics.

Files:

  • go/nemo_relay/context_test.go
  • python/nemo_relay/__init__.py
  • python/tests/test_context_isolation.py
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/context_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/context_test.go
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_context_isolation.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/_native.pyi
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_context_isolation.py
🪛 Ruff (0.15.21)
python/tests/test_context_isolation.py

[warning] 54-54: pytest.raises(ValueError) is too broad, set the match parameter or use a more specific exception

(PT011)


[warning] 57-57: pytest.raises(ValueError) is too broad, set the match parameter or use a more specific exception

(PT011)


[warning] 96-99: pytest.raises() block should contain a single simple statement

(PT012)


[warning] 96-97: Use a single with statement with multiple contexts instead of nested with statements

(SIM117)


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

(TRY003)

🔇 Additional comments (12)
crates/ffi/tests/unit/api_tests.rs (1)

268-283: Use valid JSON for semantic rejection cases.

Lines 270-271 retain literal backslashes because they are raw strings, so both only test JSON parsing failure—not unsupported-version or unusable-UUID validation. Use r#"{"version":...}"# payloads.

crates/core/tests/unit/observability/openinference_tests.rs (2)

12-12: LGTM!

Also applies to: 48-54


12-55: 📐 Maintainability & Code Quality

Provide required validation results.

Run the Rust checks (cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings, just test-rust), the crates/core language matrix, and Go checks (cd go/nemo_relay && go fmt ./..., go vet ./..., just test-go) before handoff.

As per coding guidelines, changed Rust and Go surfaces must run their language-specific format, lint, and test targets.

Source: Coding guidelines

crates/core/tests/unit/observability/otel_tests.rs (1)

12-12: LGTM!

Also applies to: 44-50

go/nemo_relay/context_test.go (1)

311-395: LGTM!

crates/python/src/py_api/mod.rs (1)

25-27: LGTM!

Also applies to: 47-48, 218-226, 1799-1799

crates/python/src/py_types/core.rs (1)

19-20: LGTM!

Also applies to: 194-247

crates/python/src/py_types/mod.rs (1)

140-141: LGTM!

python/nemo_relay/__init__.py (1)

82-82: LGTM!

Also applies to: 114-114, 124-135, 409-423, 507-516

python/nemo_relay/_native.pyi (1)

1328-1345: LGTM!

crates/python/tests/coverage/py_api_coverage_tests.rs (1)

55-73: LGTM!

python/tests/test_context_isolation.py (1)

9-9: LGTM!

Also applies to: 35-47, 61-70

Comment thread python/tests/test_context_isolation.py Outdated
Comment thread python/tests/test_context_isolation.py Outdated
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: 2

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

Inline comments:
In `@crates/node/tests/context_tests.mjs`:
- Around line 51-68: Add an assertion in the existing propagation context test
covering direct serialization failure: call propagationContextToJson with a
malformed parentUuid and verify it throws the expected validation error,
alongside the existing deserialization error assertions. Keep the valid
round-trip assertions unchanged.

In `@python/tests/test_context_isolation.py`:
- Around line 15-22: Update restore_native_scope_stack to use the explicit
pytest fixture name declaration, rename its implementation to
restore_native_scope_stack_fixture, and add the appropriate generator return
type annotation while preserving the existing capture, yield, and restoration
behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: baf53ef3-611b-412d-b825-f40bbd8824d3

📥 Commits

Reviewing files that changed from the base of the PR and between 780df65 and 61af3a7.

📒 Files selected for processing (10)
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • crates/node/src/api/mod.rs
  • crates/node/tests/context_tests.mjs
  • crates/python/src/py_types/core.rs
  • docs/about-nemo-relay/concepts/scopes.mdx
  • go/nemo_relay/context_test.go
  • go/nemo_relay/nemo_relay.go
  • python/nemo_relay/_native.pyi
  • python/tests/test_context_isolation.py
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: Preview docs
  • GitHub Check: Check / Run
🧰 Additional context used
📓 Path-based instructions (34)
**/*.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/concepts/scopes.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/concepts/scopes.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/concepts/scopes.mdx
{docs,examples}/**/*

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

Update docs and examples.

Files:

  • docs/about-nemo-relay/concepts/scopes.mdx
**/*

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

  • docs/about-nemo-relay/concepts/scopes.mdx
  • python/nemo_relay/_native.pyi
  • crates/node/tests/context_tests.mjs
  • crates/node/src/api/mod.rs
  • go/nemo_relay/nemo_relay.go
  • crates/python/src/py_types/core.rs
  • go/nemo_relay/context_test.go
  • crates/core/src/api/runtime/scope_stack.rs
  • python/tests/test_context_isolation.py
  • crates/core/tests/integration/context_isolation_tests.rs
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/concepts/scopes.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/concepts/scopes.mdx
{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/_native.pyi
  • crates/node/src/api/mod.rs
  • go/nemo_relay/nemo_relay.go
  • go/nemo_relay/context_test.go
{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/_native.pyi
  • go/nemo_relay/nemo_relay.go
  • go/nemo_relay/context_test.go
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/_native.pyi
crates/node/**/*.{js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use camelCase for Node.js public APIs.

Files:

  • crates/node/tests/context_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/context_tests.mjs
  • crates/node/src/api/mod.rs
  • crates/python/src/py_types/core.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • python/tests/test_context_isolation.py
  • crates/core/tests/integration/context_isolation_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/tests/context_tests.mjs
  • crates/node/src/api/mod.rs
  • crates/python/src/py_types/core.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/context_tests.mjs
  • go/nemo_relay/context_test.go
  • python/tests/test_context_isolation.py
  • crates/core/tests/integration/context_isolation_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/node/src/api/mod.rs
  • crates/python/src/py_types/core.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/integration/context_isolation_tests.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • crates/node/src/api/mod.rs
  • crates/python/src/py_types/core.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • python/tests/test_context_isolation.py
  • crates/core/tests/integration/context_isolation_tests.rs
**/*.{rs,py,go,js,ts,c,h}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

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

Files:

  • crates/node/src/api/mod.rs
  • go/nemo_relay/nemo_relay.go
  • crates/python/src/py_types/core.rs
  • go/nemo_relay/context_test.go
  • crates/core/src/api/runtime/scope_stack.rs
  • python/tests/test_context_isolation.py
  • crates/core/tests/integration/context_isolation_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/api/mod.rs
  • go/nemo_relay/nemo_relay.go
  • crates/python/src/py_types/core.rs
  • go/nemo_relay/context_test.go
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/integration/context_isolation_tests.rs
{crates/**/src/**/*.rs,python/**/*.py}

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

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

Files:

  • crates/node/src/api/mod.rs
  • crates/python/src/py_types/core.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • python/tests/test_context_isolation.py
**/*.{rs,py,go,js,ts}

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

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

Files:

  • crates/node/src/api/mod.rs
  • go/nemo_relay/nemo_relay.go
  • crates/python/src/py_types/core.rs
  • go/nemo_relay/context_test.go
  • crates/core/src/api/runtime/scope_stack.rs
  • python/tests/test_context_isolation.py
  • crates/core/tests/integration/context_isolation_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:

  • crates/node/src/api/mod.rs
  • go/nemo_relay/nemo_relay.go
  • crates/python/src/py_types/core.rs
  • go/nemo_relay/context_test.go
  • crates/core/src/api/runtime/scope_stack.rs
  • python/tests/test_context_isolation.py
  • crates/core/tests/integration/context_isolation_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/nemo_relay.go
  • go/nemo_relay/context_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/nemo_relay.go
  • go/nemo_relay/context_test.go
**/*.{py,go,js,ts}

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

Keep Python, Go, and Node.js config objects and subscriber/exporter methods aligned so all bindings expose the same logical knobs and semantics.

Files:

  • go/nemo_relay/nemo_relay.go
  • go/nemo_relay/context_test.go
  • python/tests/test_context_isolation.py
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/nemo_relay.go
  • go/nemo_relay/context_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/nemo_relay.go
  • go/nemo_relay/context_test.go
{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/scope_stack.rs
  • crates/core/tests/integration/context_isolation_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/src/api/runtime/scope_stack.rs
  • crates/core/tests/integration/context_isolation_tests.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/scope_stack.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/scope_stack.rs
  • crates/core/tests/integration/context_isolation_tests.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/scope_stack.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/scope_stack.rs
  • crates/core/tests/integration/context_isolation_tests.rs
**/*.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/tests/test_context_isolation.py
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_context_isolation.py
🪛 Ruff (0.15.21)
python/tests/test_context_isolation.py

[warning] 97-97: Unused function argument: restore_native_scope_stack

(ARG001)


[warning] 111-111: Unused function argument: restore_native_scope_stack

(ARG001)

🔇 Additional comments (10)
go/nemo_relay/nemo_relay.go (1)

1581-1635: 📐 Maintainability & Code Quality

Run required Go binding validation.

  • go/nemo_relay/nemo_relay.go#L1581-L1635: run cd go/nemo_relay && go fmt ./... && go vet ./....
  • go/nemo_relay/context_test.go#L335-L376: run just test-go.

As per coding guidelines, “Run Go tests with just test-go” and keep go vet ./... passing.

Source: Coding guidelines

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

1806-1820: 📐 Maintainability & Code Quality

Run required Rust and binding validation.

  • crates/node/src/api/mod.rs#L1806-L1820: run the Rust checks and the repository’s Node test target.
  • crates/python/src/py_types/core.rs#L247-L260: run the Rust checks and the Python test target.

Run cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings, and just test-rust.

As per coding guidelines, “Any Rust change must run just test-rust,” cargo fmt --all, and strict Clippy.

Source: Coding guidelines

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

22-23: LGTM!

Also applies to: 81-87

python/nemo_relay/_native.pyi (1)

1337-1343: LGTM!

python/tests/test_context_isolation.py (1)

60-82: LGTM!

Also applies to: 97-111

crates/core/src/api/runtime/scope_stack.rs (3)

13-16: LGTM!

Also applies to: 59-73, 205-209, 388-394, 409-450


151-155: 🗄️ Data Integrity & Integration

Verify rootless imported-parent marking.

The rootless reconstruction path creates parent_uuid as the synthetic root but does not mark it as the propagated parent, and the regression test does not check that marker.

  • crates/core/src/api/runtime/scope_stack.rs#L151-L155: mark parent_uuid for rootless contexts, or document why exporter parent projection intentionally excludes them.
  • crates/core/tests/integration/context_isolation_tests.rs#L75-L88: assert the intended is_propagated_parent(parent_uuid) behavior.

Source: Path instructions


45-52: 🗄️ Data Integrity & Integration

No parent-name field belongs on the propagation context. The wire contract is UUID-only; propagated-parent is just an internal synthetic handle name, and the docs already describe the supported fields correctly.

			> Likely an incorrect or invalid review comment.
crates/core/tests/integration/context_isolation_tests.rs (1)

9-12: LGTM!

Also applies to: 59-73, 90-104, 106-128, 129-146

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

152-168: LGTM!

Comment thread crates/node/tests/context_tests.mjs
Comment thread python/tests/test_context_isolation.py
Comment thread crates/core/tests/unit/observability/otel_tests.rs

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

approved with nit on missing test case up to you

@willkill07

Copy link
Copy Markdown
Member Author

/merge

@rapids-bot
rapids-bot Bot merged commit 7b7f2ad into NVIDIA:main Jul 28, 2026
67 of 68 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature a new feature 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:XL PR is extra large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement]: Seed isolated scope stacks from external parent context

2 participants