refactor: share exporter fallback extraction#293
Conversation
Signed-off-by: mnajafian-nv <[email protected]>
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Enterprise Run ID: 📒 Files selected for processing (5)
📜 Recent review details⏰ Context from checks skipped due to timeout. (7)
🧰 Additional context used📓 Path-based instructions (15)**/*.rs📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)
Files:
{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)
Files:
**/{Cargo.toml,**/*.rs}📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)
Files:
**/*.{h,hpp,c,cpp,rs}📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)
Files:
{crates/core,crates/adaptive}/**/*📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
Files:
**/*.{rs,toml}📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)
Files:
crates/core/**/*.rs📄 CodeRabbit inference engine (.agents/skills/test-go-binding/SKILL.md)
Files:
crates/{core,adaptive}/**📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
Files:
**/*.{rs,py,js,ts,tsx,jsx,go,sh,toml,yaml,yml,md}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{rs,py,go,js,ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
crates/**/*.rs📄 CodeRabbit inference engine (AGENTS.md)
Files:
**⚙️ CodeRabbit configuration file
Files:
crates/{core,adaptive}/**/*.rs⚙️ CodeRabbit configuration file
Files:
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}⚙️ CodeRabbit configuration file
Files:
crates/core/src/observability/{atif,otel,openinference}.rs📄 CodeRabbit inference engine (.agents/skills/maintain-observability/SKILL.md)
Files:
🛑 Comments failed to post (1)
🔇 Additional comments (5)
WalkthroughIntroduces a new ChangesLLM Observability Parsing Centralization
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
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/core/src/observability/manual_llm_fallback.rs`:
- Around line 257-285: The parameter names usage and token_usage in both
first_u64_from_manual_usage and first_nested_u64_from_manual_usage are
semantically inverted compared to how callers pass them as primary and secondary
arguments, creating a misread hazard for future maintainers. Rename the usage
parameter to primary and the token_usage parameter to secondary in both
functions, then update all references to these parameters within the function
bodies to use the new names. This aligns the parameter names with the actual
semantic roles they serve at call sites.
🪄 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: 2969433a-1a06-41f4-aba2-89b31e90c363
📒 Files selected for processing (5)
crates/core/src/observability/atif.rscrates/core/src/observability/manual_llm_fallback.rscrates/core/src/observability/mod.rscrates/core/src/observability/openinference.rscrates/core/src/observability/otel.rs
📜 Review details
⏰ Context from checks skipped due to timeout. (17)
- GitHub Check: Go / Test (windows-arm64)
- GitHub Check: Go / Test (windows-amd64)
- GitHub Check: Go / Test (macos-arm64)
- GitHub Check: Python / Test (windows-amd64)
- GitHub Check: Node.js / Test (windows-amd64)
- GitHub Check: Python / Test (windows-arm64)
- GitHub Check: Node.js / Test (windows-arm64)
- GitHub Check: Python / Test (macos-arm64)
- GitHub Check: WebAssembly / Test (linux-arm64)
- GitHub Check: Node.js / Test (macos-arm64)
- GitHub Check: WebAssembly / Test (macos-arm64)
- GitHub Check: WebAssembly / Test (windows-amd64)
- GitHub Check: WebAssembly / Test (linux-amd64)
- GitHub Check: Rust / Test (windows-amd64)
- GitHub Check: WebAssembly / Test (windows-arm64)
- GitHub Check: Rust / Test (macos-arm64)
- GitHub Check: Rust / Test (windows-arm64)
🧰 Additional context used
📓 Path-based instructions (13)
**/*.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/observability/mod.rscrates/core/src/observability/otel.rscrates/core/src/observability/atif.rscrates/core/src/observability/manual_llm_fallback.rscrates/core/src/observability/openinference.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/observability/mod.rscrates/core/src/observability/otel.rscrates/core/src/observability/atif.rscrates/core/src/observability/manual_llm_fallback.rscrates/core/src/observability/openinference.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/observability/mod.rscrates/core/src/observability/otel.rscrates/core/src/observability/atif.rscrates/core/src/observability/manual_llm_fallback.rscrates/core/src/observability/openinference.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/observability/mod.rscrates/core/src/observability/otel.rscrates/core/src/observability/atif.rscrates/core/src/observability/manual_llm_fallback.rscrates/core/src/observability/openinference.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/observability/mod.rscrates/core/src/observability/otel.rscrates/core/src/observability/atif.rscrates/core/src/observability/manual_llm_fallback.rscrates/core/src/observability/openinference.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/observability/mod.rscrates/core/src/observability/otel.rscrates/core/src/observability/atif.rscrates/core/src/observability/manual_llm_fallback.rscrates/core/src/observability/openinference.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/observability/mod.rscrates/core/src/observability/otel.rscrates/core/src/observability/atif.rscrates/core/src/observability/manual_llm_fallback.rscrates/core/src/observability/openinference.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/observability/mod.rscrates/core/src/observability/otel.rscrates/core/src/observability/atif.rscrates/core/src/observability/manual_llm_fallback.rscrates/core/src/observability/openinference.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/observability/mod.rscrates/core/src/observability/otel.rscrates/core/src/observability/atif.rscrates/core/src/observability/manual_llm_fallback.rscrates/core/src/observability/openinference.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/observability/mod.rscrates/core/src/observability/otel.rscrates/core/src/observability/atif.rscrates/core/src/observability/manual_llm_fallback.rscrates/core/src/observability/openinference.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/observability/mod.rscrates/core/src/observability/otel.rscrates/core/src/observability/atif.rscrates/core/src/observability/manual_llm_fallback.rscrates/core/src/observability/openinference.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/observability/mod.rscrates/core/src/observability/otel.rscrates/core/src/observability/atif.rscrates/core/src/observability/manual_llm_fallback.rscrates/core/src/observability/openinference.rs
crates/core/src/observability/{atif,otel,openinference}.rs
📄 CodeRabbit inference engine (.agents/skills/maintain-observability/SKILL.md)
When changing event fields in ATIF, OpenTelemetry, or OpenInference observability surfaces, keep the core event model in
crates/core/src/observability/atif.rs,crates/core/src/observability/otel.rs, andcrates/core/src/observability/openinference.rsin sync
Files:
crates/core/src/observability/otel.rscrates/core/src/observability/atif.rscrates/core/src/observability/openinference.rs
🔇 Additional comments (7)
crates/core/src/observability/mod.rs (2)
16-16: LGTM!
16-16: 📐 Maintainability & Code Quality | ⚡ Quick winRun the full language matrix for this
crates/corechange.This touches
crates/coreshared observability/runtime contract. The PR description only documents Rust validation (just test-rust, fmt, clippy, pre-commit). Per guidelines,crates/corechanges require validating Python, Go, Node.js, and WebAssembly bindings as well, since they share the runtime contract.As per coding guidelines, "If
crates/coreorcrates/adaptivechanged, run the full matrix across Rust, Python, Go, Node.js, and WebAssembly". As per path instructions, public behavior must be preserved across bindings.Sources: Coding guidelines, Path instructions
crates/core/src/observability/manual_llm_fallback.rs (2)
219-255: LGTM!
373-570: LGTM!crates/core/src/observability/openinference.rs (1)
35-39: LGTM!Also applies to: 944-950, 1018-1018, 1030-1036, 1082-1084, 1111-1117, 1453-1455
crates/core/src/observability/otel.rs (1)
31-34: LGTM!Also applies to: 714-724
crates/core/src/observability/atif.rs (1)
44-49: LGTM!Also applies to: 699-742, 786-789, 860-860, 892-900, 1001-1007
Signed-off-by: mnajafian-nv <[email protected]>
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/core/src/observability/openinference.rs`:
- Around line 1453-1464: The tool_call_name function duplicates the logic that
already exists in the manual_tool_call_name shared helper. Refactor the
tool_call_name function to reuse the manual_tool_call_name helper instead of
reimplementing the same name extraction logic. This will ensure both functions
stay in sync and prevent future drift in how tool-call attributes are handled
across display text and raw tool-call data.
🪄 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: a893610b-3f46-424b-965a-411e934b60f9
📒 Files selected for processing (5)
crates/core/src/observability/atif.rscrates/core/src/observability/manual_llm_fallback.rscrates/core/src/observability/openinference.rscrates/core/tests/unit/atif_tests.rscrates/core/tests/unit/observability/openinference_tests.rs
📜 Review details
⏰ Context from checks skipped due to timeout. (7)
- GitHub Check: WebAssembly / Test (windows-amd64)
- GitHub Check: Node.js / Test (windows-arm64)
- GitHub Check: WebAssembly / Test (windows-arm64)
- GitHub Check: WebAssembly / Test (macos-arm64)
- GitHub Check: Python / Test (windows-arm64)
- GitHub Check: Rust / Test (windows-arm64)
- GitHub Check: Rust / Test (windows-amd64)
🧰 Additional context used
📓 Path-based instructions (15)
**/*.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/observability/openinference_tests.rscrates/core/tests/unit/atif_tests.rscrates/core/src/observability/atif.rscrates/core/src/observability/manual_llm_fallback.rscrates/core/src/observability/openinference.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/observability/openinference_tests.rscrates/core/tests/unit/atif_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/observability/openinference_tests.rscrates/core/tests/unit/atif_tests.rscrates/core/src/observability/atif.rscrates/core/src/observability/manual_llm_fallback.rscrates/core/src/observability/openinference.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/observability/openinference_tests.rscrates/core/tests/unit/atif_tests.rscrates/core/src/observability/atif.rscrates/core/src/observability/manual_llm_fallback.rscrates/core/src/observability/openinference.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/observability/openinference_tests.rscrates/core/tests/unit/atif_tests.rscrates/core/src/observability/atif.rscrates/core/src/observability/manual_llm_fallback.rscrates/core/src/observability/openinference.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/observability/openinference_tests.rscrates/core/tests/unit/atif_tests.rscrates/core/src/observability/atif.rscrates/core/src/observability/manual_llm_fallback.rscrates/core/src/observability/openinference.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/observability/openinference_tests.rscrates/core/tests/unit/atif_tests.rscrates/core/src/observability/atif.rscrates/core/src/observability/manual_llm_fallback.rscrates/core/src/observability/openinference.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/observability/openinference_tests.rscrates/core/tests/unit/atif_tests.rscrates/core/src/observability/atif.rscrates/core/src/observability/manual_llm_fallback.rscrates/core/src/observability/openinference.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/observability/openinference_tests.rscrates/core/tests/unit/atif_tests.rscrates/core/src/observability/atif.rscrates/core/src/observability/manual_llm_fallback.rscrates/core/src/observability/openinference.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/observability/openinference_tests.rscrates/core/tests/unit/atif_tests.rscrates/core/src/observability/atif.rscrates/core/src/observability/manual_llm_fallback.rscrates/core/src/observability/openinference.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/observability/openinference_tests.rscrates/core/tests/unit/atif_tests.rscrates/core/src/observability/atif.rscrates/core/src/observability/manual_llm_fallback.rscrates/core/src/observability/openinference.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/observability/openinference_tests.rscrates/core/tests/unit/atif_tests.rscrates/core/src/observability/atif.rscrates/core/src/observability/manual_llm_fallback.rscrates/core/src/observability/openinference.rs
crates/{core,adaptive}/**/*.rs
⚙️ CodeRabbit configuration file
crates/{core,adaptive}/**/*.rs: Review the Rust runtime for async correctness, scope isolation, middleware ordering, and event lifecycle regressions.
Pay close attention to task-local/thread-local scope propagation, callback lifetimes, stream finalization, and root_uuid isolation.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.
Files:
crates/core/tests/unit/observability/openinference_tests.rscrates/core/tests/unit/atif_tests.rscrates/core/src/observability/atif.rscrates/core/src/observability/manual_llm_fallback.rscrates/core/src/observability/openinference.rs
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}
⚙️ CodeRabbit configuration file
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}: Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.
Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests.
Files:
crates/core/tests/unit/observability/openinference_tests.rscrates/core/tests/unit/atif_tests.rs
crates/core/src/observability/{atif,otel,openinference}.rs
📄 CodeRabbit inference engine (.agents/skills/maintain-observability/SKILL.md)
When changing event fields in ATIF, OpenTelemetry, or OpenInference observability surfaces, keep the core event model in
crates/core/src/observability/atif.rs,crates/core/src/observability/otel.rs, andcrates/core/src/observability/openinference.rsin sync
Files:
crates/core/src/observability/atif.rscrates/core/src/observability/openinference.rs
🔇 Additional comments (5)
crates/core/src/observability/manual_llm_fallback.rs (2)
21-29: LGTM!Also applies to: 61-68, 104-107, 220-355, 486-529
131-156: 🎯 Functional CorrectnessThe concern described in this review comment does not apply to the current code. The helpers used by the OpenInference path are already properly gated:
manual_cost_total_for_currency_from_llm_output(line 146) has#[cfg(any(feature = "openinference", test))]manual_cost_total_for_currency_from_maps(its dependency) also has#[cfg(any(feature = "openinference", test))]OpenInference can successfully use these functions in an openinference-only build without requiring the otel feature. No code changes are needed.
crates/core/tests/unit/observability/openinference_tests.rs (1)
2113-2126: LGTM!crates/core/src/observability/atif.rs (1)
699-725: LGTM!Also applies to: 738-741, 788-809
crates/core/tests/unit/atif_tests.rs (1)
804-843: LGTM!Also applies to: 927-945
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: 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/src/observability/openinference.rs`:
- Around line 1453-1464: The tool_call_name function duplicates the logic that
already exists in the manual_tool_call_name shared helper. Refactor the
tool_call_name function to reuse the manual_tool_call_name helper instead of
reimplementing the same name extraction logic. This will ensure both functions
stay in sync and prevent future drift in how tool-call attributes are handled
across display text and raw tool-call data.
🪄 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: a893610b-3f46-424b-965a-411e934b60f9
📒 Files selected for processing (5)
crates/core/src/observability/atif.rscrates/core/src/observability/manual_llm_fallback.rscrates/core/src/observability/openinference.rscrates/core/tests/unit/atif_tests.rscrates/core/tests/unit/observability/openinference_tests.rs
📜 Review details
🔇 Additional comments (5)
crates/core/src/observability/manual_llm_fallback.rs (2)
21-29: LGTM!Also applies to: 61-68, 104-107, 220-355, 486-529
131-156: 🎯 Functional CorrectnessThe concern described in this review comment does not apply to the current code. The helpers used by the OpenInference path are already properly gated:
manual_cost_total_for_currency_from_llm_output(line 146) has#[cfg(any(feature = "openinference", test))]manual_cost_total_for_currency_from_maps(its dependency) also has#[cfg(any(feature = "openinference", test))]OpenInference can successfully use these functions in an openinference-only build without requiring the otel feature. No code changes are needed.
crates/core/tests/unit/observability/openinference_tests.rs (1)
2113-2126: LGTM!crates/core/src/observability/atif.rs (1)
699-725: LGTM!Also applies to: 738-741, 788-809
crates/core/tests/unit/atif_tests.rs (1)
804-843: LGTM!Also applies to: 927-945
🛑 Comments failed to post (1)
crates/core/src/observability/openinference.rs (1)
1453-1464: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
Reuse the shared tool-call name reader here.
This local helper now mirrors
manual_tool_call_name, so future alias/precedence fixes can drift between display text and raw tool-call attributes.Refactor to the shared helper
fn tool_call_name(value: &Json) -> Option<String> { - value - .get("name") - .and_then(Json::as_str) - .or_else(|| value.get("toolName").and_then(Json::as_str)) - .or_else(|| { - value - .get("function") - .and_then(|function| function.get("name")) - .and_then(Json::as_str) - }) - .map(str::to_string) + manual_tool_call_name(value).map(str::to_string) }🤖 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/observability/openinference.rs` around lines 1453 - 1464, The tool_call_name function duplicates the logic that already exists in the manual_tool_call_name shared helper. Refactor the tool_call_name function to reuse the manual_tool_call_name helper instead of reimplementing the same name extraction logic. This will ensure both functions stay in sync and prevent future drift in how tool-call attributes are handled across display text and raw tool-call data.
willkill07
left a comment
There was a problem hiding this comment.
The best-effort codec-based approach in PR-291 is the same approach that should be applied here.
The intended purpose of the refactor is to avoid all of the specialized information extraction logic that we have. The various provider codecs are the "correct" and maintainable way to normalize this information consistently.
|
Thanks, that makes sense. I’ll rework this toward the codec-based normalization path from PR #291. |
Overview
Consolidates duplicated manual LLM fallback extraction used by the ATIF, OpenTelemetry, and OpenInference exporters while keeping exporter-specific projection and schema logic local.
This is intentionally scoped to observability exporter fallback readers. There is an open draft PR, #291, that touches a broader codec/provider-schema refactor and related observability files; this PR should be reviewed with that overlap in mind.
Details
Overlap note:
Validation:
cargo fmt --all -- --checkcargo check -p nemo-relay --no-default-features --libjust test-rustuv run pre-commit run --all-filesWhere should the reviewer start?
Start with
crates/core/src/observability/manual_llm_fallback.rs, then review the reduced call sites inatif.rs,otel.rs, andopeninference.rs.Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)
Summary by CodeRabbit
Release Notes