refactor: define shared agent-payload and provider-schema extraction strategies#318
refactor: define shared agent-payload and provider-schema extraction strategies#318yczhang-nv wants to merge 12 commits into
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThe PR centralizes provider codec dispatch behind descriptors, passes event names as normalization hints, adds shared extractor traits for agent payloads and request alignment, and expands docs and tests around the new extraction boundaries. ChangesDescriptor-driven extraction and normalization
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error, 1 warning)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Signed-off-by: Yuchen Zhang <yuchenz@nvidia.com>
f62642e to
655f4c2
Compare
There was a problem hiding this comment.
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/cli/src/adapters/mod.rs`:
- Around line 120-132: The normalized metadata builder in the adapter should
stop propagating user_email, since it is currently inserted alongside other
fields and later exported in traces. Update the metadata normalization logic in
the function that iterates over the payload keys to omit user_email entirely, or
only include it behind an explicit redaction/opt-in gate. Keep the existing
handling for cwd, transcript_path, project_dir, model, agent_id, and agent_type
unchanged.
In `@crates/core/src/codec/anthropic.rs`:
- Around line 43-50: The Anthropic request detector in PROVIDER_SURFACE is too
narrow because detect_request only checks for a top-level system field, so raw
Anthropic Messages requests without system get misrouted to OpenAIChat. Update
the AnthropicMessages surface detection to recognize another Anthropic-specific
discriminator or use provider context in
resolve_request_surface/normalize_request, and ensure AnthropicMessagesCodec is
selected for no-system requests. Add a regression test around the Anthropic
detector and surface resolution for the no-system case.
🪄 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: 7cad5b0d-f873-4f2c-89ba-d70d00f2a393
📒 Files selected for processing (8)
crates/cli/src/adapters/mod.rscrates/cli/src/alignment/mod.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/resolve.rscrates/core/tests/unit/codec/resolve_tests.rsdocs/about-nemo-relay/concepts/codecs.mdx
📜 Review details
🧰 Additional context used
📓 Path-based instructions (25)
**/*.rs
📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)
Use
snake_casenaming convention for Rust identifiers (e.g.,nemo_relay_tool_call)
**/*.rs: Any Rust change must runjust test-rust
Any Rust change must runcargo fmt --all
Any Rust change must runcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allfor all FFI work since it is Rust work
Runjust test-rustto validate FFI changes
Runcargo clippy --workspace --all-targets -- -D warningsto enforce strict linting on FFI workWhen Rust files changed as part of Go work, also run
cargo fmt --all,just test-rust, andcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allwhen Rust files are changed as part of Node work
Runcargo clippy --workspace --all-targets -- -D warningswhen Rust files are changed as part of Node work
Runjust test-rustwhen Rust files are changed as part of Node work
**/*.rs: Runcargo fmt --allto format all Rust code
Runcargo clippy --workspace --all-targets -- -D warningsto enforce all clippy lints as errors
**/*.rs: Runcargo fmt --allwhen Rust files changed as part of WebAssembly work
Runcargo clippy --workspace --all-targets -- -D warningswhen Rust files changed as part of WebAssembly work
**/*.rs: If any Rust code changed, always runjust test-rust
If any Rust code changed, also runcargo fmt --all
If any Rust code changed, also runcargo clippy --workspace --all-targets -- -D warnings
Run Rust formatting withcargo fmt --all
Run Rust linting withcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Usecargo fmtfor Rust code formatting
Runcargo clippy -- -D warningsto lint Rust code and treat all warnings as errors
Use Rust snake_case naming convention for Rust identifiers
Include SPDX license header in all Rust source files using double-slash comment syntax
Validate Rust code withuv run pre-commit run --all-filesto enforce cargo fmt formatting check, cargo clippy lints, and cargo deny aud...
Files:
crates/core/tests/unit/codec/resolve_tests.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/resolve.rscrates/cli/src/alignment/mod.rscrates/cli/src/adapters/mod.rs
{crates/adaptive/**/*.rs,**/*test*.{rs,py,go,ts,js},**/*adaptive*test*.{rs,py,go,ts,js},docs/plugins/adaptive/**}
📄 CodeRabbit inference engine (.agents/skills/maintain-optimizer/SKILL.md)
Maintain documented and tested validation and report behavior for adaptive surfaces
Files:
crates/core/tests/unit/codec/resolve_tests.rs
**/{Cargo.toml,**/*.rs}
📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)
Maintain consistency between Rust package names in
Cargo.tomland their actual usage across the codebase
Files:
crates/core/tests/unit/codec/resolve_tests.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/resolve.rscrates/cli/src/alignment/mod.rscrates/cli/src/adapters/mod.rs
**/*.{h,hpp,c,cpp,rs}
📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)
Ensure FFI header and library naming follows consistent conventions across platform-specific builds
Files:
crates/core/tests/unit/codec/resolve_tests.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/resolve.rscrates/cli/src/alignment/mod.rscrates/cli/src/adapters/mod.rs
{crates/core,crates/adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
Changes to
crates/coreorcrates/adaptivemust run the full language matrix
Files:
crates/core/tests/unit/codec/resolve_tests.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/resolve.rs
**/*.{rs,toml}
📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)
Update Rust crate names and module prefixes during coordinated rename operations
Files:
crates/core/tests/unit/codec/resolve_tests.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/resolve.rscrates/cli/src/alignment/mod.rscrates/cli/src/adapters/mod.rs
crates/core/**/*.rs
📄 CodeRabbit inference engine (.agents/skills/test-go-binding/SKILL.md)
If the change touched
crates/coreor shared runtime semantics, also usevalidate-changefor broader validation
crates/core/**/*.rs: UseJson = serde_json::Valuein Rust-facing runtime APIs where the existing code expects JSON payloads.
UseResult<T>withFlowErrorin core runtime paths. Keep errors explicit and binding-appropriate at the wrapper layer.
Files:
crates/core/tests/unit/codec/resolve_tests.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/resolve.rs
crates/{core,adaptive}/**
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If
crates/coreorcrates/adaptivechanged, run the full matrix across Rust, Python, Go, Node.js, and WebAssembly
Files:
crates/core/tests/unit/codec/resolve_tests.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/resolve.rs
**/*.{rs,py,js,ts,tsx,jsx,go,sh,toml,yaml,yml,md}
📄 CodeRabbit inference engine (AGENTS.md)
Keep SPDX headers on source, docs, scripts, and configuration files. The project is Apache-2.0.
Files:
crates/core/tests/unit/codec/resolve_tests.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/resolve.rscrates/cli/src/alignment/mod.rscrates/cli/src/adapters/mod.rs
**/*.{rs,py,go,js,ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Follow binding naming conventions: Rust and Python use
snake_case, C FFI exports prefixednemo_relay_, Go usesPascalCasefor public APIs, Node.js usescamelCase.
Files:
crates/core/tests/unit/codec/resolve_tests.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/resolve.rscrates/cli/src/alignment/mod.rscrates/cli/src/adapters/mod.rs
crates/**/*.rs
📄 CodeRabbit inference engine (AGENTS.md)
crates/**/*.rs: Keep async behavior on the existing tokio-based model. Bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.
UseJson = serde_json::Valuein Rust-facing runtime APIs for JSON payload handling.
Files:
crates/core/tests/unit/codec/resolve_tests.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/resolve.rscrates/cli/src/alignment/mod.rscrates/cli/src/adapters/mod.rs
**
⚙️ CodeRabbit configuration file
**:AGENTS.md
This file provides guidance to agents, including Claude Code and OpenAI Codex, when working in this repository.
Project Overview
NeMo Relay is a multi-language agent runtime framework for execution scopes, lifecycle events, middleware, plugins, and observability around tool and LLM calls. The core runtime is Rust. Primary supported bindings are Rust, Python, and Node.js. Go, WebAssembly, and the raw C FFI are experimental and source-first.
The shared runtime model is:
- Scope stacks decide where work belongs and which scope-local behavior is visible.
- Middleware registries decide what guardrails and intercepts run around managed calls.
- Plugins install reusable runtime behavior from configuration.
- Events record runtime behavior in ATOF form.
- Subscribers and exporters consume events in-process or export them to ATIF, OpenTelemetry, OpenInference, or other backends.
Repository Structure
The repository layout separates the Rust runtime, language bindings, documentation,
integration patches, and agent-facing skills.crates/ core/ # Rust core runtime crate, published as nemo-relay adaptive/ # Adaptive runtime primitives and plugin components python/ # PyO3 native extension for the Python package ffi/ # Raw C ABI layer used by downstream bindings such as Go node/ # NAPI Node.js binding and JavaScript/TypeScript entry points wasm/ # wasm-bindgen WebAssembly binding and JS wrappers python/ nemo_relay/ # Python wrapper package: scopes, tools, LLM, middleware, typed helpers, plugins, adaptive helpers tests/ # Python tests go/ nemo_relay/ # Experimental Go CGo binding and tests fern/ # Fern documentation site scripts/ # Stable wrappers and helper scripts; build/test/docs entry points live in justfile third_party/ # P...
Files:
crates/core/tests/unit/codec/resolve_tests.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rsdocs/about-nemo-relay/concepts/codecs.mdxcrates/core/src/codec/resolve.rscrates/cli/src/alignment/mod.rscrates/cli/src/adapters/mod.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/codec/resolve_tests.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/resolve.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/codec/resolve_tests.rs
{docs/**,README.md,CONTRIBUTING.md}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
{docs/**,README.md,CONTRIBUTING.md}: For docs-only changes, run targeted checks only if commands, package names, or examples changed. Usejust docsfor docs-site builds andjust docs-linkcheckwhen links changed
Run docs site build withjust docs
Files:
docs/about-nemo-relay/concepts/codecs.mdx
{docs/**,README.md,CONTRIBUTING.md,**/*.md}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
Run docs link validation with
just docs-linkcheckwhen links change
Files:
docs/about-nemo-relay/concepts/codecs.mdx
{docs/**,README.md}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
Verify README and docs entry points still match current package names and paths for large or public-facing changes
Files:
docs/about-nemo-relay/concepts/codecs.mdx
{docs/**,examples/**,README.md}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
Verify examples still run with documented commands for large or public-facing changes
Files:
docs/about-nemo-relay/concepts/codecs.mdx
{docs/**,README.md,**/Cargo.toml,**/package.json,**/*.md}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
Ensure renamed public surfaces are reflected consistently in manifests and docs for large or public-facing changes
Files:
docs/about-nemo-relay/concepts/codecs.mdx
**/*.{md,mdx,py,sh,yaml,yml,toml,json}
📄 CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md)
Keep package names, repo references, and build commands current
Files:
docs/about-nemo-relay/concepts/codecs.mdx
**/*.mdx
📄 CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md)
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.
MDX top-of-file SPDX comments must use {/* ... */} delimiters instead of HTML comment delimiters (Must-Fix)
Files:
docs/about-nemo-relay/concepts/codecs.mdx
**/*.{html,md,mdx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Include SPDX license header in HTML and Markdown files using HTML comment syntax
Files:
docs/about-nemo-relay/concepts/codecs.mdx
docs/**/*.{md,mdx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Update embedded documentation snippets, patch docs, and binding-support notes if examples or supported bindings changed
Files:
docs/about-nemo-relay/concepts/codecs.mdx
docs/**
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Run
just docsor./scripts/build-docs.sh htmlto regenerate ignored Fern API reference pages before validation for documentation site changes
Files:
docs/about-nemo-relay/concepts/codecs.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/codecs.mdx
🔇 Additional comments (3)
docs/about-nemo-relay/concepts/codecs.mdx (1)
83-131: LGTM!crates/cli/src/adapters/mod.rs (1)
34-118: LGTM!Also applies to: 133-321, 335-386
crates/core/src/codec/resolve.rs (1)
27-53: 📐 Maintainability & Code QualityAdd the required core-runtime validation before merge.
This changes
crates/corecodec dispatch, but the PR validation list still omitscargo clippy --workspace --all-targets -- -D warnings, the full binding test matrix, andvalidate-change. Please include those runs so the shared runtime contract is exercised outside the Rust-only path.As per coding guidelines, "If
crates/coreorcrates/adaptivechanged, run the full matrix across Rust, Python, Go, Node.js, and WebAssembly" and "If the change touchedcrates/coreor shared runtime semantics, also usevalidate-changefor broader validation."Also applies to: 92-103
Source: Coding guidelines
There was a problem hiding this comment.
Caution
Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
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/cli/src/adapters/mod.rs`:
- Around line 120-132: The normalized metadata builder in the adapter should
stop propagating user_email, since it is currently inserted alongside other
fields and later exported in traces. Update the metadata normalization logic in
the function that iterates over the payload keys to omit user_email entirely, or
only include it behind an explicit redaction/opt-in gate. Keep the existing
handling for cwd, transcript_path, project_dir, model, agent_id, and agent_type
unchanged.
In `@crates/core/src/codec/anthropic.rs`:
- Around line 43-50: The Anthropic request detector in PROVIDER_SURFACE is too
narrow because detect_request only checks for a top-level system field, so raw
Anthropic Messages requests without system get misrouted to OpenAIChat. Update
the AnthropicMessages surface detection to recognize another Anthropic-specific
discriminator or use provider context in
resolve_request_surface/normalize_request, and ensure AnthropicMessagesCodec is
selected for no-system requests. Add a regression test around the Anthropic
detector and surface resolution for the no-system case.
🪄 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: 7cad5b0d-f873-4f2c-89ba-d70d00f2a393
📒 Files selected for processing (8)
crates/cli/src/adapters/mod.rscrates/cli/src/alignment/mod.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/resolve.rscrates/core/tests/unit/codec/resolve_tests.rsdocs/about-nemo-relay/concepts/codecs.mdx
📜 Review details
🔇 Additional comments (3)
docs/about-nemo-relay/concepts/codecs.mdx (1)
83-131: LGTM!crates/cli/src/adapters/mod.rs (1)
34-118: LGTM!Also applies to: 133-321, 335-386
crates/core/src/codec/resolve.rs (1)
27-53: 📐 Maintainability & Code QualityAdd the required core-runtime validation before merge.
This changes
crates/corecodec dispatch, but the PR validation list still omitscargo clippy --workspace --all-targets -- -D warnings, the full binding test matrix, andvalidate-change. Please include those runs so the shared runtime contract is exercised outside the Rust-only path.As per coding guidelines, "If
crates/coreorcrates/adaptivechanged, run the full matrix across Rust, Python, Go, Node.js, and WebAssembly" and "If the change touchedcrates/coreor shared runtime semantics, also usevalidate-changefor broader validation."Also applies to: 92-103
Source: Coding guidelines
🛑 Comments failed to post (2)
crates/cli/src/adapters/mod.rs (1)
120-132: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash rg -nP '\buser_email\b' --type=rust rg -nP '\.metadata\b' --type=rust crates/cli/src -C2Repository: NVIDIA/NeMo-Relay
Length of output: 155
🏁 Script executed:
#!/bin/bash set -euo pipefail git ls-files crates/cli/src/adapters/mod.rs crates/cli/src | sed -n '1,120p' echo '--- outline ---' ast-grep outline crates/cli/src/adapters/mod.rs --view expanded || true echo '--- lines 1-260 ---' sed -n '1,260p' crates/cli/src/adapters/mod.rs | cat -n echo '--- search metadata consumers in cli ---' rg -n 'metadata' crates/cli/src -g '*.rs' -C 2 || true echo '--- search user_email across repo ---' rg -n 'user_email' -g '*.rs' -g '*.md' -g '*.toml' || trueRepository: NVIDIA/NeMo-Relay
Length of output: 50374
user_emailshould not be propagated into normalized metadata. It is merged into session/scope metadata and ends up in exported traces; drop it or gate it behind an explicit redaction/opt-in flag.🤖 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/cli/src/adapters/mod.rs` around lines 120 - 132, The normalized metadata builder in the adapter should stop propagating user_email, since it is currently inserted alongside other fields and later exported in traces. Update the metadata normalization logic in the function that iterates over the payload keys to omit user_email entirely, or only include it behind an explicit redaction/opt-in gate. Keep the existing handling for cwd, transcript_path, project_dir, model, agent_id, and agent_type unchanged.Source: Coding guidelines
crates/core/src/codec/anthropic.rs (1)
43-50: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash set -euo pipefail printf '\n== relevant files ==\n' git ls-files crates/core/src/codec | sed -n '1,120p' printf '\n== anthropic codec outline ==\n' ast-grep outline crates/core/src/codec/anthropic.rs --view expanded || true printf '\n== resolve outline ==\n' ast-grep outline crates/core/src/codec/resolve.rs --view expanded || true printf '\n== request surface adapter outline ==\n' ast-grep outline crates/adaptive/src/acg/request_surfaces/mod.rs --view expanded || true printf '\n== search detector definitions ==\n' rg -n "detect_request:|ProviderSurface::AnthropicMessages|OpenAIChat|OpenAIResponses|detect_request_surface|normalize_request" \ crates/core/src/codec crates/adaptive/src/acg/request_surfaces -n printf '\n== anthropic codec excerpt ==\n' sed -n '1,180p' crates/core/src/codec/anthropic.rs printf '\n== resolve excerpt ==\n' sed -n '1,220p' crates/core/src/codec/resolve.rs printf '\n== request surfaces excerpt ==\n' sed -n '1,260p' crates/adaptive/src/acg/request_surfaces/mod.rsRepository: NVIDIA/NeMo-Relay
Length of output: 32089
🏁 Script executed:
#!/bin/bash set -euo pipefail printf '\n== resolve tests ==\n' sed -n '1,260p' crates/core/tests/unit/codec/resolve_tests.rs printf '\n== anthropic codec tests ==\n' sed -n '850,980p' crates/core/src/codec/anthropic.rs printf '\n== anthropic request decode/encode path ==\n' sed -n '180,620p' crates/core/src/codec/anthropic.rs printf '\n== adaptive request surface tests ==\n' sed -n '1,260p' crates/adaptive/src/acg/request_surfaces/mod.rsRepository: NVIDIA/NeMo-Relay
Length of output: 32368
Anthropic detector needs a discriminator beyond
system. Valid Anthropic Messages requests can omit top-levelsystem, but this predicate falls through toOpenAIChatfor that shape, soresolve_request_surface()rejects raw Anthropic requests andnormalize_request()picks the wrong codec. Add another Anthropic-specific check or route by provider context, and cover the no-system case with a regression test.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/core/src/codec/anthropic.rs` around lines 43 - 50, The Anthropic request detector in PROVIDER_SURFACE is too narrow because detect_request only checks for a top-level system field, so raw Anthropic Messages requests without system get misrouted to OpenAIChat. Update the AnthropicMessages surface detection to recognize another Anthropic-specific discriminator or use provider context in resolve_request_surface/normalize_request, and ensure AnthropicMessagesCodec is selected for no-system requests. Add a regression test around the Anthropic detector and surface resolution for the no-system case.
There was a problem hiding this comment.
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/cli/src/adapters/mod.rs`:
- Around line 117-127: The metadata normalization in the adapter is promoting
high-cardinality/PII fields into shared event metadata, which should be kept
low-cardinality and stable. Update the normalization logic in the helper around
the header/payload mapping so `cwd`, `transcript_path`, `project_dir`, and
`user_email` are not copied into the shared metadata object; keep them only in
the raw payload or redact/hash them before insertion. Apply the same fix in the
corresponding event normalization block referenced by the same field set so both
locations stay consistent.
In `@crates/core/src/codec/resolve.rs`:
- Around line 114-117: normalize_request currently ignores provider context by
always calling request_descriptor with None, so ambiguous messages-only
Anthropic requests can still resolve to the OpenAI Chat codec through the event
fallback path. Update normalize_request (and the call site in event.rs if
needed) to thread through a provider hint or add a hint-aware normalization
entry point that uses detect_request_surface_with_hint. Add a regression test
covering the Anthropic {"messages": ...} shape to verify it normalizes to the
Anthropic path instead of the OpenAI one.
🪄 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: f61c0bfa-a0a1-4f85-a97b-cef13c07969d
📒 Files selected for processing (8)
crates/cli/src/adapters/mod.rscrates/cli/src/alignment/mod.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/resolve.rscrates/core/tests/unit/codec/resolve_tests.rsdocs/about-nemo-relay/concepts/codecs.mdx
💤 Files with no reviewable changes (1)
- docs/about-nemo-relay/concepts/codecs.mdx
📜 Review details
🧰 Additional context used
📓 Path-based instructions (14)
**/*.rs
📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)
Use
snake_casenaming convention for Rust identifiers (e.g.,nemo_relay_tool_call)
**/*.rs: Any Rust change must runjust test-rust
Any Rust change must runcargo fmt --all
Any Rust change must runcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allfor all FFI work since it is Rust work
Runjust test-rustto validate FFI changes
Runcargo clippy --workspace --all-targets -- -D warningsto enforce strict linting on FFI workWhen Rust files changed as part of Go work, also run
cargo fmt --all,just test-rust, andcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allwhen Rust files are changed as part of Node work
Runcargo clippy --workspace --all-targets -- -D warningswhen Rust files are changed as part of Node work
Runjust test-rustwhen Rust files are changed as part of Node work
**/*.rs: Runcargo fmt --allto format all Rust code
Runcargo clippy --workspace --all-targets -- -D warningsto enforce all clippy lints as errors
**/*.rs: Runcargo fmt --allwhen Rust files changed as part of WebAssembly work
Runcargo clippy --workspace --all-targets -- -D warningswhen Rust files changed as part of WebAssembly work
**/*.rs: If any Rust code changed, always runjust test-rust
If any Rust code changed, also runcargo fmt --all
If any Rust code changed, also runcargo clippy --workspace --all-targets -- -D warnings
Run Rust formatting withcargo fmt --all
Run Rust linting withcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Usecargo fmtfor Rust code formatting
Runcargo clippy -- -D warningsto lint Rust code and treat all warnings as errors
Use Rust snake_case naming convention for Rust identifiers
Include SPDX license header in all Rust source files using double-slash comment syntax
Validate Rust code withuv run pre-commit run --all-filesto enforce cargo fmt formatting check, cargo clippy lints, and cargo deny aud...
Files:
crates/core/tests/unit/codec/resolve_tests.rscrates/core/src/codec/openai_responses.rscrates/cli/src/alignment/mod.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rscrates/core/src/codec/openai_chat.rscrates/cli/src/adapters/mod.rs
{crates/adaptive/**/*.rs,**/*test*.{rs,py,go,ts,js},**/*adaptive*test*.{rs,py,go,ts,js},docs/plugins/adaptive/**}
📄 CodeRabbit inference engine (.agents/skills/maintain-optimizer/SKILL.md)
Maintain documented and tested validation and report behavior for adaptive surfaces
Files:
crates/core/tests/unit/codec/resolve_tests.rs
**/{Cargo.toml,**/*.rs}
📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)
Maintain consistency between Rust package names in
Cargo.tomland their actual usage across the codebase
Files:
crates/core/tests/unit/codec/resolve_tests.rscrates/core/src/codec/openai_responses.rscrates/cli/src/alignment/mod.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rscrates/core/src/codec/openai_chat.rscrates/cli/src/adapters/mod.rs
**/*.{h,hpp,c,cpp,rs}
📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)
Ensure FFI header and library naming follows consistent conventions across platform-specific builds
Files:
crates/core/tests/unit/codec/resolve_tests.rscrates/core/src/codec/openai_responses.rscrates/cli/src/alignment/mod.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rscrates/core/src/codec/openai_chat.rscrates/cli/src/adapters/mod.rs
{crates/core,crates/adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
Changes to
crates/coreorcrates/adaptivemust run the full language matrix
Files:
crates/core/tests/unit/codec/resolve_tests.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rscrates/core/src/codec/openai_chat.rs
**/*.{rs,toml}
📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)
Update Rust crate names and module prefixes during coordinated rename operations
Files:
crates/core/tests/unit/codec/resolve_tests.rscrates/core/src/codec/openai_responses.rscrates/cli/src/alignment/mod.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rscrates/core/src/codec/openai_chat.rscrates/cli/src/adapters/mod.rs
crates/core/**/*.rs
📄 CodeRabbit inference engine (.agents/skills/test-go-binding/SKILL.md)
If the change touched
crates/coreor shared runtime semantics, also usevalidate-changefor broader validation
crates/core/**/*.rs: UseJson = serde_json::Valuein Rust-facing runtime APIs where the existing code expects JSON payloads.
UseResult<T>withFlowErrorin core runtime paths. Keep errors explicit and binding-appropriate at the wrapper layer.
Files:
crates/core/tests/unit/codec/resolve_tests.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rscrates/core/src/codec/openai_chat.rs
crates/{core,adaptive}/**
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If
crates/coreorcrates/adaptivechanged, run the full matrix across Rust, Python, Go, Node.js, and WebAssembly
Files:
crates/core/tests/unit/codec/resolve_tests.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rscrates/core/src/codec/openai_chat.rs
**/*.{rs,py,js,ts,tsx,jsx,go,sh,toml,yaml,yml,md}
📄 CodeRabbit inference engine (AGENTS.md)
Keep SPDX headers on source, docs, scripts, and configuration files. The project is Apache-2.0.
Files:
crates/core/tests/unit/codec/resolve_tests.rscrates/core/src/codec/openai_responses.rscrates/cli/src/alignment/mod.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rscrates/core/src/codec/openai_chat.rscrates/cli/src/adapters/mod.rs
**/*.{rs,py,go,js,ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Follow binding naming conventions: Rust and Python use
snake_case, C FFI exports prefixednemo_relay_, Go usesPascalCasefor public APIs, Node.js usescamelCase.
Files:
crates/core/tests/unit/codec/resolve_tests.rscrates/core/src/codec/openai_responses.rscrates/cli/src/alignment/mod.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rscrates/core/src/codec/openai_chat.rscrates/cli/src/adapters/mod.rs
crates/**/*.rs
📄 CodeRabbit inference engine (AGENTS.md)
crates/**/*.rs: Keep async behavior on the existing tokio-based model. Bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.
UseJson = serde_json::Valuein Rust-facing runtime APIs for JSON payload handling.
Files:
crates/core/tests/unit/codec/resolve_tests.rscrates/core/src/codec/openai_responses.rscrates/cli/src/alignment/mod.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rscrates/core/src/codec/openai_chat.rscrates/cli/src/adapters/mod.rs
**
⚙️ CodeRabbit configuration file
**:AGENTS.md
This file provides guidance to agents, including Claude Code and OpenAI Codex, when working in this repository.
Project Overview
NeMo Relay is a multi-language agent runtime framework for execution scopes, lifecycle events, middleware, plugins, and observability around tool and LLM calls. The core runtime is Rust. Primary supported bindings are Rust, Python, and Node.js. Go, WebAssembly, and the raw C FFI are experimental and source-first.
The shared runtime model is:
- Scope stacks decide where work belongs and which scope-local behavior is visible.
- Middleware registries decide what guardrails and intercepts run around managed calls.
- Plugins install reusable runtime behavior from configuration.
- Events record runtime behavior in ATOF form.
- Subscribers and exporters consume events in-process or export them to ATIF, OpenTelemetry, OpenInference, or other backends.
Repository Structure
The repository layout separates the Rust runtime, language bindings, documentation,
integration patches, and agent-facing skills.crates/ core/ # Rust core runtime crate, published as nemo-relay adaptive/ # Adaptive runtime primitives and plugin components python/ # PyO3 native extension for the Python package ffi/ # Raw C ABI layer used by downstream bindings such as Go node/ # NAPI Node.js binding and JavaScript/TypeScript entry points wasm/ # wasm-bindgen WebAssembly binding and JS wrappers python/ nemo_relay/ # Python wrapper package: scopes, tools, LLM, middleware, typed helpers, plugins, adaptive helpers tests/ # Python tests go/ nemo_relay/ # Experimental Go CGo binding and tests fern/ # Fern documentation site scripts/ # Stable wrappers and helper scripts; build/test/docs entry points live in justfile third_party/ # P...
Files:
crates/core/tests/unit/codec/resolve_tests.rscrates/core/src/codec/openai_responses.rscrates/cli/src/alignment/mod.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rscrates/core/src/codec/openai_chat.rscrates/cli/src/adapters/mod.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/codec/resolve_tests.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rscrates/core/src/codec/openai_chat.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/codec/resolve_tests.rs
🔇 Additional comments (1)
crates/core/src/codec/resolve.rs (1)
52-56: 📐 Maintainability & Code QualityPlease add the required
crates/corevalidation before merge.The PR summary lists
cargo fmt --all, targeted Rust tests,just test-rust, andjust docs, but the repo guidance forcrates/coreRust changes also expectscargo clippy --workspace --all-targets -- -D warnings,uv run pre-commit run --all-files,validate-change, and the full binding matrix (just test-python,just test-node,just test-go,just test-wasm). As per coding guidelines, "Ifcrates/coreorcrates/adaptivechanged, run the full matrix across Rust, Python, Go, Node.js, and WebAssembly."Source: Coding guidelines
Signed-off-by: Yuchen Zhang <yuchenz@nvidia.com>
Signed-off-by: Yuchen Zhang <yuchenz@nvidia.com>
Signed-off-by: Yuchen Zhang <yuchenz@nvidia.com>
Signed-off-by: Yuchen Zhang <yuchenz@nvidia.com>
Signed-off-by: Yuchen Zhang <yuchenz@nvidia.com>
Signed-off-by: Yuchen Zhang <yuchenz@nvidia.com>
There was a problem hiding this comment.
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/cli/src/adapters/mod.rs`:
- Around line 201-204: This is a tracked migration TODO for the free-function
shims in `mod.rs`; make sure the planned shim removal won’t be lost by filing or
linking a follow-up issue. Update the `TODO(extraction)` note near the shim
functions to reference the tracking issue, and keep the callers pointed at
`AgentPayloadExtractor` implementations as the migration progresses.
🪄 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: 251f94b1-8c28-48e3-911c-329a8b0e2383
📒 Files selected for processing (6)
crates/cli/src/adapters/mod.rscrates/cli/src/alignment/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/codec/resolve.rscrates/core/tests/unit/codec/resolve_tests.rsdocs/about-nemo-relay/concepts/codecs.mdx
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
- GitHub Check: Check / Run
- GitHub Check: Preview docs
🧰 Additional context used
📓 Path-based instructions (25)
**/*.rs
📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)
Use
snake_casenaming convention for Rust identifiers (e.g.,nemo_relay_tool_call)
**/*.rs: Any Rust change must runjust test-rust
Any Rust change must runcargo fmt --all
Any Rust change must runcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allfor all FFI work since it is Rust work
Runjust test-rustto validate FFI changes
Runcargo clippy --workspace --all-targets -- -D warningsto enforce strict linting on FFI workWhen Rust files changed as part of Go work, also run
cargo fmt --all,just test-rust, andcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allwhen Rust files are changed as part of Node work
Runcargo clippy --workspace --all-targets -- -D warningswhen Rust files are changed as part of Node work
Runjust test-rustwhen Rust files are changed as part of Node work
**/*.rs: Runcargo fmt --allto format all Rust code
Runcargo clippy --workspace --all-targets -- -D warningsto enforce all clippy lints as errors
**/*.rs: Runcargo fmt --allwhen Rust files changed as part of WebAssembly work
Runcargo clippy --workspace --all-targets -- -D warningswhen Rust files changed as part of WebAssembly work
**/*.rs: If any Rust code changed, always runjust test-rust
If any Rust code changed, also runcargo fmt --all
If any Rust code changed, also runcargo clippy --workspace --all-targets -- -D warnings
Run Rust formatting withcargo fmt --all
Run Rust linting withcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Usecargo fmtfor Rust code formatting
Runcargo clippy -- -D warningsto lint Rust code and treat all warnings as errors
Use Rust snake_case naming convention for Rust identifiers
Include SPDX license header in all Rust source files using double-slash comment syntax
Validate Rust code withuv run pre-commit run --all-filesto enforce cargo fmt formatting check, cargo clippy lints, and cargo deny aud...
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/core/tests/unit/codec/resolve_tests.rscrates/cli/src/alignment/mod.rscrates/core/src/codec/resolve.rscrates/cli/src/adapters/mod.rs
{crates/adaptive/**/*.rs,**/*test*.{rs,py,go,ts,js},**/*adaptive*test*.{rs,py,go,ts,js},docs/plugins/adaptive/**}
📄 CodeRabbit inference engine (.agents/skills/maintain-optimizer/SKILL.md)
Maintain documented and tested validation and report behavior for adaptive surfaces
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/core/tests/unit/codec/resolve_tests.rs
**/{Cargo.toml,**/*.rs}
📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)
Maintain consistency between Rust package names in
Cargo.tomland their actual usage across the codebase
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/core/tests/unit/codec/resolve_tests.rscrates/cli/src/alignment/mod.rscrates/core/src/codec/resolve.rscrates/cli/src/adapters/mod.rs
**/*.{h,hpp,c,cpp,rs}
📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)
Ensure FFI header and library naming follows consistent conventions across platform-specific builds
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/core/tests/unit/codec/resolve_tests.rscrates/cli/src/alignment/mod.rscrates/core/src/codec/resolve.rscrates/cli/src/adapters/mod.rs
**/*.{rs,toml}
📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)
Update Rust crate names and module prefixes during coordinated rename operations
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/core/tests/unit/codec/resolve_tests.rscrates/cli/src/alignment/mod.rscrates/core/src/codec/resolve.rscrates/cli/src/adapters/mod.rs
**/*.{rs,py,js,ts,tsx,jsx,go,sh,toml,yaml,yml,md}
📄 CodeRabbit inference engine (AGENTS.md)
Keep SPDX headers on source, docs, scripts, and configuration files. The project is Apache-2.0.
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/core/tests/unit/codec/resolve_tests.rscrates/cli/src/alignment/mod.rscrates/core/src/codec/resolve.rscrates/cli/src/adapters/mod.rs
**/*.{rs,py,go,js,ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Follow binding naming conventions: Rust and Python use
snake_case, C FFI exports prefixednemo_relay_, Go usesPascalCasefor public APIs, Node.js usescamelCase.
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/core/tests/unit/codec/resolve_tests.rscrates/cli/src/alignment/mod.rscrates/core/src/codec/resolve.rscrates/cli/src/adapters/mod.rs
crates/**/*.rs
📄 CodeRabbit inference engine (AGENTS.md)
crates/**/*.rs: Keep async behavior on the existing tokio-based model. Bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.
UseJson = serde_json::Valuein Rust-facing runtime APIs for JSON payload handling.
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/core/tests/unit/codec/resolve_tests.rscrates/cli/src/alignment/mod.rscrates/core/src/codec/resolve.rscrates/cli/src/adapters/mod.rs
**
⚙️ CodeRabbit configuration file
**:AGENTS.md
This file provides guidance to agents, including Claude Code and OpenAI Codex, when working in this repository.
Project Overview
NeMo Relay is a multi-language agent runtime framework for execution scopes, lifecycle events, middleware, plugins, and observability around tool and LLM calls. The core runtime is Rust. Primary supported bindings are Rust, Python, and Node.js. Go, WebAssembly, and the raw C FFI are experimental and source-first.
The shared runtime model is:
- Scope stacks decide where work belongs and which scope-local behavior is visible.
- Middleware registries decide what guardrails and intercepts run around managed calls.
- Plugins install reusable runtime behavior from configuration.
- Events record runtime behavior in ATOF form.
- Subscribers and exporters consume events in-process or export them to ATIF, OpenTelemetry, OpenInference, or other backends.
Repository Structure
The repository layout separates the Rust runtime, language bindings, documentation,
integration patches, and agent-facing skills.crates/ core/ # Rust core runtime crate, published as nemo-relay adaptive/ # Adaptive runtime primitives and plugin components python/ # PyO3 native extension for the Python package ffi/ # Raw C ABI layer used by downstream bindings such as Go node/ # NAPI Node.js binding and JavaScript/TypeScript entry points wasm/ # wasm-bindgen WebAssembly binding and JS wrappers python/ nemo_relay/ # Python wrapper package: scopes, tools, LLM, middleware, typed helpers, plugins, adaptive helpers tests/ # Python tests go/ nemo_relay/ # Experimental Go CGo binding and tests fern/ # Fern documentation site scripts/ # Stable wrappers and helper scripts; build/test/docs entry points live in justfile third_party/ # P...
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/core/tests/unit/codec/resolve_tests.rscrates/cli/src/alignment/mod.rscrates/core/src/codec/resolve.rsdocs/about-nemo-relay/concepts/codecs.mdxcrates/cli/src/adapters/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/cli/tests/coverage/adapters_tests.rscrates/core/tests/unit/codec/resolve_tests.rs
{crates/core,crates/adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
Changes to
crates/coreorcrates/adaptivemust run the full language matrix
Files:
crates/core/tests/unit/codec/resolve_tests.rscrates/core/src/codec/resolve.rs
crates/core/**/*.rs
📄 CodeRabbit inference engine (.agents/skills/test-go-binding/SKILL.md)
If the change touched
crates/coreor shared runtime semantics, also usevalidate-changefor broader validation
crates/core/**/*.rs: UseJson = serde_json::Valuein Rust-facing runtime APIs where the existing code expects JSON payloads.
UseResult<T>withFlowErrorin core runtime paths. Keep errors explicit and binding-appropriate at the wrapper layer.
Files:
crates/core/tests/unit/codec/resolve_tests.rscrates/core/src/codec/resolve.rs
crates/{core,adaptive}/**
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If
crates/coreorcrates/adaptivechanged, run the full matrix across Rust, Python, Go, Node.js, and WebAssembly
Files:
crates/core/tests/unit/codec/resolve_tests.rscrates/core/src/codec/resolve.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/codec/resolve_tests.rscrates/core/src/codec/resolve.rs
{docs/**,README.md,CONTRIBUTING.md}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
{docs/**,README.md,CONTRIBUTING.md}: For docs-only changes, run targeted checks only if commands, package names, or examples changed. Usejust docsfor docs-site builds andjust docs-linkcheckwhen links changed
Run docs site build withjust docs
Files:
docs/about-nemo-relay/concepts/codecs.mdx
{docs/**,README.md,CONTRIBUTING.md,**/*.md}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
Run docs link validation with
just docs-linkcheckwhen links change
Files:
docs/about-nemo-relay/concepts/codecs.mdx
{docs/**,README.md}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
Verify README and docs entry points still match current package names and paths for large or public-facing changes
Files:
docs/about-nemo-relay/concepts/codecs.mdx
{docs/**,examples/**,README.md}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
Verify examples still run with documented commands for large or public-facing changes
Files:
docs/about-nemo-relay/concepts/codecs.mdx
{docs/**,README.md,**/Cargo.toml,**/package.json,**/*.md}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
Ensure renamed public surfaces are reflected consistently in manifests and docs for large or public-facing changes
Files:
docs/about-nemo-relay/concepts/codecs.mdx
**/*.{md,mdx,py,sh,yaml,yml,toml,json}
📄 CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md)
Keep package names, repo references, and build commands current
Files:
docs/about-nemo-relay/concepts/codecs.mdx
**/*.mdx
📄 CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md)
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.
MDX top-of-file SPDX comments must use {/* ... */} delimiters instead of HTML comment delimiters (Must-Fix)
Files:
docs/about-nemo-relay/concepts/codecs.mdx
**/*.{html,md,mdx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Include SPDX license header in HTML and Markdown files using HTML comment syntax
Files:
docs/about-nemo-relay/concepts/codecs.mdx
docs/**/*.{md,mdx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Update embedded documentation snippets, patch docs, and binding-support notes if examples or supported bindings changed
Files:
docs/about-nemo-relay/concepts/codecs.mdx
docs/**
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Run
just docsor./scripts/build-docs.sh htmlto regenerate ignored Fern API reference pages before validation for documentation site changes
Files:
docs/about-nemo-relay/concepts/codecs.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/codecs.mdx
🔇 Additional comments (8)
crates/cli/src/alignment/mod.rs (1)
606-609: 📐 Maintainability & Code QualityRun the required Rust lint pass.
The PR validation list covers
cargo fmt --allandjust test-rust, but it omitscargo clippy --workspace --all-targets -- -D warnings, which is required for any Rust change in this repo. As per coding guidelines,**/*.rs: "If any Rust code changed, also runcargo clippy --workspace --all-targets -- -D warnings."Source: Coding guidelines
docs/about-nemo-relay/concepts/codecs.mdx (1)
83-138: LGTM!crates/core/src/codec/resolve.rs (2)
70-72: 🩺 Stability & AvailabilityConfirm
normalize_requestthreads the provider hint, not just detection.
detect_request_surfacedeliberately delegates withNone, but the prior review flagged thatnormalize_requestalso hardcodesNone, so theevent.rsfallback path normalizes messages-only Anthropic requests through the OpenAI Chat descriptor. The newrequest_descriptorhelper and the test atresolve_tests.rs:297-300confirm that aNonehint resolves messages-only payloads toOpenAIChat— verify the normalization entry point actually plumbs the provider hint so this isn't silently mis-decoded.#!/bin/bash # Inspect normalize_request and its event.rs call site for hint threading. fd resolve.rs -p crates/core/src/codec --exec sed -n '104,130p' rg -nP -C3 '\bnormalize_request\s*\(' crates/core/src
38-47: LGTM!crates/core/tests/unit/codec/resolve_tests.rs (1)
289-313: LGTM!crates/cli/src/adapters/mod.rs (1)
139-198: LGTM!crates/cli/tests/coverage/adapters_tests.rs (2)
234-317: LGTM!
340-341: LGTM!
Signed-off-by: Yuchen Zhang <yuchenz@nvidia.com>
Signed-off-by: Yuchen Zhang <yuchenz@nvidia.com>
There was a problem hiding this comment.
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/cli/tests/coverage/adapters_tests.rs`:
- Line 820: The coverage test around the normalized payload only checks that
`metadata` no longer contains `cwd`, so it can still pass if `cwd` is dropped
entirely. Update the test in `adapters_tests.rs` to also assert the relocated
`cwd` remains present on `event.payload["cwd"]`, using the existing normalized
event assertions in this test case so the relocation contract is fully covered.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: 9c33e325-6e14-454c-ab62-d52e0d81f7cd
📒 Files selected for processing (7)
crates/cli/src/adapters/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/event.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rscrates/core/tests/unit/codec/resolve_tests.rscrates/core/tests/unit/types_tests.rs
💤 Files with no reviewable changes (1)
- crates/cli/src/adapters/mod.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 (15)
crates/core/src/api/**/*.rs
📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)
Implement behavior first in Rust core API modules:
crates/core/src/api/and related core modules such ascrates/core/src/api/runtime/,crates/core/src/codec/, orcrates/core/src/json.rs
Files:
crates/core/src/api/event.rs
**/*.rs
📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)
Use
snake_casenaming convention for Rust identifiers (e.g.,nemo_relay_tool_call)
**/*.rs: Any Rust change must runjust test-rust
Any Rust change must runcargo fmt --all
Any Rust change must runcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allfor all FFI work since it is Rust work
Runjust test-rustto validate FFI changes
Runcargo clippy --workspace --all-targets -- -D warningsto enforce strict linting on FFI workWhen Rust files changed as part of Go work, also run
cargo fmt --all,just test-rust, andcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allwhen Rust files are changed as part of Node work
Runcargo clippy --workspace --all-targets -- -D warningswhen Rust files are changed as part of Node work
Runjust test-rustwhen Rust files are changed as part of Node work
**/*.rs: Runcargo fmt --allto format all Rust code
Runcargo clippy --workspace --all-targets -- -D warningsto enforce all clippy lints as errors
**/*.rs: Runcargo fmt --allwhen Rust files changed as part of WebAssembly work
Runcargo clippy --workspace --all-targets -- -D warningswhen Rust files changed as part of WebAssembly work
**/*.rs: If any Rust code changed, always runjust test-rust
If any Rust code changed, also runcargo fmt --all
If any Rust code changed, also runcargo clippy --workspace --all-targets -- -D warnings
Run Rust formatting withcargo fmt --all
Run Rust linting withcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Usecargo fmtfor Rust code formatting
Runcargo clippy -- -D warningsto lint Rust code and treat all warnings as errors
Use Rust snake_case naming convention for Rust identifiers
Include SPDX license header in all Rust source files using double-slash comment syntax
Validate Rust code withuv run pre-commit run --all-filesto enforce cargo fmt formatting check, cargo clippy lints, and cargo deny aud...
Files:
crates/core/src/api/event.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/codec/resolve.rscrates/core/tests/unit/types_tests.rscrates/core/src/codec/anthropic.rscrates/core/tests/unit/codec/resolve_tests.rs
**/{Cargo.toml,**/*.rs}
📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)
Maintain consistency between Rust package names in
Cargo.tomland their actual usage across the codebase
Files:
crates/core/src/api/event.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/codec/resolve.rscrates/core/tests/unit/types_tests.rscrates/core/src/codec/anthropic.rscrates/core/tests/unit/codec/resolve_tests.rs
**/*.{h,hpp,c,cpp,rs}
📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)
Ensure FFI header and library naming follows consistent conventions across platform-specific builds
Files:
crates/core/src/api/event.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/codec/resolve.rscrates/core/tests/unit/types_tests.rscrates/core/src/codec/anthropic.rscrates/core/tests/unit/codec/resolve_tests.rs
{crates/core,crates/adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
Changes to
crates/coreorcrates/adaptivemust run the full language matrix
Files:
crates/core/src/api/event.rscrates/core/src/codec/resolve.rscrates/core/tests/unit/types_tests.rscrates/core/src/codec/anthropic.rscrates/core/tests/unit/codec/resolve_tests.rs
**/*.{rs,toml}
📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)
Update Rust crate names and module prefixes during coordinated rename operations
Files:
crates/core/src/api/event.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/codec/resolve.rscrates/core/tests/unit/types_tests.rscrates/core/src/codec/anthropic.rscrates/core/tests/unit/codec/resolve_tests.rs
crates/core/**/*.rs
📄 CodeRabbit inference engine (.agents/skills/test-go-binding/SKILL.md)
If the change touched
crates/coreor shared runtime semantics, also usevalidate-changefor broader validation
crates/core/**/*.rs: UseJson = serde_json::Valuein Rust-facing runtime APIs where the existing code expects JSON payloads.
UseResult<T>withFlowErrorin core runtime paths. Keep errors explicit and binding-appropriate at the wrapper layer.
Files:
crates/core/src/api/event.rscrates/core/src/codec/resolve.rscrates/core/tests/unit/types_tests.rscrates/core/src/codec/anthropic.rscrates/core/tests/unit/codec/resolve_tests.rs
crates/{core,adaptive}/**
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If
crates/coreorcrates/adaptivechanged, run the full matrix across Rust, Python, Go, Node.js, and WebAssembly
Files:
crates/core/src/api/event.rscrates/core/src/codec/resolve.rscrates/core/tests/unit/types_tests.rscrates/core/src/codec/anthropic.rscrates/core/tests/unit/codec/resolve_tests.rs
**/*.{rs,py,js,ts,tsx,jsx,go,sh,toml,yaml,yml,md}
📄 CodeRabbit inference engine (AGENTS.md)
Keep SPDX headers on source, docs, scripts, and configuration files. The project is Apache-2.0.
Files:
crates/core/src/api/event.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/codec/resolve.rscrates/core/tests/unit/types_tests.rscrates/core/src/codec/anthropic.rscrates/core/tests/unit/codec/resolve_tests.rs
**/*.{rs,py,go,js,ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Follow binding naming conventions: Rust and Python use
snake_case, C FFI exports prefixednemo_relay_, Go usesPascalCasefor public APIs, Node.js usescamelCase.
Files:
crates/core/src/api/event.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/codec/resolve.rscrates/core/tests/unit/types_tests.rscrates/core/src/codec/anthropic.rscrates/core/tests/unit/codec/resolve_tests.rs
crates/**/*.rs
📄 CodeRabbit inference engine (AGENTS.md)
crates/**/*.rs: Keep async behavior on the existing tokio-based model. Bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.
UseJson = serde_json::Valuein Rust-facing runtime APIs for JSON payload handling.
Files:
crates/core/src/api/event.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/codec/resolve.rscrates/core/tests/unit/types_tests.rscrates/core/src/codec/anthropic.rscrates/core/tests/unit/codec/resolve_tests.rs
**
⚙️ CodeRabbit configuration file
**:AGENTS.md
This file provides guidance to agents, including Claude Code and OpenAI Codex, when working in this repository.
Project Overview
NeMo Relay is a multi-language agent runtime framework for execution scopes, lifecycle events, middleware, plugins, and observability around tool and LLM calls. The core runtime is Rust. Primary supported bindings are Rust, Python, and Node.js. Go, WebAssembly, and the raw C FFI are experimental and source-first.
The shared runtime model is:
- Scope stacks decide where work belongs and which scope-local behavior is visible.
- Middleware registries decide what guardrails and intercepts run around managed calls.
- Plugins install reusable runtime behavior from configuration.
- Events record runtime behavior in ATOF form.
- Subscribers and exporters consume events in-process or export them to ATIF, OpenTelemetry, OpenInference, or other backends.
Repository Structure
The repository layout separates the Rust runtime, language bindings, documentation,
integration patches, and agent-facing skills.crates/ core/ # Rust core runtime crate, published as nemo-relay adaptive/ # Adaptive runtime primitives and plugin components python/ # PyO3 native extension for the Python package ffi/ # Raw C ABI layer used by downstream bindings such as Go node/ # NAPI Node.js binding and JavaScript/TypeScript entry points wasm/ # wasm-bindgen WebAssembly binding and JS wrappers python/ nemo_relay/ # Python wrapper package: scopes, tools, LLM, middleware, typed helpers, plugins, adaptive helpers tests/ # Python tests go/ nemo_relay/ # Experimental Go CGo binding and tests fern/ # Fern documentation site scripts/ # Stable wrappers and helper scripts; build/test/docs entry points live in justfile third_party/ # P...
Files:
crates/core/src/api/event.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/codec/resolve.rscrates/core/tests/unit/types_tests.rscrates/core/src/codec/anthropic.rscrates/core/tests/unit/codec/resolve_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/src/api/event.rscrates/core/src/codec/resolve.rscrates/core/tests/unit/types_tests.rscrates/core/src/codec/anthropic.rscrates/core/tests/unit/codec/resolve_tests.rs
{crates/adaptive/**/*.rs,**/*test*.{rs,py,go,ts,js},**/*adaptive*test*.{rs,py,go,ts,js},docs/plugins/adaptive/**}
📄 CodeRabbit inference engine (.agents/skills/maintain-optimizer/SKILL.md)
Maintain documented and tested validation and report behavior for adaptive surfaces
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/core/tests/unit/types_tests.rscrates/core/tests/unit/codec/resolve_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/cli/tests/coverage/adapters_tests.rscrates/core/tests/unit/types_tests.rscrates/core/tests/unit/codec/resolve_tests.rs
🔇 Additional comments (6)
crates/cli/tests/coverage/adapters_tests.rs (1)
31-37: LGTM!Also applies to: 342-345
crates/core/src/codec/anthropic.rs (1)
43-58: LGTM!crates/core/src/codec/resolve.rs (1)
118-131: Resolves the prior hint-threading gap.normalize_request_with_hintis now the hint-aware entry point andevent.rscalls it, so the messages-only Anthropic fallback path is no longer forced through OpenAI Chat when a hint is present.normalize_requestpreservingNonekeeps existing shape-only behavior intact.crates/core/tests/unit/codec/resolve_tests.rs (1)
278-356: LGTM!crates/core/tests/unit/types_tests.rs (1)
679-708: LGTM!crates/core/src/api/event.rs (1)
42-42: 🎯 Functional CorrectnessNeed the LLM handle construction and the provider-hint matcher to decide whether the name is contractual or just a caller-controlled label.
Signed-off-by: Yuchen Zhang <yuchenz@nvidia.com>
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
crates/cli/tests/coverage/adapters_tests.rs (1)
278-319: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winExercise the populated event builders, not just the extractor.
This test proves
BUILTIN_AGENT_PAYLOAD_EXTRACTOR, but the PR also rewiredcommon_llm_hint_eventandcommon_tool_eventto consume that data. A field-mapping regression there would still pass. Add assertions on the emittedLlmHintEvent/ToolEventfor this populated payload. As per path instructions, "Tests should cover the behavior promised by the changed API surface."🤖 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/cli/tests/coverage/adapters_tests.rs` around lines 278 - 319, This test only validates BUILTIN_AGENT_PAYLOAD_EXTRACTOR, but the changed behavior also flows through common_llm_hint_event and common_tool_event. Update the populated payload test to assert the emitted LlmHintEvent and ToolEvent values, not just the extracted hint/tool call data, so the field mapping from the builder functions is covered. Use the existing builtin_extractor_reads_agent_hint_and_tool_call_fields test as the anchor and verify the full event contents for the same payload.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/core/src/api/event.rs`:
- Around line 42-45: The request normalization in event handling is using
LlmHandle.name as a codec hint, which can change classification for non-gateway
callers. Update resolve::normalize_request_with_hint usage in the event path so
only known gateway route names are treated as hints, or add a separate explicit
provider-surface hint field instead of reusing the logical name. Keep
CreateLlmHandleParams::name as a logical/provider identifier and preserve
existing fallback normalization behavior for non-gateway cases.
---
Outside diff comments:
In `@crates/cli/tests/coverage/adapters_tests.rs`:
- Around line 278-319: This test only validates BUILTIN_AGENT_PAYLOAD_EXTRACTOR,
but the changed behavior also flows through common_llm_hint_event and
common_tool_event. Update the populated payload test to assert the emitted
LlmHintEvent and ToolEvent values, not just the extracted hint/tool call data,
so the field mapping from the builder functions is covered. Use the existing
builtin_extractor_reads_agent_hint_and_tool_call_fields test as the anchor and
verify the full event contents for the same payload.
🪄 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: 14e1d14b-eaf5-4591-ad5b-3099be3cc670
📒 Files selected for processing (9)
crates/cli/src/adapters/mod.rscrates/cli/src/alignment/mod.rscrates/cli/src/gateway.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/event.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/state.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.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 (17)
crates/core/src/api/**/*.rs
📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)
Implement behavior first in Rust core API modules:
crates/core/src/api/and related core modules such ascrates/core/src/api/runtime/,crates/core/src/codec/, orcrates/core/src/json.rs
Files:
crates/core/src/api/runtime/state.rscrates/core/src/api/event.rscrates/core/src/api/llm.rs
**/*.rs
📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)
Use
snake_casenaming convention for Rust identifiers (e.g.,nemo_relay_tool_call)
**/*.rs: Any Rust change must runjust test-rust
Any Rust change must runcargo fmt --all
Any Rust change must runcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allfor all FFI work since it is Rust work
Runjust test-rustto validate FFI changes
Runcargo clippy --workspace --all-targets -- -D warningsto enforce strict linting on FFI workWhen Rust files changed as part of Go work, also run
cargo fmt --all,just test-rust, andcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allwhen Rust files are changed as part of Node work
Runcargo clippy --workspace --all-targets -- -D warningswhen Rust files are changed as part of Node work
Runjust test-rustwhen Rust files are changed as part of Node work
**/*.rs: Runcargo fmt --allto format all Rust code
Runcargo clippy --workspace --all-targets -- -D warningsto enforce all clippy lints as errors
**/*.rs: Runcargo fmt --allwhen Rust files changed as part of WebAssembly work
Runcargo clippy --workspace --all-targets -- -D warningswhen Rust files changed as part of WebAssembly work
**/*.rs: If any Rust code changed, always runjust test-rust
If any Rust code changed, also runcargo fmt --all
If any Rust code changed, also runcargo clippy --workspace --all-targets -- -D warnings
Run Rust formatting withcargo fmt --all
Run Rust linting withcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Usecargo fmtfor Rust code formatting
Runcargo clippy -- -D warningsto lint Rust code and treat all warnings as errors
Use Rust snake_case naming convention for Rust identifiers
Include SPDX license header in all Rust source files using double-slash comment syntax
Validate Rust code withuv run pre-commit run --all-filesto enforce cargo fmt formatting check, cargo clippy lints, and cargo deny aud...
Files:
crates/core/src/api/runtime/state.rscrates/core/src/api/event.rscrates/cli/src/gateway.rscrates/core/src/api/llm.rscrates/core/src/codec/anthropic.rscrates/cli/src/alignment/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/cli/src/adapters/mod.rscrates/core/src/codec/resolve.rs
crates/core/src/api/runtime/state.rs
📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)
crates/core/src/api/runtime/state.rs: Add registry fields asSortedRegistry<GuardrailEntry<T>>orSortedRegistry<Intercept<T>>toNemoRelayContextStateincrates/core/src/api/runtime/state.rs
Add chain execution helpers toNemoRelayContextStatefollowing the pattern of existing methods liketool_sanitize_request_chainortool_request_intercepts_chain
Files:
crates/core/src/api/runtime/state.rs
**/{Cargo.toml,**/*.rs}
📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)
Maintain consistency between Rust package names in
Cargo.tomland their actual usage across the codebase
Files:
crates/core/src/api/runtime/state.rscrates/core/src/api/event.rscrates/cli/src/gateway.rscrates/core/src/api/llm.rscrates/core/src/codec/anthropic.rscrates/cli/src/alignment/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/cli/src/adapters/mod.rscrates/core/src/codec/resolve.rs
**/*.{h,hpp,c,cpp,rs}
📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)
Ensure FFI header and library naming follows consistent conventions across platform-specific builds
Files:
crates/core/src/api/runtime/state.rscrates/core/src/api/event.rscrates/cli/src/gateway.rscrates/core/src/api/llm.rscrates/core/src/codec/anthropic.rscrates/cli/src/alignment/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/cli/src/adapters/mod.rscrates/core/src/codec/resolve.rs
{crates/core,crates/adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
Changes to
crates/coreorcrates/adaptivemust run the full language matrix
Files:
crates/core/src/api/runtime/state.rscrates/core/src/api/event.rscrates/core/src/api/llm.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rs
**/*.{rs,toml}
📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)
Update Rust crate names and module prefixes during coordinated rename operations
Files:
crates/core/src/api/runtime/state.rscrates/core/src/api/event.rscrates/cli/src/gateway.rscrates/core/src/api/llm.rscrates/core/src/codec/anthropic.rscrates/cli/src/alignment/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/cli/src/adapters/mod.rscrates/core/src/codec/resolve.rs
crates/core/**/*.rs
📄 CodeRabbit inference engine (.agents/skills/test-go-binding/SKILL.md)
If the change touched
crates/coreor shared runtime semantics, also usevalidate-changefor broader validation
crates/core/**/*.rs: UseJson = serde_json::Valuein Rust-facing runtime APIs where the existing code expects JSON payloads.
UseResult<T>withFlowErrorin core runtime paths. Keep errors explicit and binding-appropriate at the wrapper layer.
Files:
crates/core/src/api/runtime/state.rscrates/core/src/api/event.rscrates/core/src/api/llm.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rs
crates/{core,adaptive}/**
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If
crates/coreorcrates/adaptivechanged, run the full matrix across Rust, Python, Go, Node.js, and WebAssembly
Files:
crates/core/src/api/runtime/state.rscrates/core/src/api/event.rscrates/core/src/api/llm.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rs
**/*.{rs,py,js,ts,tsx,jsx,go,sh,toml,yaml,yml,md}
📄 CodeRabbit inference engine (AGENTS.md)
Keep SPDX headers on source, docs, scripts, and configuration files. The project is Apache-2.0.
Files:
crates/core/src/api/runtime/state.rscrates/core/src/api/event.rscrates/cli/src/gateway.rscrates/core/src/api/llm.rscrates/core/src/codec/anthropic.rscrates/cli/src/alignment/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/cli/src/adapters/mod.rscrates/core/src/codec/resolve.rs
**/*.{rs,py,go,js,ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Follow binding naming conventions: Rust and Python use
snake_case, C FFI exports prefixednemo_relay_, Go usesPascalCasefor public APIs, Node.js usescamelCase.
Files:
crates/core/src/api/runtime/state.rscrates/core/src/api/event.rscrates/cli/src/gateway.rscrates/core/src/api/llm.rscrates/core/src/codec/anthropic.rscrates/cli/src/alignment/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/cli/src/adapters/mod.rscrates/core/src/codec/resolve.rs
crates/**/*.rs
📄 CodeRabbit inference engine (AGENTS.md)
crates/**/*.rs: Keep async behavior on the existing tokio-based model. Bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.
UseJson = serde_json::Valuein Rust-facing runtime APIs for JSON payload handling.
Files:
crates/core/src/api/runtime/state.rscrates/core/src/api/event.rscrates/cli/src/gateway.rscrates/core/src/api/llm.rscrates/core/src/codec/anthropic.rscrates/cli/src/alignment/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/cli/src/adapters/mod.rscrates/core/src/codec/resolve.rs
**
⚙️ CodeRabbit configuration file
**:AGENTS.md
This file provides guidance to agents, including Claude Code and OpenAI Codex, when working in this repository.
Project Overview
NeMo Relay is a multi-language agent runtime framework for execution scopes, lifecycle events, middleware, plugins, and observability around tool and LLM calls. The core runtime is Rust. Primary supported bindings are Rust, Python, and Node.js. Go, WebAssembly, and the raw C FFI are experimental and source-first.
The shared runtime model is:
- Scope stacks decide where work belongs and which scope-local behavior is visible.
- Middleware registries decide what guardrails and intercepts run around managed calls.
- Plugins install reusable runtime behavior from configuration.
- Events record runtime behavior in ATOF form.
- Subscribers and exporters consume events in-process or export them to ATIF, OpenTelemetry, OpenInference, or other backends.
Repository Structure
The repository layout separates the Rust runtime, language bindings, documentation,
integration patches, and agent-facing skills.crates/ core/ # Rust core runtime crate, published as nemo-relay adaptive/ # Adaptive runtime primitives and plugin components python/ # PyO3 native extension for the Python package ffi/ # Raw C ABI layer used by downstream bindings such as Go node/ # NAPI Node.js binding and JavaScript/TypeScript entry points wasm/ # wasm-bindgen WebAssembly binding and JS wrappers python/ nemo_relay/ # Python wrapper package: scopes, tools, LLM, middleware, typed helpers, plugins, adaptive helpers tests/ # Python tests go/ nemo_relay/ # Experimental Go CGo binding and tests fern/ # Fern documentation site scripts/ # Stable wrappers and helper scripts; build/test/docs entry points live in justfile third_party/ # P...
Files:
crates/core/src/api/runtime/state.rscrates/core/src/api/event.rscrates/cli/src/gateway.rscrates/core/src/api/llm.rscrates/core/src/codec/anthropic.rscrates/cli/src/alignment/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/cli/src/adapters/mod.rscrates/core/src/codec/resolve.rs
crates/{core,adaptive}/**/*.rs
⚙️ CodeRabbit configuration file
crates/{core,adaptive}/**/*.rs: Review the Rust runtime for async correctness, scope isolation, middleware ordering, and event lifecycle regressions.
Pay close attention to task-local/thread-local scope propagation, callback lifetimes, stream finalization, and root_uuid isolation.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.
Files:
crates/core/src/api/runtime/state.rscrates/core/src/api/event.rscrates/core/src/api/llm.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rs
crates/core/src/api/{tool,llm}.rs
📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)
Wire the new middleware chain into the execute path in
crates/core/src/api/tool.rsorcrates/core/src/api/llm.rsat the appropriate pipeline stage
Files:
crates/core/src/api/llm.rs
{crates/adaptive/**/*.rs,**/*test*.{rs,py,go,ts,js},**/*adaptive*test*.{rs,py,go,ts,js},docs/plugins/adaptive/**}
📄 CodeRabbit inference engine (.agents/skills/maintain-optimizer/SKILL.md)
Maintain documented and tested validation and report behavior for adaptive surfaces
Files:
crates/cli/tests/coverage/adapters_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/cli/tests/coverage/adapters_tests.rs
🔇 Additional comments (4)
crates/cli/src/adapters/mod.rs (1)
82-86: 📐 Maintainability & Code QualityAdd the missing Rust validation steps before merge.
The PR validation list includes
cargo fmt --allandjust test-rust, but it still needscargo clippy --workspace --all-targets -- -D warningsanduv run pre-commit run --all-filesfor a Rust change in this repo. Please include those results as well. As per coding guidelines, "Any Rust change must runcargo clippy --workspace --all-targets -- -D warnings" and "Validate Rust code withuv run pre-commit run --all-files."Source: Coding guidelines
crates/cli/tests/coverage/adapters_tests.rs (1)
238-275: LGTM!crates/cli/src/alignment/mod.rs (1)
90-117: LGTM!Also applies to: 613-625
crates/core/src/codec/resolve.rs (1)
30-32: 📐 Maintainability & Code QualityPlease add the required repo validation for this
crates/corechange.The PR summary only lists targeted Rust tests,
cargo fmt --all,just test-rust, andjust docs, but the repo guidance forcrates/corechanges is stricter: run the full binding matrix plus the required Rust lint/pre-commit checks before merge. Please attach results forcargo clippy --workspace --all-targets -- -D warnings,uv run pre-commit run --all-files,validate-change, and the affected binding suites. As per coding guidelines, "If crates/core or crates/adaptive changed, run the full matrix across Rust, Python, Go, Node.js, and WebAssembly" and "Validate Rust code with uv run pre-commit run --all-files."Source: Coding guidelines
Signed-off-by: Yuchen Zhang <yuchenz@nvidia.com>
Signed-off-by: Yuchen Zhang <yuchenz@nvidia.com>
Overview
Refactors provider extraction logic so codec surfaces and CLI payload/request extraction are represented as shared strategies instead of provider-specific branching scattered through callers.
Details
Anthropic codecs, and routes codec detection/normalization through the shared
BUILTIN_PROVIDER_SURFACESregistry.BuiltinAgentPayloadExtractor) fromprovider-request extraction (
BuiltinProviderRequestExtractor); fallbacks(synthetic session/tool IDs,
unknown_tool) stay at the adapter boundary./ exporter projection) in the codec concepts docs.
Behavior changes (intentional, not pure refactor):
Adds
normalize_request_with_hintand wires the event name as a provider hintso system-less Anthropic (
{"messages": ...}) requests normalize via theAnthropic codec on the fallback path. Hinting is restricted to the exact
anthropic/anthropic.messagesroute names.Stops promoting
cwd,transcript_path,project_dir, anduser_emailintoshared event metadata (high-cardinality/PII); they remain on the raw payload.
Adds regression coverage for registry ordering, hinted decode, the adapter
fallback boundary, agent-field extraction, metadata-vs-payload relocation, and
event-level hint normalization.
Validation run:
Where should the reviewer start?
Start with
crates/core/src/codec/resolve.rsfor the provider surface registry, then reviewcrates/cli/src/adapters/mod.rsfor the shared agent payload extractor.Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Tests