Skip to content

fix(node): preserve async context and flush callbacks - #593

Merged
willkill07 merged 6 commits into
NVIDIA:mainfrom
willkill07:wkk_fix-async-context-follow-up
Jul 31, 2026
Merged

fix(node): preserve async context and flush callbacks#593
willkill07 merged 6 commits into
NVIDIA:mainfrom
willkill07:wkk_fix-async-context-follow-up

Conversation

@willkill07

@willkill07 willkill07 commented Jul 30, 2026

Copy link
Copy Markdown
Member

Overview

Preserve managed propagation context across asynchronous Node.js middleware and provider callbacks, make withScopeStack() Promise-aware, and strengthen subscriber flush completion so it includes managed terminal publications and queued JavaScript subscriber callbacks.

  • 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

Test hardening
  • Add Node regressions for tool, unary-LLM, stream, concurrent-branch, callback-replacement, and asynchronous scope-stack lifetimes.
  • Keep Python cancellation coverage on the normal await subscribers.flush_async() API and verify cancellation-generated END events are delivered before the flush returns.
  • Replace elapsed-time FIFO checks with observable, timeout-bounded synchronization in the Rust dispatcher and pipeline tests.
  • Remove Node event polling and the shared waitForSubscriberCallbacks() workaround in favor of a direct flush.
Semantic changes
  • Capture the active managed propagation parent in the Node Promise bridge and install it with the callback scope stack across await boundaries.
  • Keep withScopeStack() active until a returned Promise settles, restore the caller immediately, and expire inherited detached context afterward.
  • Expire scope-stack and propagation-parent state when scoped streams end and when callback replacement stores settle.
  • Make public subscriber flushes wait for registered unary LLM, tool, and conditional-guardrail terminal publications, plus JavaScript subscriber callbacks queued by the native drain.
  • Preserve plugin teardown behavior with its queued-publication-only internal barrier, so registries can detach while earlier callback snapshots remain in flight.
API changes
  • No public function signatures or wire formats change.
  • withScopeStack() now has an asynchronous lifetime when its callback returns a Promise; setThreadScopeStack() remains a current-thread/current-async-resource mutation.
  • The public flush contract is stronger: it waits for managed terminal publications registered before the flush and for queued JavaScript subscriber callbacks.
Everything else
  • Document the asynchronous withScopeStack() lifecycle, concurrent-branch guidance, current-resource semantics of setThreadScopeStack(), and the stronger subscriber-flush contract.

Validation:

  • just test-node: 344 passed.
  • just test-python: 610 passed.
  • cargo fmt --all -- --check: passed.
  • cargo clippy --workspace --all-targets -- -D warnings: passed.
  • just docs: passed (remote redirect comparison skipped after FDR returned HTTP 403; local documentation checks passed).
  • uv run pre-commit run --all-files: passed.
  • Stress: 96 independent Node subscriber-heavy and 96 targeted typed-subscriber suite processes at 48-way concurrency; 96 targeted Rust pipeline and dispatcher processes at 48-way concurrency; no failures.

Where should the reviewer start?

Start with crates/node/src/callback_factory.rs and crates/node/src/promise_call.rs for callback context, crates/core/src/api/runtime/subscriber_dispatcher.rs for flush completion, and the Node and Rust regression tests in crates/node/tests/ and crates/core/tests/.

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

  • Relates to: none

Summary by CodeRabbit

  • New Features

    • Subscriber flush operations now wait for registered terminal publications and JavaScript subscriber callbacks.
    • Added a queued-only flush option for workflows that don’t require pending operations to finish.
    • Asynchronous scope isolation remains active until each branch’s Promise settles.
    • Propagation context is preserved across awaited callbacks.
  • Bug Fixes

    • Improved callback-context cleanup after stream and provider completion.
    • Prevented concurrent async branches from interfering with one another’s scope context.
  • Documentation

    • Updated Node.js and Python guidance for subscriber flushing and concurrent scope management.

Signed-off-by: Will Killian <wkillian@nvidia.com>
@willkill07
willkill07 requested review from a team as code owners July 30, 2026 22:16
@github-actions github-actions Bot added size:M PR is medium Bug issue describes bug; PR fixes bug lang:js PR changes/introduces Javascript/Typescript code lang:python PR changes/introduces Python code lang:rust PR changes/introduces Rust code labels Jul 30, 2026
@coderabbitai

coderabbitai Bot commented Jul 30, 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

Async context and publication synchronization

Layer / File(s) Summary
Callback context lifecycle
crates/node/src/callback_factory.rs, crates/node/src/api/mod.rs, crates/node/tests/context_tests.mjs, docs/about-nemo-relay/concepts/scopes.mdx
Promise-aware callbacks retain scope and propagation context until settlement, and stream completion explicitly expires the context.
Middleware propagation bridge
crates/node/src/promise_call.rs
Middleware calls capture and forward propagation parent UUIDs from Rust into JavaScript callbacks.
Pending publication tracking
crates/core/src/api/runtime/subscriber_dispatcher.rs, crates/core/src/api/{llm.rs,tool.rs}, crates/core/src/api/runtime/state.rs, crates/node/src/{api/mod.rs,callable.rs}, crates/{node,python}/...
Managed terminal publications and JavaScript subscriber callbacks are tracked, while inclusive and queued-only flushes expose separate completion guarantees.
Synchronization and context validation
crates/core/tests/{integration,unit}/*, crates/node/tests/*.mjs
Tests verify flush blocking, pending completion release, queued-only behavior, JavaScript callback completion, propagation preservation, concurrent scope isolation, and stream END ordering.

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

Sequence Diagram(s)

sequenceDiagram
  participant ManagedExecution
  participant CallbackFactory
  participant Provider
  participant SubscriberDispatcher
  ManagedExecution->>CallbackFactory: establish scope and propagation context
  CallbackFactory->>Provider: invoke callback across await
  Provider-->>CallbackFactory: settle callback or stream
  CallbackFactory->>CallbackFactory: expire callback context
  ManagedExecution->>SubscriberDispatcher: register terminal publication
  SubscriberDispatcher-->>ManagedExecution: release publication on completion
Loading
sequenceDiagram
  participant FlushCaller
  participant SubscriberDispatcher
  participant ManagedCompletion
  participant JavaScriptSubscriber
  FlushCaller->>SubscriberDispatcher: flush_subscribers()
  SubscriberDispatcher->>ManagedCompletion: wait for pending terminal publication
  SubscriberDispatcher->>JavaScriptSubscriber: wait for queued callback
  ManagedCompletion->>SubscriberDispatcher: complete or cancel publication
  JavaScriptSubscriber-->>SubscriberDispatcher: callback completes
  SubscriberDispatcher-->>FlushCaller: flush completes
Loading

Possibly related PRs

  • NVIDIA/NeMo-Relay#558 — Covers related async sanitizer, middleware, and subscriber-dispatch changes.
  • NVIDIA/NeMo-Relay#589 — Covers related asynchronous scope-stack isolation and propagation-parent preservation.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title follows Conventional Commits format, uses an allowed lowercase type and scope, is concise, and is 53 characters without a trailing period.
Description check ✅ Passed The description includes all template sections, detailed semantic and API changes, reviewer guidance, related-issue status, and comprehensive validation results.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@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/core/tests/integration/pipeline_tests.rs`:
- Around line 2089-2104: Update the synchronization in the test around
flush_subscribers so the readiness signal is sent from an observable point
inside the flush/subscriber pipeline, after flush_subscribers has begun
processing and is blocked on the pending stream END, rather than from the
spawned thread immediately before the call. Keep the timeout assertion tied to
that actual flush progress and preserve coverage that flush_subscribers does not
complete until the pending stream ends.

In `@crates/node/src/callback_factory.rs`:
- Around line 233-258: Update the callback lifecycle around
setCallbackScopeStack() and expire() so expiration also clears any replacement
AsyncLocalStorage store installed via enterWith, including stores created by
detached work after setThreadScopeStack(). Use shared lifecycle state or
otherwise track replacement stores, and ensure both scopeStack and
propagationParentUuid are cleared when the returned value or Promise settles.
🪄 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: 66d0acd2-7b1b-4255-92cb-84f17dcd1681

📥 Commits

Reviewing files that changed from the base of the PR and between 85be560 and 20f805d.

📒 Files selected for processing (9)
  • crates/core/tests/integration/pipeline_tests.rs
  • crates/node/src/api/mod.rs
  • crates/node/src/callback_factory.rs
  • crates/node/src/promise_call.rs
  • crates/node/tests/context_tests.mjs
  • crates/node/tests/llm_tests.mjs
  • crates/node/tests/tools_tests.mjs
  • docs/about-nemo-relay/concepts/scopes.mdx
  • python/tests/test_llm.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 (26)
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/node/tests/tools_tests.mjs
  • crates/node/tests/llm_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/tests/tools_tests.mjs
  • crates/node/tests/llm_tests.mjs
  • crates/core/tests/integration/pipeline_tests.rs
  • python/tests/test_llm.py
  • crates/node/src/api/mod.rs
  • crates/node/src/callback_factory.rs
  • crates/node/src/promise_call.rs
**/*

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

**/*: Format changed files with the language-native formatter before the final lint/test pass.
If dynamic plugin behavior changed, use maintain-dynamic-plugins and include the native SDK, worker protocol, Python SDK, docs, packaging, and Codecov surfaces in the validation plan.
If code changes alter APIs, bindings, commands, paths, packaging behavior, observability/adaptive semantics, or documented best practices, update any dependent maintainer or consumer skills in the same branch.
During iteration, prefer uv run pre-commit run --files <changed files...>.
Before review or handoff, run uv run pre-commit run --all-files.

Files:

  • crates/node/tests/context_tests.mjs
  • docs/about-nemo-relay/concepts/scopes.mdx
  • crates/node/tests/tools_tests.mjs
  • crates/node/tests/llm_tests.mjs
  • crates/core/tests/integration/pipeline_tests.rs
  • python/tests/test_llm.py
  • crates/node/src/api/mod.rs
  • crates/node/src/callback_factory.rs
  • crates/node/src/promise_call.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/tests/tools_tests.mjs
  • crates/node/tests/llm_tests.mjs
  • crates/node/src/api/mod.rs
  • crates/node/src/callback_factory.rs
  • crates/node/src/promise_call.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
  • crates/node/tests/tools_tests.mjs
  • crates/node/tests/llm_tests.mjs
  • crates/core/tests/integration/pipeline_tests.rs
  • python/tests/test_llm.py
**/*.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
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
**/*.{md,mdx,py,go,js,ts}

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

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

Files:

  • docs/about-nemo-relay/concepts/scopes.mdx
  • python/tests/test_llm.py
{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
**/*.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/integration/pipeline_tests.rs
  • crates/node/src/api/mod.rs
  • crates/node/src/callback_factory.rs
  • crates/node/src/promise_call.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/pipeline_tests.rs
crates/core/**/*.rs

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

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

Files:

  • crates/core/tests/integration/pipeline_tests.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • crates/core/tests/integration/pipeline_tests.rs
  • python/tests/test_llm.py
  • crates/node/src/api/mod.rs
  • crates/node/src/callback_factory.rs
  • crates/node/src/promise_call.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/integration/pipeline_tests.rs
  • python/tests/test_llm.py
  • crates/node/src/api/mod.rs
  • crates/node/src/callback_factory.rs
  • crates/node/src/promise_call.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/integration/pipeline_tests.rs
  • crates/node/src/api/mod.rs
  • crates/node/src/callback_factory.rs
  • crates/node/src/promise_call.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/pipeline_tests.rs
**/*.{rs,py,go,js,ts}

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

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

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

Files:

  • crates/core/tests/integration/pipeline_tests.rs
  • python/tests/test_llm.py
  • crates/node/src/api/mod.rs
  • crates/node/src/callback_factory.rs
  • crates/node/src/promise_call.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/integration/pipeline_tests.rs
  • python/tests/test_llm.py
  • crates/node/src/api/mod.rs
  • crates/node/src/callback_factory.rs
  • crates/node/src/promise_call.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/pipeline_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_llm.py
{crates/**/src/**/*.rs,python/**/*.py}

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

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

Files:

  • python/tests/test_llm.py
  • crates/node/src/api/mod.rs
  • crates/node/src/callback_factory.rs
  • crates/node/src/promise_call.rs
python/tests/**/*.py

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

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

Files:

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

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

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

Files:

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

Applied to files:

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

[warning] 639-639: Missing return type annotation for private function wait_for_end_publication

Add return type annotation: None

(ANN202)


[warning] 701-701: Missing return type annotation for private function wait_for_end_publication

Add return type annotation: None

(ANN202)

🔇 Additional comments (9)
python/tests/test_llm.py (1)

639-647: LGTM!

Also applies to: 701-711

crates/node/src/callback_factory.rs (3)

72-72: LGTM!

Also applies to: 101-109, 170-170, 193-193


275-282: LGTM!

Also applies to: 390-395


13-13: 📐 Maintainability & Code Quality

Run the Rust and Node binding checks for these changes.

  • crates/node/src/callback_factory.rs#L13-L13: callback-factory lifecycle
  • crates/node/src/api/mod.rs#L488-L491: stream-end cleanup
  • crates/node/src/promise_call.rs#L28-L29: middleware propagation plumbing

cargo fmt --all
cargo clippy --workspace --all-targets -- -D warnings
just test-rust
just test-node

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

1724-1730: LGTM!

Also applies to: 1759-1762

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

187-199: LGTM!

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

94-115: LGTM!

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

1128-1176: LGTM!

Also applies to: 1652-1675

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

1010-1049: LGTM!

Also applies to: 1178-1205

Comment thread crates/core/tests/integration/pipeline_tests.rs
Comment thread crates/node/src/callback_factory.rs Outdated
@github-actions

Copy link
Copy Markdown

@willkill07 willkill07 added this to the 0.7 milestone Jul 30, 2026
@willkill07 willkill07 self-assigned this Jul 30, 2026
Signed-off-by: Will Killian <wkillian@nvidia.com>
@github-actions github-actions Bot added size:L PR is large and removed size:M PR is medium labels Jul 30, 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/node/README.md`:
- Around line 106-108: Update the shutdown guidance in the README to explicitly
state that one setImmediate turn only allows queued synchronous subscriber
callbacks to run; it does not await promises, timers, or I/O started by async
subscribers. Clarify that this behavior does not guarantee completion or
delivery of asynchronous subscriber effects.

In `@crates/node/src/api/mod.rs`:
- Around line 3322-3323: Update the documentation for flush_subscribers to state
that it resolves immediately when invoked from an active publication callback,
matching the restriction in python/nemo_relay/_native.pyi; do not alter the
implementation.
🪄 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: f1db05a5-10b0-4912-bd5f-3693e6721dc1

📥 Commits

Reviewing files that changed from the base of the PR and between 20f805d and 65c3f19.

📒 Files selected for processing (12)
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
  • crates/core/src/api/subscriber.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/plugin.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/node/README.md
  • crates/node/src/api/mod.rs
  • python/nemo_relay/_native.pyi
  • python/nemo_relay/subscribers.py
📜 Review details
🧰 Additional context used
📓 Path-based instructions (32)
**/*.rs

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

**/*.rs: Any Rust change must run just test-rust
Any Rust change must run cargo fmt --all
Any Rust change must run cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all for all FFI work since it is Rust work
Run just test-rust to validate FFI changes
Run cargo clippy --workspace --all-targets -- -D warnings to enforce strict linting on FFI work

When Rust files changed as part of Go work, also run cargo fmt --all, just test-rust, and cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all when Rust files are changed as part of Node work
Run cargo clippy --workspace --all-targets -- -D warnings when Rust files are changed as part of Node work
Run just test-rust when Rust files are changed as part of Node work

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

**/*.rs: If any Rust code changed, always run just test-rust.
If any Rust code changed, also run cargo fmt --all.
If any Rust code changed, also run cargo clippy --workspace --all-targets -- -D warnings.
For Rust changes headed for review, run cargo fmt --all and cargo clippy --workspace --all-targets -- -D warnings even if relying on pre-commit.

Files:

  • crates/core/src/api/subscriber.rs
  • crates/core/src/plugin.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/tool.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/node/src/api/mod.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
{crates/core,crates/adaptive}/**/*

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

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

Files:

  • crates/core/src/api/subscriber.rs
  • crates/core/src/plugin.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/tool.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.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/subscriber.rs
  • crates/core/src/plugin.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/tool.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • crates/core/src/api/subscriber.rs
  • python/nemo_relay/subscribers.py
  • crates/core/src/plugin.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/tool.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/node/src/api/mod.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • crates/core/src/api/subscriber.rs
  • python/nemo_relay/subscribers.py
  • crates/core/src/plugin.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/tool.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/node/src/api/mod.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
**/*.{rs,py,go,js,ts,c,h}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

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

Files:

  • crates/core/src/api/subscriber.rs
  • python/nemo_relay/subscribers.py
  • crates/core/src/plugin.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/tool.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/node/src/api/mod.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
**/*.{rs,go,js,ts}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

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

Files:

  • crates/core/src/api/subscriber.rs
  • crates/core/src/plugin.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/tool.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/node/src/api/mod.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.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/subscriber.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.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/subscriber.rs
  • python/nemo_relay/subscribers.py
  • crates/core/src/plugin.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/tool.rs
  • crates/node/src/api/mod.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
**/*

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

**/*: Format changed files with the language-native formatter before the final lint/test pass.
If dynamic plugin behavior changed, use maintain-dynamic-plugins and include the native SDK, worker protocol, Python SDK, docs, packaging, and Codecov surfaces in the validation plan.
If code changes alter APIs, bindings, commands, paths, packaging behavior, observability/adaptive semantics, or documented best practices, update any dependent maintainer or consumer skills in the same branch.
During iteration, prefer uv run pre-commit run --files <changed files...>.
Before review or handoff, run uv run pre-commit run --all-files.

Files:

  • crates/core/src/api/subscriber.rs
  • python/nemo_relay/subscribers.py
  • crates/core/src/plugin.rs
  • crates/node/README.md
  • crates/core/src/api/runtime/state.rs
  • python/nemo_relay/_native.pyi
  • crates/core/src/api/tool.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/node/src/api/mod.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.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/subscriber.rs
  • crates/core/src/plugin.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/tool.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
**/*.{rs,py,go,js,ts}

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

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

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

Files:

  • crates/core/src/api/subscriber.rs
  • python/nemo_relay/subscribers.py
  • crates/core/src/plugin.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/tool.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/node/src/api/mod.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.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/subscriber.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.rs
**/*.{rs,py,js,ts,tsx,go,java,kt,swift}

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

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

Files:

  • crates/core/src/api/subscriber.rs
  • python/nemo_relay/subscribers.py
  • crates/core/src/plugin.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/tool.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/node/src/api/mod.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.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/subscriber.rs
  • crates/core/src/plugin.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/tool.rs
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/subscriber_dispatcher.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/subscribers.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/subscribers.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/subscribers.py
  • python/nemo_relay/_native.pyi
  • crates/node/src/api/mod.rs
{python/nemo_relay/**/*.py,python/nemo_relay/**/*.pyi,go/nemo_relay/**/*.go}

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

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

Files:

  • python/nemo_relay/subscribers.py
  • python/nemo_relay/_native.pyi
**/*.{md,mdx,py,go,js,ts}

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

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

Files:

  • python/nemo_relay/subscribers.py
  • crates/node/README.md
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/subscribers.py
  • python/nemo_relay/_native.pyi
**/*.{md,rst,html,txt}

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

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

Files:

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

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

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

Files:

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

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

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

Files:

  • crates/node/README.md
**/*.{md,rst}

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

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

Files:

  • crates/node/README.md
**/*.md

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

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

Files:

  • crates/node/README.md
**/*.{md,mdx}

📄 CodeRabbit inference engine (AGENTS.md)

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

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

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

Files:

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

📄 CodeRabbit inference engine (CONTRIBUTING.md)

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

Files:

  • crates/node/README.md
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/README.md
  • crates/node/src/api/mod.rs
crates/core/src/api/runtime/state.rs

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

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

Files:

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

Applied to files:

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

Applied to files:

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

Applied to files:

  • crates/node/src/api/mod.rs
🔇 Additional comments (11)
crates/core/src/api/llm.rs (1)

25-26: LGTM!

Also applies to: 1213-1237, 1240-1242, 1322-1322

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

114-120: 📐 Maintainability & Code Quality

Verify Required Core Runtime Validation

Attach successful Rust, Python, Go, and Node validation results, plus cargo fmt --all, just test-rust, cargo clippy --workspace --all-targets -- -D warnings, cargo deny check, and validate-change. As per coding guidelines: “Changes to crates/core or crates/adaptive must run the full language matrix” and core changes must use validate-change.

Source: Coding guidelines


131-131: LGTM!

Also applies to: 253-267, 358-360, 577-636, 801-909, 1204-1251

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

158-185: LGTM!

Also applies to: 204-204

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

11-12: LGTM!

Also applies to: 599-623, 626-643

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

1824-1824: LGTM!

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

73-75: LGTM!

python/nemo_relay/_native.pyi (1)

1979-1979: LGTM!

python/nemo_relay/subscribers.py (1)

190-196: LGTM!

Also applies to: 222-227

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

85-109: LGTM!

Also applies to: 1973-1974, 2114-2114, 2258-2258

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

5-7: LGTM!

Also applies to: 54-57, 99-152, 164-167, 686-689

Comment thread crates/node/README.md Outdated
Comment thread crates/node/src/api/mod.rs Outdated
Comment on lines +3322 to +3323
/// Return a Promise that resolves when native subscriber callbacks and managed
/// terminal publications registered before this call finish.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Document the reentrant callback exception.

This promises completion of all prior publications, but flush_subscribers resolves immediately when called from an active publication callback. Add the same restriction documented by python/nemo_relay/_native.pyi, or change the implementation so the guarantee also holds reentrantly.

🤖 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/node/src/api/mod.rs` around lines 3322 - 3323, Update the
documentation for flush_subscribers to state that it resolves immediately when
invoked from an active publication callback, matching the restriction in
python/nemo_relay/_native.pyi; do not alter the implementation.

Signed-off-by: Will Killian <wkillian@nvidia.com>
@willkill07 willkill07 changed the title fix(node): preserve async callback context fix(node): preserve async context and flush callbacks Jul 30, 2026
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/subscriber_dispatcher_tests.rs`:
- Around line 366-367: Update the barrier synchronization in the subscriber
dispatcher tests, including the outer_started and release_outer waits and the
additional referenced waits, to use timeout-aware synchronization such as timed
channel receives or a bounded barrier strategy. Ensure timeout failures include
diagnostic context and cause the test to fail rather than hanging indefinitely,
while preserving the existing synchronization behavior on success.
🪄 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: 0407560b-4541-4f21-a49c-11282f9aceee

📥 Commits

Reviewing files that changed from the base of the PR and between 504d5e5 and 040c3be.

📒 Files selected for processing (1)
  • crates/core/tests/unit/subscriber_dispatcher_tests.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 (13)
**/*.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/subscriber_dispatcher_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/subscriber_dispatcher_tests.rs
crates/core/**/*.rs

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

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

Files:

  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • crates/core/tests/unit/subscriber_dispatcher_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/core/tests/unit/subscriber_dispatcher_tests.rs
**/*.{rs,go,js,ts}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

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

Files:

  • crates/core/tests/unit/subscriber_dispatcher_tests.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/subscriber_dispatcher_tests.rs
crates/{core,adaptive}/**/*

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

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

Files:

  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
**/*.{rs,py,go,js,ts}

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

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

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

Files:

  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
**/*.{rs,py,js,ts,tsx,go,java,kt,swift}

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

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

Files:

  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
crates/{core,adaptive}/**/*.rs

⚙️ CodeRabbit configuration file

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

Files:

  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}

⚙️ CodeRabbit configuration file

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

Files:

  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
🔇 Additional comments (1)
crates/core/tests/unit/subscriber_dispatcher_tests.rs (1)

5-13: LGTM!

Also applies to: 54-57, 99-153, 164-167, 694-697

Comment thread crates/core/tests/unit/subscriber_dispatcher_tests.rs Outdated
…xt-follow-up

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

# Conflicts:
#	crates/core/tests/integration/pipeline_tests.rs

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

Caution

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

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

13-13: 📐 Maintainability & Code Quality | 🔵 Trivial

Run the required validation checks before handoff.

Apply validate-change for this crates/core Rust change: cargo fmt --all, just test-rust, cargo clippy --workspace --all-targets -- -D warnings, just test-python, just test-go, just test-node, and uv run pre-commit run --all-files.

🤖 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/subscriber_dispatcher_tests.rs` at line 13, Before
handing off the crates/core Rust change, run the required validation checks:
cargo fmt --all, just test-rust, cargo clippy --workspace --all-targets -- -D
warnings, just test-python, just test-go, just test-node, and uv run pre-commit
run --all-files.

Sources: Coding guidelines, 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.

Outside diff comments:
In `@crates/core/tests/unit/subscriber_dispatcher_tests.rs`:
- Line 13: Before handing off the crates/core Rust change, run the required
validation checks: cargo fmt --all, just test-rust, cargo clippy --workspace
--all-targets -- -D warnings, just test-python, just test-go, just test-node,
and uv run pre-commit run --all-files.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: f9bb9491-b241-46a6-96e0-6fa3cb944711

📥 Commits

Reviewing files that changed from the base of the PR and between 040c3be and 884ee19.

📒 Files selected for processing (1)
  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Preview docs
🧰 Additional context used
📓 Path-based instructions (13)
**/*.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/subscriber_dispatcher_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/subscriber_dispatcher_tests.rs
crates/core/**/*.rs

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

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

Files:

  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • crates/core/tests/unit/subscriber_dispatcher_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/core/tests/unit/subscriber_dispatcher_tests.rs
**/*.{rs,go,js,ts}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

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

Files:

  • crates/core/tests/unit/subscriber_dispatcher_tests.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/subscriber_dispatcher_tests.rs
crates/{core,adaptive}/**/*

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

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

Files:

  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
**/*.{rs,py,go,js,ts}

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

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

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

Files:

  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
**/*.{rs,py,js,ts,tsx,go,java,kt,swift}

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

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

Files:

  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
crates/{core,adaptive}/**/*.rs

⚙️ CodeRabbit configuration file

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

Files:

  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}

⚙️ CodeRabbit configuration file

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

Files:

  • crates/core/tests/unit/subscriber_dispatcher_tests.rs
🔇 Additional comments (8)
crates/core/tests/unit/subscriber_dispatcher_tests.rs (8)

54-57: LGTM!


99-153: LGTM!


164-167: LGTM!


366-368: LGTM!


420-433: LGTM!


475-477: LGTM!


489-491: LGTM!


704-707: LGTM!

Signed-off-by: Will Killian <wkillian@nvidia.com>
@willkill07
willkill07 merged commit cc72c3e into NVIDIA:main Jul 31, 2026
80 of 81 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug issue describes bug; PR fixes bug lang:js PR changes/introduces Javascript/Typescript code lang:python PR changes/introduces Python code lang:rust PR changes/introduces Rust code size:L PR is large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant