Skip to content

feat(adaptive): add opt-in caching for tool results - #597

Open
zhongxuanwang-nv wants to merge 7 commits into
NVIDIA:mainfrom
zhongxuanwang-nv:feat/response-cache-stage3
Open

feat(adaptive): add opt-in caching for tool results#597
zhongxuanwang-nv wants to merge 7 commits into
NVIDIA:mainfrom
zhongxuanwang-nv:feat/response-cache-stage3

Conversation

@zhongxuanwang-nv

@zhongxuanwang-nv zhongxuanwang-nv commented Jul 31, 2026

Copy link
Copy Markdown
Member

Overview

Adds opt-in tool-result caching to Adaptive response caching. A cache hit suppresses the real tool call, so caching remains disabled by default and only explicitly classified read-only, TTL-stable tools are eligible.

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

Details

  • Adds default, class, and per-tool override policies with exact/wildcard resolution, TTL, bypass rate, argument skips, and tool-version keying.
  • Shares the existing cache store while keeping tool and LLM keys disjoint; key and store failures fail open to a live tool call.
  • Adds Rust, Python, Node.js, and Go configuration parity, validation, doctor diagnostics, saved-invocation marks, and focused integration/benchmark coverage.
  • Keeps the feature diff focused: user-facing tool-cache documentation remains outside this PR, and only essential API/safety comments are retained.
  • Is based directly on NVIDIA/NeMo-Relay main at 93c8be34; earlier logical-key and staged documentation changes are not part of this diff.
  • Breaking changes: none.
  • Validation: just ci=true test-rust (3,717 passed), response-cache unit tests (61 passed), response-cache integration tests (50 passed), Python (613 passed), Node.js (342 passed), Go, workspace clippy with warnings denied, and all repository pre-commit hooks pass. The canonical non-CI Rust run also completed all unit/integration tests but encounters the existing upstream scope_stack.rs doctest reference to unavailable nemo_relay::Result.

Where should the reviewer start?

Start with crates/adaptive/src/response_cache/tool.rs for policy resolution and fail-open execution, then crates/adaptive/tests/integration/response_cache_tests.rs for the behavioral contract.

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

Summary by CodeRabbit

  • New Features

    • Added opt-in caching for tool results alongside exact-match LLM response caching.
    • Added configurable tool policies, including classes, per-tool overrides, TTLs, argument exclusions, bypass rates, priorities, and optional error caching.
    • Exposed tool-cache configuration across Python, Node.js, and Go APIs.
    • Added diagnostics for tool-cache status and configuration issues.
  • Bug Fixes

    • Improved cache-key normalization and validation for tool arguments, headers, wildcard rules, and expired entries.
    • Improved handling of cache failures and malformed streaming responses.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The response-cache system adds opt-in tool-result caching with configurable policies, deterministic keys, runtime interception, validation, multi-language configuration surfaces, diagnostics, and comprehensive tests.

Changes

Tool-result response caching

Layer / File(s) Summary
Tool policy contracts and validation
crates/adaptive/src/config.rs, crates/adaptive/src/response_cache/config.rs, crates/adaptive/src/plugin_component.rs, crates/adaptive/src/runtime/validation.rs, crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
Adds tool-cache configuration, class and override policies, defaults, field validation, wildcard conflict checks, and policy-resolution coverage.
Cache keys and event metadata
crates/adaptive/src/response_cache/key.rs, crates/adaptive/src/response_cache/mark.rs
Adds normalized tool argument policies, tool-result cache keys, error-policy partitioning, tool surfaces, and saved invocation metadata.
Tool interception and runtime registration
crates/adaptive/src/response_cache/tool.rs, crates/adaptive/src/response_cache/mod.rs, crates/adaptive/src/runtime/features.rs
Adds policy resolution, cache hits and misses, bypass handling, error-result filtering, fail-open storage behavior, and conditional runtime registration.
Language bindings and diagnostics
crates/node/*, go/nemo_relay/*, python/nemo_relay/*, crates/cli/src/diagnostics/mod.rs
Exposes tool-cache configuration and serialization in Node, Go, and Python. Adds CLI diagnostics and binding-level validation coverage.
Behavioral and compatibility coverage
crates/adaptive/tests/integration/*, crates/adaptive/tests/unit/response_cache/*, crates/core/tests/unit/codec/*, crates/core/tests/unit/llm_api_tests.rs
Adds integration, key, error-result, Redis, guardrail, wildcard-validation, streaming, replay, codec, and configuration tests.

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

Sequence Diagram(s)

sequenceDiagram
  participant ToolCaller
  participant ToolExecutionIntercept
  participant CacheStore
  participant ToolProvider
  ToolCaller->>ToolExecutionIntercept: invoke configured tool
  ToolExecutionIntercept->>CacheStore: read tool cache key
  CacheStore-->>ToolExecutionIntercept: return hit or miss
  alt cache hit
    ToolExecutionIntercept-->>ToolCaller: return cached result
  else cache miss or bypass
    ToolExecutionIntercept->>ToolProvider: execute tool
    ToolProvider-->>ToolExecutionIntercept: return tool result
    ToolExecutionIntercept->>CacheStore: store eligible result
    ToolExecutionIntercept-->>ToolCaller: return live result
  end
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title follows Conventional Commits format and concisely describes the opt-in tool-result caching change.
Description check ✅ Passed The description includes all required sections, explains the implementation and validation, identifies review entry points, and references a related issue.
Docstring Coverage ✅ Passed Docstring coverage is 80.56% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@github-actions github-actions Bot added size:XL PR is extra large Feature a new feature lang:go PR changes/introduces Go code lang:js PR changes/introduces Javascript/Typescript code lang:python PR changes/introduces Python code labels Jul 31, 2026
@github-actions github-actions Bot added the lang:rust PR changes/introduces Rust code label Jul 31, 2026
@github-actions

Copy link
Copy Markdown

@zhongxuanwang-nv

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🤖 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/adaptive/src/response_cache/tool.rs`:
- Around line 338-342: Move the inline #[cfg(test)] mod tests block in tool.rs
into a crate-level test file under tests/unit/response_cache, preserving the
policy-resolution and wildcard test bodies and imports. Replace the inline block
with a #[path] module include matching the existing sanctioned pattern, so the
tests retain access to resolve_policy, wildcard_match, wildcard_rank, and
wildcard_patterns_overlap without changing their visibility.

In `@crates/adaptive/tests/integration/response_cache_benchmark_tests.rs`:
- Around line 333-354: Move the shared helper implementations counting_tool and
tool_call from the integration test binary into response_cache_common.rs, then
remove the local duplicates and import the shared symbols in both integration
modules. Preserve their existing signatures and behavior, including run counting
and unwrapped tool execution.

In `@crates/cli/tests/coverage/shared/doctor_tests.rs`:
- Around line 1247-1289: Extend
collect_observability_reports_tool_cache_surface_for_cacheable_overrides to
cover both tool-cache branches: add a configuration with response-cache tools
disabled and assert the “configured but disabled” details, then add a separate
cache configuration with at least one cacheable class and assert its class count
independently from the override count. Preserve the existing enabled-tools
assertions for the cacheable override case.

In `@crates/node/tests/adaptive_runtime_tests.mjs`:
- Around line 29-42: Extend the test around adaptive.validateConfig and
adaptive.ComponentSpec to assert that the serialized configuration preserves
responseCache.tools in snake_case form, including its enabled state and
class/member data. Keep the existing empty-diagnostics assertion, but verify the
positive serialized payload so validator reachability is directly covered.

In `@crates/node/tests/adaptive_tests.mjs`:
- Around line 347-353: Align the response_cache.tools serialization asserted in
spec.config.response_cache.tools with the documented canonical shape used across
bindings. Include the canonical priority value and empty default ToolClass
fields rather than preserving their omission, while keeping the existing cache
settings unchanged.

In `@python/tests/test_adaptive_config.py`:
- Around line 265-280: Update test_invalid_tool_cache_section_is_rejected so
ResponseCacheConfig receives a non-empty namespace while retaining the duplicate
tool-class setup. Keep the existing assertion for
response_cache.tool_multiple_classes, ensuring the test isolates that diagnostic
without also triggering response_cache.missing_namespace.
🪄 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: 4fce90ea-a3ce-48f7-846e-c63746b28d93

📥 Commits

Reviewing files that changed from the base of the PR and between af9f8ba and 1de0ff1.

📒 Files selected for processing (31)
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/node/adaptive.d.ts
  • crates/node/adaptive.js
  • crates/node/tests/adaptive_runtime_tests.mjs
  • crates/node/tests/adaptive_tests.mjs
  • go/nemo_relay/adaptive.go
  • go/nemo_relay/adaptive/adaptive.go
  • go/nemo_relay/adaptive_runtime_test.go
  • python/nemo_relay/adaptive.py
  • python/nemo_relay/adaptive.pyi
  • python/tests/test_adaptive_config.py
📜 Review details
🧰 Additional context used
📓 Path-based instructions (31)
**/*.rs

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

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

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

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

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

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

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

Files:

  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
{crates/core,crates/adaptive}/**/*

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

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

Files:

  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • python/tests/test_adaptive_config.py
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • python/nemo_relay/adaptive.py
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/node/tests/adaptive_runtime_tests.mjs
  • crates/adaptive/src/plugin_component.rs
  • crates/node/tests/adaptive_tests.mjs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/node/adaptive.js
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • python/tests/test_adaptive_config.py
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • python/nemo_relay/adaptive.py
  • crates/adaptive/src/response_cache/config.rs
  • crates/node/adaptive.d.ts
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
**/*.{rs,py,go,js,ts,c,h}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

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

Files:

  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/node/adaptive.js
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • go/nemo_relay/adaptive/adaptive.go
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • python/tests/test_adaptive_config.py
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/config.rs
  • go/nemo_relay/adaptive_runtime_test.go
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • python/nemo_relay/adaptive.py
  • crates/adaptive/src/response_cache/config.rs
  • crates/node/adaptive.d.ts
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • go/nemo_relay/adaptive.go
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
**/*.{rs,go,js,ts}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

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

Files:

  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/node/adaptive.js
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • go/nemo_relay/adaptive/adaptive.go
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/config.rs
  • go/nemo_relay/adaptive_runtime_test.go
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/node/adaptive.d.ts
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • go/nemo_relay/adaptive.go
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
crates/adaptive/**

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

Keep crates/adaptive aligned with the canonical adaptive config schema, built-in section helpers, plugin lifecycle, and validation/report behavior.

Files:

  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
**/*

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

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

Files:

  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/node/tests/adaptive_runtime_tests.mjs
  • crates/adaptive/src/plugin_component.rs
  • crates/node/tests/adaptive_tests.mjs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/node/adaptive.js
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • go/nemo_relay/adaptive/adaptive.go
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • python/tests/test_adaptive_config.py
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/config.rs
  • go/nemo_relay/adaptive_runtime_test.go
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • python/nemo_relay/adaptive.py
  • python/nemo_relay/adaptive.pyi
  • crates/adaptive/src/response_cache/config.rs
  • crates/node/adaptive.d.ts
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • go/nemo_relay/adaptive.go
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
crates/{core,adaptive}/**/*

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

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

Files:

  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
**/*.{rs,py,go,js,ts}

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

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

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

Files:

  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/node/adaptive.js
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • go/nemo_relay/adaptive/adaptive.go
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • python/tests/test_adaptive_config.py
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/config.rs
  • go/nemo_relay/adaptive_runtime_test.go
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • python/nemo_relay/adaptive.py
  • crates/adaptive/src/response_cache/config.rs
  • crates/node/adaptive.d.ts
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • go/nemo_relay/adaptive.go
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
**/*.{rs,py,js,ts,tsx,go,java,kt,swift}

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

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

Files:

  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/node/adaptive.js
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • go/nemo_relay/adaptive/adaptive.go
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • python/tests/test_adaptive_config.py
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/config.rs
  • go/nemo_relay/adaptive_runtime_test.go
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • python/nemo_relay/adaptive.py
  • crates/adaptive/src/response_cache/config.rs
  • crates/node/adaptive.d.ts
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • go/nemo_relay/adaptive.go
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/tool.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/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/tool.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/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/node/tests/adaptive_runtime_tests.mjs
  • crates/node/tests/adaptive_tests.mjs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • python/tests/test_adaptive_config.py
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • go/nemo_relay/adaptive_runtime_test.go
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
{crates/**/src/**/*.rs,python/**/*.py}

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

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

Files:

  • crates/adaptive/src/response_cache/store.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/runtime/validation.rs
  • python/tests/test_adaptive_config.py
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/mod.rs
  • python/nemo_relay/adaptive.py
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/response_cache/tool.rs
crates/node/**/*.{js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use camelCase for Node.js public APIs.

Files:

  • crates/node/tests/adaptive_runtime_tests.mjs
  • crates/node/tests/adaptive_tests.mjs
  • crates/node/adaptive.js
  • crates/node/adaptive.d.ts
crates/{python,ffi,node}/**/*

⚙️ CodeRabbit configuration file

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

Files:

  • crates/node/tests/adaptive_runtime_tests.mjs
  • crates/node/tests/adaptive_tests.mjs
  • crates/node/adaptive.js
  • crates/node/adaptive.d.ts
crates/node/**/*.{js,ts,jsx,tsx,json}

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

Format changed Node files with npm run format --workspace=nemo-relay-node

Files:

  • crates/node/adaptive.js
  • crates/node/adaptive.d.ts
**/*.{md,mdx,py,go,js,ts}

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

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

Files:

  • crates/node/adaptive.js
  • go/nemo_relay/adaptive/adaptive.go
  • python/tests/test_adaptive_config.py
  • go/nemo_relay/adaptive_runtime_test.go
  • python/nemo_relay/adaptive.py
  • crates/node/adaptive.d.ts
  • go/nemo_relay/adaptive.go
go/nemo_relay/**/*.go

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

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

Use PascalCase for public Go APIs.

Files:

  • go/nemo_relay/adaptive/adaptive.go
  • go/nemo_relay/adaptive_runtime_test.go
  • go/nemo_relay/adaptive.go
**/*.go

📄 CodeRabbit inference engine (CONTRIBUTING.md)

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

Files:

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

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

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

Files:

  • go/nemo_relay/adaptive/adaptive.go
  • go/nemo_relay/adaptive_runtime_test.go
  • python/nemo_relay/adaptive.py
  • python/nemo_relay/adaptive.pyi
  • go/nemo_relay/adaptive.go
{python/nemo_relay/**/*.py,python/nemo_relay/**/*.pyi,go/nemo_relay/**/*.go}

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

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

Files:

  • go/nemo_relay/adaptive/adaptive.go
  • go/nemo_relay/adaptive_runtime_test.go
  • python/nemo_relay/adaptive.py
  • python/nemo_relay/adaptive.pyi
  • go/nemo_relay/adaptive.go
go/nemo_relay/adaptive/**

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

Keep Go adaptive helpers under go/nemo_relay/adaptive synchronized with the shared adaptive config model and lifecycle.

Files:

  • go/nemo_relay/adaptive/adaptive.go
go/nemo_relay/**

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

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

Files:

  • go/nemo_relay/adaptive/adaptive.go
  • go/nemo_relay/adaptive_runtime_test.go
  • go/nemo_relay/adaptive.go
go/nemo_relay/**/*

⚙️ CodeRabbit configuration file

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

Files:

  • go/nemo_relay/adaptive/adaptive.go
  • go/nemo_relay/adaptive_runtime_test.go
  • go/nemo_relay/adaptive.go
**/*.py

📄 CodeRabbit inference engine (CONTRIBUTING.md)

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

Files:

  • python/tests/test_adaptive_config.py
  • python/nemo_relay/adaptive.py
python/tests/**/*.py

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

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

Files:

  • python/tests/test_adaptive_config.py
python/nemo_relay/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • python/nemo_relay/adaptive.py
python/nemo_relay/{adaptive.py,plugin.py}

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

Keep Python adaptive/plugin wrappers in python/nemo_relay/adaptive.py and python/nemo_relay/plugin.py synchronized with the shared adaptive/plugin boundary and lifecycle.

Files:

  • python/nemo_relay/adaptive.py
python/nemo_relay/**/*

⚙️ CodeRabbit configuration file

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

Files:

  • python/nemo_relay/adaptive.py
  • python/nemo_relay/adaptive.pyi
crates/node/**/*.{ts,tsx,d.ts}

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

Use npm run check:docstrings --workspace=nemo-relay-node to validate public API docstring checks when surface docs changed

Files:

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

Applied to files:

  • go/nemo_relay/adaptive_runtime_test.go
📚 Learning: 2026-05-07T18:04:44.387Z
Learnt from: mnajafian-nv
Repo: NVIDIA/NeMo-Flow PR: 67
File: integrations/openclaw/src/modules.ts:1-2
Timestamp: 2026-05-07T18:04:44.387Z
Learning: In NVIDIA/NeMo-Flow, TypeScript source files should use `//` line comments for SPDX headers (e.g., `// SPDX-FileCopyrightText: ...` and `// SPDX-License-Identifier: ...`) rather than C-style block comments (`/* ... */`). The repo’s copyright checker enforces this mapping, so `//` SPDX headers in `.ts` files should not be flagged as a style violation.

Applied to files:

  • crates/node/adaptive.d.ts
🔇 Additional comments (40)
crates/adaptive/src/config.rs (1)

10-10: LGTM!

Also applies to: 37-38, 194-195, 221-223, 237-237, 413-413

crates/adaptive/src/lib.rs (1)

37-37: LGTM!

Also applies to: 61-61

crates/adaptive/src/response_cache/config.rs (1)

12-13: LGTM!

Also applies to: 68-100, 102-118, 120-139

crates/adaptive/src/plugin_component.rs (1)

324-324: LGTM!

Also applies to: 349-351, 378-449

crates/adaptive/src/runtime/validation.rs (1)

4-13: LGTM!

Also applies to: 205-292, 294-347, 349-380

crates/adaptive/tests/unit/config_tests.rs (1)

10-11: LGTM!

Also applies to: 37-50

crates/adaptive/src/response_cache/key.rs (1)

17-18: LGTM!

Also applies to: 119-120, 131-131, 220-260, 450-469

crates/adaptive/src/response_cache/store.rs (1)

33-33: LGTM!

crates/adaptive/src/response_cache/mark.rs (1)

106-128: LGTM!

Also applies to: 137-142, 163-168, 177-177, 219-224

crates/adaptive/src/response_cache/mod.rs (1)

4-8: LGTM!

Also applies to: 23-34

crates/adaptive/src/response_cache/tool.rs (3)

37-124: LGTM!


144-207: LGTM!


230-336: LGTM!

crates/adaptive/src/runtime/features.rs (1)

45-47: LGTM!

Also applies to: 489-489, 790-790, 800-800, 813-820, 835-845

crates/node/adaptive.d.ts (3)

55-70: LGTM!


83-134: LGTM!


335-336: LGTM!

crates/node/adaptive.js (2)

153-154: LGTM!


188-241: LGTM!

go/nemo_relay/adaptive.go (1)

70-70: LGTM!

Also applies to: 97-129, 248-256

go/nemo_relay/adaptive/adaptive.go (1)

55-69: LGTM!

Also applies to: 147-151

python/nemo_relay/adaptive.py (3)

254-362: LGTM!


365-411: LGTM!


429-429: LGTM!

Also applies to: 556-558

python/nemo_relay/adaptive.pyi (2)

184-226: LGTM!


245-256: LGTM!

Also applies to: 275-275

crates/cli/src/diagnostics/mod.rs (1)

667-695: LGTM!

crates/adaptive/tests/integration/response_cache_benchmark_tests.rs (1)

356-419: LGTM!

Also applies to: 421-515

crates/adaptive/tests/integration/response_cache_tests.rs (2)

1847-1876: LGTM!

Also applies to: 1926-2252, 2254-2539


1807-1816: 📐 Maintainability & Code Quality

Do not apply this lint finding. field_reassign_with_default checks assignments to top-level fields. All three sites assign the nested field config.backend.kind, so they do not match this lint pattern.

			> Likely an incorrect or invalid review comment.
crates/adaptive/tests/unit/response_cache/intercept_tests.rs (1)

6-102: LGTM!

Also applies to: 145-178, 180-242, 244-295

crates/adaptive/tests/unit/response_cache/key_tests.rs (1)

820-842: LGTM!

Also applies to: 844-924, 926-964

crates/adaptive/tests/unit/response_cache/replay_tests.rs (1)

151-179: LGTM!

crates/adaptive/tests/unit/response_cache/store_tests.rs (2)

218-233: LGTM!

Also applies to: 246-255, 265-274


234-238: 🎯 Functional Correctness

Keep the assertion. entry_size does not use created_unix_ms or expires_unix_ms, so the comparison is stable.

			> Likely an incorrect or invalid review comment.
crates/adaptive/tests/unit/response_cache/tool_tests.rs (1)

1-50: LGTM!

Also applies to: 52-125

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

44-63: LGTM!

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

334-346: LGTM!

python/tests/test_adaptive_config.py (1)

21-23: LGTM!

Also applies to: 224-242, 244-263

go/nemo_relay/adaptive_runtime_test.go (1)

251-335: LGTM!

Also applies to: 337-364

Comment thread crates/adaptive/src/response_cache/tool.rs
Comment thread crates/adaptive/tests/integration/response_cache_benchmark_tests.rs Outdated
Comment thread crates/cli/tests/coverage/shared/doctor_tests.rs
Comment thread crates/node/tests/adaptive_runtime_tests.mjs Outdated
Comment thread crates/node/tests/adaptive_tests.mjs
Comment thread python/tests/test_adaptive_config.py Outdated
@bbednarski9

Copy link
Copy Markdown
Contributor

Big PR. We are going to need to align this with #575 for the 0.8 release. Please include me in reviews before merge

@zhongxuanwang-nv

Copy link
Copy Markdown
Member Author

@bbednarski9 Sounds great! I think 575 can go in before this, and I would request your review after this PR is completely ready!

@willkill07 willkill07 changed the title feat: add opt-in caching for tool results feat(adaptive): add opt-in caching for tool results Jul 31, 2026
@zhongxuanwang-nv
zhongxuanwang-nv marked this pull request as ready for review August 3, 2026 23:09
@zhongxuanwang-nv
zhongxuanwang-nv requested a review from a team as a code owner August 3, 2026 23:09

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

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

⚠️ Outside diff range comments (1)
crates/cli/src/diagnostics/mod.rs (1)

865-866: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Reject missing endpoint types and blank endpoint values.

Line 865 resolves an endpoint after the code accepts a missing type as "unknown" and accepts "" as an endpoint. Require a nonblank type and endpoint before probing. Add doctor coverage for both invalid values.

As per coding guidelines, “Require every OpenTelemetry endpoint to have a type and nonblank destination.”

🤖 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/diagnostics/mod.rs` around lines 865 - 866, Update the
OpenTelemetry endpoint validation before the probing flow around
resolve_http_trace_endpoint and probe_otlp_http_named to reject missing or blank
endpoint types and blank endpoint values instead of defaulting the type to
"unknown" or probing an empty destination. Add doctor coverage verifying both
invalid inputs are rejected.

Source: Coding guidelines

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

Outside diff comments:
In `@crates/cli/src/diagnostics/mod.rs`:
- Around line 865-866: Update the OpenTelemetry endpoint validation before the
probing flow around resolve_http_trace_endpoint and probe_otlp_http_named to
reject missing or blank endpoint types and blank endpoint values instead of
defaulting the type to "unknown" or probing an empty destination. Add doctor
coverage verifying both invalid inputs are rejected.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: b91290da-08eb-4fd1-acd6-50dc21faeab3

📥 Commits

Reviewing files that changed from the base of the PR and between 1de0ff1 and 557adcf.

📒 Files selected for processing (20)
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/node/adaptive.d.ts
  • crates/node/adaptive.js
  • crates/node/tests/adaptive_runtime_tests.mjs
  • crates/node/tests/adaptive_tests.mjs
  • go/nemo_relay/adaptive.go
  • go/nemo_relay/adaptive_runtime_test.go
  • python/nemo_relay/adaptive.py
  • python/tests/test_adaptive_config.py
📜 Review details
🧰 Additional context used
📓 Path-based instructions (30)
crates/node/**/*.{js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use camelCase for Node.js public APIs.

Files:

  • crates/node/tests/adaptive_tests.mjs
  • crates/node/adaptive.d.ts
  • crates/node/adaptive.js
  • crates/node/tests/adaptive_runtime_tests.mjs
**/*.{rs,py,js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • crates/node/tests/adaptive_tests.mjs
  • crates/cli/src/diagnostics/mod.rs
  • python/tests/test_adaptive_config.py
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • python/nemo_relay/adaptive.py
  • crates/node/adaptive.d.ts
  • crates/node/adaptive.js
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/node/tests/adaptive_runtime_tests.mjs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
**/*

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

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

Files:

  • crates/node/tests/adaptive_tests.mjs
  • crates/cli/src/diagnostics/mod.rs
  • python/tests/test_adaptive_config.py
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • go/nemo_relay/adaptive_runtime_test.go
  • python/nemo_relay/adaptive.py
  • crates/node/adaptive.d.ts
  • crates/node/adaptive.js
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • go/nemo_relay/adaptive.go
  • crates/node/tests/adaptive_runtime_tests.mjs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
crates/{python,ffi,node}/**/*

⚙️ CodeRabbit configuration file

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

Files:

  • crates/node/tests/adaptive_tests.mjs
  • crates/node/adaptive.d.ts
  • crates/node/adaptive.js
  • crates/node/tests/adaptive_runtime_tests.mjs
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}

⚙️ CodeRabbit configuration file

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

Files:

  • crates/node/tests/adaptive_tests.mjs
  • python/tests/test_adaptive_config.py
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • go/nemo_relay/adaptive_runtime_test.go
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/node/tests/adaptive_runtime_tests.mjs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
**/*.rs

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

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

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

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

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

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

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

Files:

  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • crates/cli/src/diagnostics/mod.rs
  • python/tests/test_adaptive_config.py
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • python/nemo_relay/adaptive.py
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
**/*.{rs,py,go,js,ts,c,h}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

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

Files:

  • crates/cli/src/diagnostics/mod.rs
  • python/tests/test_adaptive_config.py
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • go/nemo_relay/adaptive_runtime_test.go
  • python/nemo_relay/adaptive.py
  • crates/node/adaptive.d.ts
  • crates/node/adaptive.js
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • go/nemo_relay/adaptive.go
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
**/*.{rs,go,js,ts}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

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

Files:

  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • go/nemo_relay/adaptive_runtime_test.go
  • crates/node/adaptive.d.ts
  • crates/node/adaptive.js
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • go/nemo_relay/adaptive.go
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
{crates/**/src/**/*.rs,python/**/*.py}

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

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

Files:

  • crates/cli/src/diagnostics/mod.rs
  • python/tests/test_adaptive_config.py
  • crates/adaptive/src/plugin_component.rs
  • python/nemo_relay/adaptive.py
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
**/*.{rs,py,go,js,ts}

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

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

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

Files:

  • crates/cli/src/diagnostics/mod.rs
  • python/tests/test_adaptive_config.py
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • go/nemo_relay/adaptive_runtime_test.go
  • python/nemo_relay/adaptive.py
  • crates/node/adaptive.d.ts
  • crates/node/adaptive.js
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • go/nemo_relay/adaptive.go
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
**/*.{rs,py,js,ts,tsx,go,java,kt,swift}

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

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

Files:

  • crates/cli/src/diagnostics/mod.rs
  • python/tests/test_adaptive_config.py
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • go/nemo_relay/adaptive_runtime_test.go
  • python/nemo_relay/adaptive.py
  • crates/node/adaptive.d.ts
  • crates/node/adaptive.js
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • go/nemo_relay/adaptive.go
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
**/*.py

📄 CodeRabbit inference engine (CONTRIBUTING.md)

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

Files:

  • python/tests/test_adaptive_config.py
  • python/nemo_relay/adaptive.py
python/tests/**/*.py

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

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

Files:

  • python/tests/test_adaptive_config.py
**/*.{md,mdx,py,go,js,ts}

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

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

Files:

  • python/tests/test_adaptive_config.py
  • go/nemo_relay/adaptive_runtime_test.go
  • python/nemo_relay/adaptive.py
  • crates/node/adaptive.d.ts
  • crates/node/adaptive.js
  • go/nemo_relay/adaptive.go
{crates/core,crates/adaptive}/**/*

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

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

Files:

  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
crates/adaptive/**

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

Keep crates/adaptive aligned with the canonical adaptive config schema, built-in section helpers, plugin lifecycle, and validation/report behavior.

Files:

  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
crates/{core,adaptive}/**/*

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

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

Files:

  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_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/adaptive/src/plugin_component.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
go/nemo_relay/**/*.go

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

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

Use PascalCase for public Go APIs.

Files:

  • go/nemo_relay/adaptive_runtime_test.go
  • go/nemo_relay/adaptive.go
**/*.go

📄 CodeRabbit inference engine (CONTRIBUTING.md)

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

Files:

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

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

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

Files:

  • go/nemo_relay/adaptive_runtime_test.go
  • python/nemo_relay/adaptive.py
  • go/nemo_relay/adaptive.go
{python/nemo_relay/**/*.py,python/nemo_relay/**/*.pyi,go/nemo_relay/**/*.go}

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

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

Files:

  • go/nemo_relay/adaptive_runtime_test.go
  • python/nemo_relay/adaptive.py
  • go/nemo_relay/adaptive.go
go/nemo_relay/**

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

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

Files:

  • go/nemo_relay/adaptive_runtime_test.go
  • go/nemo_relay/adaptive.go
go/nemo_relay/**/*

⚙️ CodeRabbit configuration file

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

Files:

  • go/nemo_relay/adaptive_runtime_test.go
  • go/nemo_relay/adaptive.go
python/nemo_relay/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • python/nemo_relay/adaptive.py
python/nemo_relay/{adaptive.py,plugin.py}

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

Keep Python adaptive/plugin wrappers in python/nemo_relay/adaptive.py and python/nemo_relay/plugin.py synchronized with the shared adaptive/plugin boundary and lifecycle.

Files:

  • python/nemo_relay/adaptive.py
python/nemo_relay/**/*

⚙️ CodeRabbit configuration file

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

Files:

  • python/nemo_relay/adaptive.py
crates/node/**/*.{js,ts,jsx,tsx,json}

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

Format changed Node files with npm run format --workspace=nemo-relay-node

Files:

  • crates/node/adaptive.d.ts
  • crates/node/adaptive.js
crates/node/**/*.{ts,tsx,d.ts}

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

Use npm run check:docstrings --workspace=nemo-relay-node to validate public API docstring checks when surface docs changed

Files:

  • crates/node/adaptive.d.ts
🧠 Learnings (4)
📚 Learning: 2026-08-03T19:55:03.931Z
Learnt from: afourniernv
Repo: NVIDIA/NeMo-Relay PR: 558
File: crates/pii-redaction/src/rampart/mod.rs:265-274
Timestamp: 2026-08-03T19:55:03.931Z
Learning: In NeMo Relay first-party plugin registration helpers, treat the documented duplicate-registration `PluginError::RegistrationFailed` result from `register_plugin` as success when registration is intended to be idempotent. Do not locally reclassify this as `PluginError::Conflict`; changing the classification requires a core-wide review of the public API and FFI behavior.

Applied to files:

  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
📚 Learning: 2026-07-28T20:33:25.156Z
Learnt from: willkill07
Repo: NVIDIA/NeMo-Relay PR: 572
File: go/nemo_relay/adaptive_runtime_test.go:214-238
Timestamp: 2026-07-28T20:33:25.156Z
Learning: When adding/adjusting Go unit tests for `BuildCacheRequestFacts` (request-ID validation and related request parsing), set `CacheRequestFactsInput.Provider` to a valid provider in all tests that are intended to isolate request-ID behavior—because `BuildCacheRequestFacts` does not validate `Provider`. Then add separate test coverage for malformed `AnnotatedRequest` JSON so JSON parsing failures are not conflated with `Provider`-related inputs.

Applied to files:

  • go/nemo_relay/adaptive_runtime_test.go
📚 Learning: 2026-05-07T18:04:44.387Z
Learnt from: mnajafian-nv
Repo: NVIDIA/NeMo-Flow PR: 67
File: integrations/openclaw/src/modules.ts:1-2
Timestamp: 2026-05-07T18:04:44.387Z
Learning: In NVIDIA/NeMo-Flow, TypeScript source files should use `//` line comments for SPDX headers (e.g., `// SPDX-FileCopyrightText: ...` and `// SPDX-License-Identifier: ...`) rather than C-style block comments (`/* ... */`). The repo’s copyright checker enforces this mapping, so `//` SPDX headers in `.ts` files should not be flagged as a style violation.

Applied to files:

  • crates/node/adaptive.d.ts
📚 Learning: 2026-08-03T17:55:34.521Z
Learnt from: afourniernv
Repo: NVIDIA/NeMo-Relay PR: 558
File: crates/node/pii_rampart.js:50-59
Timestamp: 2026-08-03T17:55:34.521Z
Learning: In Node.js helper modules under `crates/node`, use `ComponentSpec` as the public component-wrapper API name, including for wrappers such as `plugin`, `adaptive`, `observability`, `model_pricing`, `pii_redaction`, and equivalent modules like `pii_rampart`. This established API name takes precedence over the general camelCase public API guideline for consistency.

Applied to files:

  • crates/node/adaptive.js
🔇 Additional comments (19)
crates/adaptive/src/response_cache/key.rs (1)

61-62: LGTM!

Also applies to: 79-91, 103-139

crates/adaptive/src/response_cache/tool.rs (1)

278-290: LGTM!

Also applies to: 350-355

crates/adaptive/tests/integration/response_cache_benchmark_tests.rs (1)

27-30: LGTM!

crates/adaptive/tests/integration/response_cache_tests.rs (1)

19-21: LGTM!

Also applies to: 2010-2022, 2034-2047, 2049-2083

crates/adaptive/tests/unit/response_cache/key_tests.rs (1)

866-882: LGTM!

crates/adaptive/tests/unit/response_cache/tool_tests.rs (1)

4-15: LGTM!

Also applies to: 25-27, 37-114

crates/adaptive/src/response_cache/config.rs (1)

77-78: LGTM!

Also applies to: 94-94

crates/adaptive/src/plugin_component.rs (1)

218-218: LGTM!

Also applies to: 276-280, 282-367

crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs (1)

1-159: LGTM!

crates/adaptive/tests/unit/config_tests.rs (1)

38-40: LGTM!

crates/node/adaptive.d.ts (1)

55-55: LGTM!

Also applies to: 69-70, 83-137, 339-340

python/nemo_relay/adaptive.py (1)

255-364: LGTM!

Also applies to: 367-415, 431-431, 558-560

python/tests/test_adaptive_config.py (1)

21-23: LGTM!

Also applies to: 224-239

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

29-48: Assert the serialized tool-cache payload.

The diagnostics assertion does not prove that responseCache.tools reached the native configuration. Add a positive assertion for ComponentSpec(...).config.response_cache.tools.

crates/node/adaptive.js (1)

153-154: LGTM!

Also applies to: 188-240

go/nemo_relay/adaptive.go (1)

70-70: LGTM!

Also applies to: 97-132, 249-256

crates/cli/src/diagnostics/mod.rs (1)

28-28: LGTM!

Also applies to: 277-345, 356-376

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

334-354: LGTM!

go/nemo_relay/adaptive_runtime_test.go (1)

256-316: LGTM!

Comment thread crates/adaptive/src/response_cache/mark.rs Outdated
Comment thread crates/adaptive/src/response_cache/mark.rs Outdated
Comment thread crates/adaptive/src/config.rs Outdated
Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
@zhongxuanwang-nv
zhongxuanwang-nv force-pushed the feat/response-cache-stage3 branch from 557adcf to deb61a5 Compare August 8, 2026 01:18
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 5

Caution

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

⚠️ Outside diff range comments (1)
crates/adaptive/src/response_cache/key.rs (1)

79-91: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Do not reuse CACHE_SCHEMA_VERSION = 1 after changing the LLM key document. Keep version 2 or use a new version so mixed-version Redis fleets do not write different key shapes under the same schema version.

🤖 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/adaptive/src/response_cache/key.rs` around lines 79 - 91, The key
document built in the cache-key generation flow must not retain
CACHE_SCHEMA_VERSION = 1 after its shape changes. Update CACHE_SCHEMA_VERSION to
2 or another new version, ensuring all key documents produced by this flow use
the new schema version.
🤖 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/adaptive/tests/unit/response_cache/key_tests.rs`:
- Around line 1121-1130: Update tool_keys_are_disjoint_from_llm_keys so tool_key
uses the same "key-test" namespace configured by cache_all_config(), replacing
the existing empty namespace argument. Keep the assertion unchanged so the test
isolates the surface discriminator rather than namespace differences.

In `@crates/adaptive/tests/unit/response_cache/mark_tests.rs`:
- Around line 22-27: Extend the response-cache mark tests beyond
CacheSurface::as_str by capturing the event emitted through emit_cache_mark for
a CacheMark configured with CacheSurface::Tool and saved_invocations(n), then
assert the metadata keys nemo_relay.response_cache.surface equals "tool" and
nemo_relay.response_cache.saved_invocations contains the expected value. Also
cover a mark without saved_invocations and assert that metadata key is absent.

In `@crates/adaptive/tests/unit/response_cache/store_tests.rs`:
- Around line 68-91: Update start_redis_test_server to call set_read_timeout on
the accepted TcpStream before any read_redis_command calls, using a short
test-appropriate duration and handling the Result consistently with the
surrounding setup. This ensures missing handshake commands fail promptly instead
of blocking server.join().

In `@crates/adaptive/tests/unit/response_cache/tool_tests.rs`:
- Around line 216-285: Rename
disabling_error_caching_does_not_replay_an_opt_in_error_entry to describe that
changing cache_errors partitions the cache key space, or add a concise comment
documenting this behavior. Keep the existing assertions unchanged, since the
cached_error branch is covered by
stale_error_entries_are_not_replayed_when_error_caching_is_disabled.

In `@crates/cli/src/diagnostics/mod.rs`:
- Around line 768-796: Move the tool-cache check construction around the visible
config.tools handling before the offline non-in_memory backend early return, or
remove that return after recording the backend skip check. Ensure doctor
--offline always reports “Response cache (tools)” when tool caching is
configured, while preserving the backend skip behavior.

---

Outside diff comments:
In `@crates/adaptive/src/response_cache/key.rs`:
- Around line 79-91: The key document built in the cache-key generation flow
must not retain CACHE_SCHEMA_VERSION = 1 after its shape changes. Update
CACHE_SCHEMA_VERSION to 2 or another new version, ensuring all key documents
produced by this flow use the new schema version.
🪄 Autofix

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: 9cba81e1-a4bf-45d7-b69f-ed662a6cab01

📥 Commits

Reviewing files that changed from the base of the PR and between 5570b5b and deb61a5.

📒 Files selected for processing (40)
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/unit/cache_diagnostics_tests.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/tests/unit/plugin_component_tests.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/adaptive/tests/unit/runtime_tests.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/core/tests/unit/codec/anthropic_tests.rs
  • crates/core/tests/unit/codec/openai_chat_tests.rs
  • crates/core/tests/unit/codec/openai_responses_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/node/adaptive.d.ts
  • crates/node/adaptive.js
  • crates/node/tests/adaptive_runtime_tests.mjs
  • crates/node/tests/adaptive_tests.mjs
  • go/nemo_relay/adaptive.go
  • go/nemo_relay/adaptive/adaptive.go
  • go/nemo_relay/adaptive_runtime_test.go
  • python/nemo_relay/adaptive.py
  • python/nemo_relay/adaptive.pyi
  • python/tests/test_adaptive_config.py
💤 Files with no reviewable changes (1)
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
📜 Review details
⏰ Context from checks skipped due to timeout. (44)
  • GitHub Check: Node.js / Package (windows-amd64)
  • GitHub Check: Node.js / Package (macos-arm64)
  • GitHub Check: Node.js / Package (linux-arm64)
  • GitHub Check: Node.js / Package (linux-musl-amd64)
  • GitHub Check: Node.js / Package (linux-amd64)
  • GitHub Check: Node.js / Package (linux-musl-arm64)
  • GitHub Check: Node.js / Test (windows-arm64)
  • GitHub Check: Node.js / Package (windows-arm64)
  • GitHub Check: Python / Package (linux-musl-amd64)
  • GitHub Check: Rust / Package (windows-arm64)
  • GitHub Check: Node.js / Test (macos-arm64)
  • GitHub Check: Rust / Package (macos-arm64)
  • GitHub Check: Python / Package (windows-arm64)
  • GitHub Check: Rust / Package (linux-arm64)
  • GitHub Check: Rust / Package (windows-amd64)
  • GitHub Check: Node.js / Test (linux-arm64)
  • GitHub Check: Node.js / Test (windows-amd64)
  • GitHub Check: Python / Package (linux-amd64)
  • GitHub Check: Rust / Test (windows-amd64)
  • GitHub Check: Python / Package (linux-musl-arm64)
  • GitHub Check: Python / Package (macos-arm64)
  • GitHub Check: Rust / Test (linux-arm64)
  • GitHub Check: Rust / Test (linux-amd64)
  • GitHub Check: Rust / Package (linux-amd64)
  • GitHub Check: Rust / Package (linux-musl-amd64)
  • GitHub Check: Rust / Package (linux-musl-arm64)
  • GitHub Check: Rust / Test (macos-arm64)
  • GitHub Check: Python / Package (windows-amd64)
  • GitHub Check: Node.js / Test (linux-amd64)
  • GitHub Check: Python / Package (linux-arm64)
  • GitHub Check: Rust / Test (windows-arm64)
  • GitHub Check: Go / Test (macos-arm64)
  • GitHub Check: Node.js / Package OpenClaw plugin
  • GitHub Check: Go / Test (windows-amd64)
  • GitHub Check: Go / Test (windows-arm64)
  • GitHub Check: Go / Test (linux-arm64)
  • GitHub Check: Python / Test (linux-arm64)
  • GitHub Check: Python / Test (windows-arm64)
  • GitHub Check: Go / Test (linux-amd64)
  • GitHub Check: Python / Test (windows-amd64)
  • GitHub Check: Python / Test (linux-amd64)
  • GitHub Check: Python / Test (macos-arm64)
  • GitHub Check: Check / Run
  • GitHub Check: Preview docs
🧰 Additional context used
📓 Path-based instructions (40)
**/*

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

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

**/*: Use release tags in raw Rust-compatible SemVer without a leading v; tags such as v0.1.0 are prohibited.
Use branch prefixes feat/, fix/, docs/, test/, or refactor/ according to the change purpose.
Every commit in a pull request must include a DCO Signed-off-by: sign-off.
Before submitting a pull request, ensure pre-commit hooks, relevant tests, target-specific builds, documentation updates, and a rebase on the latest main are complete.
Use commit messages in the form type: short description, with a valid type and a first line under 72 characters.

Run the prescribed plugin validation commands, including fixture building, focused Rust and Python package tests, integration tests, documentation checks, and the broader validate-change matrix for broad runtime or public API changes.

**/*: Keep observability changes scoped, surface assumptions, and define focused validation before editing.
Run affected Rust tests and just test-rust for event-field changes; run just test-python, just test-go, and just test-node when binding-native configuration or lifecycle changes; update docs and examples in the same branch.

Files:

  • python/tests/test_adaptive_config.py
  • crates/adaptive/tests/unit/plugin_component_tests.rs
  • crates/adaptive/tests/unit/cache_diagnostics_tests.rs
  • crates/adaptive/tests/unit/runtime_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/core/tests/unit/codec/anthropic_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/core/tests/unit/codec/openai_chat_tests.rs
  • crates/node/tests/adaptive_tests.mjs
  • go/nemo_relay/adaptive_runtime_test.go
  • crates/node/tests/adaptive_runtime_tests.mjs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/node/adaptive.js
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/adaptive/src/config.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • python/nemo_relay/adaptive.py
  • go/nemo_relay/adaptive.go
  • go/nemo_relay/adaptive/adaptive.go
  • crates/node/adaptive.d.ts
  • crates/adaptive/src/response_cache/key.rs
  • python/nemo_relay/adaptive.pyi
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/codec/openai_responses_tests.rs
**/*.{rs,py,go,js,ts}

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

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

**/*.{rs,py,go,js,ts}: Keep FFI and Python, Go, and Node.js binding configuration objects and subscriber/exporter methods aligned with the core observability configuration and lifecycle semantics.
Preserve complete sanitized LLM request input and annotations when enable_full_payloads is enabled, while retaining credential removal and sanitizers.
Use each exporter's documented flush and deregister order before shutdown in observability examples and implementations.

Files:

  • python/tests/test_adaptive_config.py
  • crates/adaptive/tests/unit/plugin_component_tests.rs
  • crates/adaptive/tests/unit/cache_diagnostics_tests.rs
  • crates/adaptive/tests/unit/runtime_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/core/tests/unit/codec/anthropic_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/core/tests/unit/codec/openai_chat_tests.rs
  • go/nemo_relay/adaptive_runtime_test.go
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/node/adaptive.js
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/adaptive/src/config.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • python/nemo_relay/adaptive.py
  • go/nemo_relay/adaptive.go
  • go/nemo_relay/adaptive/adaptive.go
  • crates/node/adaptive.d.ts
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/codec/openai_responses_tests.rs
**/*.{rs,py,js,ts,tsx,go,java,kt,swift}

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

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

Files:

  • python/tests/test_adaptive_config.py
  • crates/adaptive/tests/unit/plugin_component_tests.rs
  • crates/adaptive/tests/unit/cache_diagnostics_tests.rs
  • crates/adaptive/tests/unit/runtime_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/core/tests/unit/codec/anthropic_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/core/tests/unit/codec/openai_chat_tests.rs
  • go/nemo_relay/adaptive_runtime_test.go
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/node/adaptive.js
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/adaptive/src/config.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • python/nemo_relay/adaptive.py
  • go/nemo_relay/adaptive.go
  • go/nemo_relay/adaptive/adaptive.go
  • crates/node/adaptive.d.ts
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/codec/openai_responses_tests.rs
**/*.{rs,py,js,jsx,ts,tsx,go,c,h,cc,cpp,md,toml,yml,yaml,sh}

📄 CodeRabbit inference engine (AGENTS.md)

Keep SPDX headers on source, documentation, scripts, and configuration files; the project is Apache-2.0.

Files:

  • python/tests/test_adaptive_config.py
  • crates/adaptive/tests/unit/plugin_component_tests.rs
  • crates/adaptive/tests/unit/cache_diagnostics_tests.rs
  • crates/adaptive/tests/unit/runtime_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/core/tests/unit/codec/anthropic_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/core/tests/unit/codec/openai_chat_tests.rs
  • go/nemo_relay/adaptive_runtime_test.go
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/node/adaptive.js
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/adaptive/src/config.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • python/nemo_relay/adaptive.py
  • go/nemo_relay/adaptive.go
  • go/nemo_relay/adaptive/adaptive.go
  • crates/node/adaptive.d.ts
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/codec/openai_responses_tests.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

Use snake_case naming in Rust and Python.

Files:

  • python/tests/test_adaptive_config.py
  • crates/adaptive/tests/unit/plugin_component_tests.rs
  • crates/adaptive/tests/unit/cache_diagnostics_tests.rs
  • crates/adaptive/tests/unit/runtime_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/core/tests/unit/codec/anthropic_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/core/tests/unit/codec/openai_chat_tests.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/adaptive/src/config.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • python/nemo_relay/adaptive.py
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/codec/openai_responses_tests.rs
**/*.{rs,py,js,mjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Preserve the existing Tokio-based asynchronous model and callback/future lifetimes; do not unexpectedly block or hide async work in bindings.

Files:

  • python/tests/test_adaptive_config.py
  • crates/adaptive/tests/unit/plugin_component_tests.rs
  • crates/adaptive/tests/unit/cache_diagnostics_tests.rs
  • crates/adaptive/tests/unit/runtime_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/core/tests/unit/codec/anthropic_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/core/tests/unit/codec/openai_chat_tests.rs
  • crates/node/tests/adaptive_tests.mjs
  • crates/node/tests/adaptive_runtime_tests.mjs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/node/adaptive.js
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/adaptive/src/config.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • python/nemo_relay/adaptive.py
  • crates/node/adaptive.d.ts
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/codec/openai_responses_tests.rs
python/tests/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Maintain test coverage for Python binding and wrapper changes with the Python test suite.

python/tests/**/*.py: Use pytest to run Python tests.
Do not add @pytest.mark.asyncio to tests; async tests are automatically detected by the async runner.
Do not add a -> None return type annotation to test functions.
When mocking a class, use unittest.mock.MagicMock or unittest.mock.AsyncMock, using spec when necessary, rather than defining a new class.
Prefix mocked class names with mock, not fake.
Prefer pytest fixtures over helper methods.
If a fixture is needed in multiple test files, define it in a conftest.py file instead of repeating it.
Define fixtures using @pytest.fixture(name="<fixture_name>"[, scope="<scope>"]) and a <fixture_name>_fixture function; specify scope only when it is not function.
Prefer pytest.mark.parametrize over separate tests for different input types.
Run focused pytest tests first when the affected area is known, and run the full suite with just test-python before review.

Files:

  • python/tests/test_adaptive_config.py
**/*.py

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.py: Lint Python with Ruff using rule sets E, F, W, and I.
Format Python with the Ruff formatter, using a 120-character line length and double quotes.
Run ty for Python type checking.
Use Python snake_case naming conventions.

Files:

  • python/tests/test_adaptive_config.py
  • python/nemo_relay/adaptive.py
**/*.{rs,py,go,js,jsx,ts,tsx,c,h}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.{rs,py,go,js,jsx,ts,tsx,c,h}: Run tests for every language affected by a change; changes to the core Rust crate require tests across all bindings.
Use SONAR_IGNORE_START / SONAR_IGNORE_END only for documented false positives, keep ignored blocks minimal, explain them with a comment, and obtain reviewer sign-off.
Preserve the layered architecture in which Rust provides the core runtime and C FFI, PyO3, and NAPI provide bindings that mirror the full API surface.

Files:

  • python/tests/test_adaptive_config.py
  • crates/adaptive/tests/unit/plugin_component_tests.rs
  • crates/adaptive/tests/unit/cache_diagnostics_tests.rs
  • crates/adaptive/tests/unit/runtime_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/core/tests/unit/codec/anthropic_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/core/tests/unit/codec/openai_chat_tests.rs
  • go/nemo_relay/adaptive_runtime_test.go
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/node/adaptive.js
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/adaptive/src/config.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • python/nemo_relay/adaptive.py
  • go/nemo_relay/adaptive.go
  • go/nemo_relay/adaptive/adaptive.go
  • crates/node/adaptive.d.ts
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/codec/openai_responses_tests.rs
**/{test,tests}/**/*

📄 CodeRabbit inference engine (CONTRIBUTING.md)

When adding functionality, include tests in the appropriate test files for each affected language binding.

Files:

  • python/tests/test_adaptive_config.py
  • crates/adaptive/tests/unit/plugin_component_tests.rs
  • crates/adaptive/tests/unit/cache_diagnostics_tests.rs
  • crates/adaptive/tests/unit/runtime_tests.rs
  • crates/core/tests/unit/codec/anthropic_tests.rs
  • crates/core/tests/unit/codec/openai_chat_tests.rs
  • crates/node/tests/adaptive_tests.mjs
  • crates/node/tests/adaptive_runtime_tests.mjs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/codec/openai_responses_tests.rs
**/*.{rs,py,go,js,jsx,ts,tsx,c,h,html,md,mdx,toml}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Include the appropriate SPDX copyright and Apache-2.0 license header in every source file.

Files:

  • python/tests/test_adaptive_config.py
  • crates/adaptive/tests/unit/plugin_component_tests.rs
  • crates/adaptive/tests/unit/cache_diagnostics_tests.rs
  • crates/adaptive/tests/unit/runtime_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/core/tests/unit/codec/anthropic_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/core/tests/unit/codec/openai_chat_tests.rs
  • go/nemo_relay/adaptive_runtime_test.go
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/node/adaptive.js
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/adaptive/src/config.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • python/nemo_relay/adaptive.py
  • go/nemo_relay/adaptive.go
  • go/nemo_relay/adaptive/adaptive.go
  • crates/node/adaptive.d.ts
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/codec/openai_responses_tests.rs
**/*.{toml,md,rs,py}

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

Treat plugin Relay compatibility as normal SemVer; use >=0.5,<1.0 in examples unless a plugin intentionally declares a narrower range.

Files:

  • python/tests/test_adaptive_config.py
  • crates/adaptive/tests/unit/plugin_component_tests.rs
  • crates/adaptive/tests/unit/cache_diagnostics_tests.rs
  • crates/adaptive/tests/unit/runtime_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/core/tests/unit/codec/anthropic_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/core/tests/unit/codec/openai_chat_tests.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/adaptive/src/config.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • python/nemo_relay/adaptive.py
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/codec/openai_responses_tests.rs
python/**/*.py

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

Python SDK tests belong under python/tests, not under source directories.

python/**/*.py: Format changed Python wrapper and test files with uv run ruff format python python/plugin.
Run uv run ruff format python python/plugin after changing Python wrapper or test files.

Files:

  • python/tests/test_adaptive_config.py
  • python/nemo_relay/adaptive.py
{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:

  • python/tests/test_adaptive_config.py
  • crates/adaptive/tests/unit/plugin_component_tests.rs
  • crates/adaptive/tests/unit/cache_diagnostics_tests.rs
  • crates/adaptive/tests/unit/runtime_tests.rs
  • crates/core/tests/unit/codec/anthropic_tests.rs
  • crates/core/tests/unit/codec/openai_chat_tests.rs
  • crates/node/tests/adaptive_tests.mjs
  • go/nemo_relay/adaptive_runtime_test.go
  • crates/node/tests/adaptive_runtime_tests.mjs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/codec/openai_responses_tests.rs
**/*.rs

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

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

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

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

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

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

**/*.rs: Format Rust code with rustfmt defaults using cargo fmt.
Run cargo clippy -- -D warnings; all Rust warnings must be treated as errors.
Use Rust snake_case naming conventions.

Files:

  • crates/adaptive/tests/unit/plugin_component_tests.rs
  • crates/adaptive/tests/unit/cache_diagnostics_tests.rs
  • crates/adaptive/tests/unit/runtime_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/core/tests/unit/codec/anthropic_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/core/tests/unit/codec/openai_chat_tests.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/adaptive/src/config.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/codec/openai_responses_tests.rs
{crates/core,crates/adaptive}/**/*

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

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

Files:

  • crates/adaptive/tests/unit/plugin_component_tests.rs
  • crates/adaptive/tests/unit/cache_diagnostics_tests.rs
  • crates/adaptive/tests/unit/runtime_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/core/tests/unit/codec/anthropic_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/core/tests/unit/codec/openai_chat_tests.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/codec/openai_responses_tests.rs
crates/adaptive/**

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

Keep crates/adaptive aligned with the canonical adaptive config schema, built-in section helpers, plugin lifecycle, and validation/report behavior.

Files:

  • crates/adaptive/tests/unit/plugin_component_tests.rs
  • crates/adaptive/tests/unit/cache_diagnostics_tests.rs
  • crates/adaptive/tests/unit/runtime_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
crates/{core,adaptive}/**/*

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

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

For shared-semantics or broad runtime changes in the core or adaptive crates, run just ci=true test-rust.

Files:

  • crates/adaptive/tests/unit/plugin_component_tests.rs
  • crates/adaptive/tests/unit/cache_diagnostics_tests.rs
  • crates/adaptive/tests/unit/runtime_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/core/tests/unit/codec/anthropic_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/core/tests/unit/codec/openai_chat_tests.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/codec/openai_responses_tests.rs
crates/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

crates/**/*.rs: Use Json = serde_json::Value in Rust-facing runtime APIs where existing code expects JSON payloads.
Treat Rust as the source of truth for runtime behavior; binding APIs should mirror Rust semantics unless a language-specific wrapper intentionally improves ergonomics.

crates/**/*.rs: Runtime helpers must cover marks, scopes, continuations, and isolated scope stacks.
plugins list, plugins inspect, and plugins validate must report lifecycle and compatibility status without leaking secret configuration.
Top-level doctor must report resolved dynamic-plugin and host-configuration status.

Files:

  • crates/adaptive/tests/unit/plugin_component_tests.rs
  • crates/adaptive/tests/unit/cache_diagnostics_tests.rs
  • crates/adaptive/tests/unit/runtime_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/core/tests/unit/codec/anthropic_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/core/tests/unit/codec/openai_chat_tests.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/adaptive/src/config.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/codec/openai_responses_tests.rs
crates/{core,adaptive,plugin,worker,worker-proto,types}/**/*.{rs,toml}

📄 CodeRabbit inference engine (.agents/skills/test-rust-core/SKILL.md)

For changes in the Rust core, adaptive, dynamic plugin, worker, worker-proto, or types crates, run cargo fmt --all, just test-rust, and cargo clippy --workspace --all-targets -- -D warnings as the default validation sequence.

Files:

  • crates/adaptive/tests/unit/plugin_component_tests.rs
  • crates/adaptive/tests/unit/cache_diagnostics_tests.rs
  • crates/adaptive/tests/unit/runtime_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/core/tests/unit/codec/anthropic_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/core/tests/unit/codec/openai_chat_tests.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/codec/openai_responses_tests.rs
crates/{core,adaptive,plugin,worker,worker-proto,types}/**/*

📄 CodeRabbit inference engine (.agents/skills/test-rust-core/SKILL.md)

crates/{core,adaptive,plugin,worker,worker-proto,types}/**/*: For changes affecting crates/core, crates/adaptive, or shared Rust runtime semantics, expand validation to the full binding matrix with validate-change.
Use narrower crate-specific tests only as a local debug loop, not as the final validation for a Rust change.
If a public API, event shape, middleware behavior, plugin semantics, or crates/core/crates/adaptive behavior changes, also run validate-change.
If the change is isolated to one binding wrapper while Rust semantics remain unchanged, prefer that binding's build/test skill instead.

Files:

  • crates/adaptive/tests/unit/plugin_component_tests.rs
  • crates/adaptive/tests/unit/cache_diagnostics_tests.rs
  • crates/adaptive/tests/unit/runtime_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/core/tests/unit/codec/anthropic_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/core/tests/unit/codec/openai_chat_tests.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/codec/openai_responses_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/adaptive/tests/unit/plugin_component_tests.rs
  • crates/adaptive/tests/unit/cache_diagnostics_tests.rs
  • crates/adaptive/tests/unit/runtime_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/core/tests/unit/codec/anthropic_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/core/tests/unit/codec/openai_chat_tests.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/codec/openai_responses_tests.rs
crates/**/src/**/*.rs

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

Do not add tests under src; Rust tests belong in crate tests/ trees.

Files:

  • crates/adaptive/src/lib.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/runtime/features.rs
crates/core/**/*.rs

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

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

Use Result<T> with FlowError in core runtime paths, keeping wrapper-layer errors explicit and binding-appropriate.

Files:

  • crates/core/tests/unit/codec/anthropic_tests.rs
  • crates/core/tests/unit/codec/openai_chat_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/tests/unit/codec/openai_responses_tests.rs
crates/node/**/*.{js,mjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use camelCase naming for Node.js APIs.

Files:

  • crates/node/tests/adaptive_tests.mjs
  • crates/node/tests/adaptive_runtime_tests.mjs
  • crates/node/adaptive.js
  • crates/node/adaptive.d.ts
crates/{python,ffi,node}/**/*

⚙️ CodeRabbit configuration file

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

Files:

  • crates/node/tests/adaptive_tests.mjs
  • crates/node/tests/adaptive_runtime_tests.mjs
  • crates/node/adaptive.js
  • crates/node/adaptive.d.ts
go/nemo_relay/**/*.go

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

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

Files:

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

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

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

Files:

  • go/nemo_relay/adaptive_runtime_test.go
  • python/nemo_relay/adaptive.py
  • go/nemo_relay/adaptive.go
  • go/nemo_relay/adaptive/adaptive.go
  • python/nemo_relay/adaptive.pyi
{python/nemo_relay/**/*.py,python/nemo_relay/**/*.pyi,go/nemo_relay/**/*.go}

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

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

Files:

  • go/nemo_relay/adaptive_runtime_test.go
  • python/nemo_relay/adaptive.py
  • go/nemo_relay/adaptive.go
  • go/nemo_relay/adaptive/adaptive.go
  • python/nemo_relay/adaptive.pyi
go/nemo_relay/**

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

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

Files:

  • go/nemo_relay/adaptive_runtime_test.go
  • go/nemo_relay/adaptive.go
  • go/nemo_relay/adaptive/adaptive.go
go/**/*.go

📄 CodeRabbit inference engine (AGENTS.md)

Use PascalCase for public Go APIs.

Files:

  • go/nemo_relay/adaptive_runtime_test.go
  • go/nemo_relay/adaptive.go
  • go/nemo_relay/adaptive/adaptive.go
**/*.go

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.go: Format Go code with gofmt.
Run go vet ./... for Go static analysis.
Use Go PascalCase naming conventions.

Files:

  • go/nemo_relay/adaptive_runtime_test.go
  • go/nemo_relay/adaptive.go
  • go/nemo_relay/adaptive/adaptive.go
go/nemo_relay/**/*

⚙️ CodeRabbit configuration file

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

Files:

  • go/nemo_relay/adaptive_runtime_test.go
  • go/nemo_relay/adaptive.go
  • go/nemo_relay/adaptive/adaptive.go
crates/node/**/*.{js,ts,jsx,tsx,json}

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

Format changed Node files with npm run format --workspace=nemo-relay-node

Files:

  • crates/node/adaptive.js
  • crates/node/adaptive.d.ts
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use Node.js camelCase naming conventions.

Files:

  • crates/node/adaptive.js
  • crates/node/adaptive.d.ts
python/nemo_relay/{adaptive.py,plugin.py}

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

Keep Python adaptive/plugin wrappers in python/nemo_relay/adaptive.py and python/nemo_relay/plugin.py synchronized with the shared adaptive/plugin boundary and lifecycle.

Files:

  • python/nemo_relay/adaptive.py
python/nemo_relay/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Keep Python wrapper modules under python/nemo_relay/; the native extension is built from crates/python with maturin.

Files:

  • python/nemo_relay/adaptive.py
python/nemo_relay/**/*

⚙️ CodeRabbit configuration file

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

Files:

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

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

Keep Go adaptive helpers under go/nemo_relay/adaptive synchronized with the shared adaptive config model and lifecycle.

Files:

  • go/nemo_relay/adaptive/adaptive.go
crates/node/**/*.{ts,tsx,d.ts}

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

Use npm run check:docstrings --workspace=nemo-relay-node to validate public API docstring checks when surface docs changed

Files:

  • crates/node/adaptive.d.ts
🧠 Learnings (4)
📚 Learning: 2026-08-03T19:55:03.931Z
Learnt from: afourniernv
Repo: NVIDIA/NeMo-Relay PR: 558
File: crates/pii-redaction/src/rampart/mod.rs:265-274
Timestamp: 2026-08-03T19:55:03.931Z
Learning: In NeMo Relay first-party plugin registration helpers, treat the documented duplicate-registration `PluginError::RegistrationFailed` result from `register_plugin` as success when registration is intended to be idempotent. Do not locally reclassify this as `PluginError::Conflict`; changing the classification requires a core-wide review of the public API and FFI behavior.

Applied to files:

  • crates/adaptive/tests/unit/plugin_component_tests.rs
  • crates/adaptive/tests/unit/cache_diagnostics_tests.rs
  • crates/adaptive/tests/unit/runtime_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/core/tests/unit/codec/anthropic_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/core/tests/unit/codec/openai_chat_tests.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/tests/unit/response_cache/tool_policy_tests.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/tests/unit/response_cache/intercept_tests.rs
  • crates/adaptive/src/config.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/tests/unit/response_cache/tool_tests.rs
  • crates/adaptive/src/response_cache/tool.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/codec/openai_responses_tests.rs
📚 Learning: 2026-07-28T20:33:25.156Z
Learnt from: willkill07
Repo: NVIDIA/NeMo-Relay PR: 572
File: go/nemo_relay/adaptive_runtime_test.go:214-238
Timestamp: 2026-07-28T20:33:25.156Z
Learning: When adding/adjusting Go unit tests for `BuildCacheRequestFacts` (request-ID validation and related request parsing), set `CacheRequestFactsInput.Provider` to a valid provider in all tests that are intended to isolate request-ID behavior—because `BuildCacheRequestFacts` does not validate `Provider`. Then add separate test coverage for malformed `AnnotatedRequest` JSON so JSON parsing failures are not conflated with `Provider`-related inputs.

Applied to files:

  • go/nemo_relay/adaptive_runtime_test.go
📚 Learning: 2026-08-03T17:55:34.521Z
Learnt from: afourniernv
Repo: NVIDIA/NeMo-Relay PR: 558
File: crates/node/pii_rampart.js:50-59
Timestamp: 2026-08-03T17:55:34.521Z
Learning: In Node.js helper modules under `crates/node`, use `ComponentSpec` as the public component-wrapper API name, including for wrappers such as `plugin`, `adaptive`, `observability`, `model_pricing`, `pii_redaction`, and equivalent modules like `pii_rampart`. This established API name takes precedence over the general camelCase public API guideline for consistency.

Applied to files:

  • crates/node/adaptive.js
📚 Learning: 2026-05-07T18:04:44.387Z
Learnt from: mnajafian-nv
Repo: NVIDIA/NeMo-Flow PR: 67
File: integrations/openclaw/src/modules.ts:1-2
Timestamp: 2026-05-07T18:04:44.387Z
Learning: In NVIDIA/NeMo-Flow, TypeScript source files should use `//` line comments for SPDX headers (e.g., `// SPDX-FileCopyrightText: ...` and `// SPDX-License-Identifier: ...`) rather than C-style block comments (`/* ... */`). The repo’s copyright checker enforces this mapping, so `//` SPDX headers in `.ts` files should not be flagged as a style violation.

Applied to files:

  • crates/node/adaptive.d.ts

Comment on lines +1121 to +1130
#[test]
fn tool_keys_are_disjoint_from_llm_keys() {
let llm = key_of(
"openai",
&request(json!({"model": "t", "messages": []})),
&cache_all_config(),
);
let tool = tool_key("", "t", None, json!({"messages": []}), &[]);
assert_ne!(llm, tool);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

The disjointness test does not isolate the surface discriminator.

The LLM key uses namespace "key-test" (from cache_all_config). The tool key uses namespace "". The two keys differ on namespace alone, so the assertion passes even if build_tool_cache_key omitted "surface": "tool_result". The test does not guard the property it names.

Use the same namespace on both sides.

💚 Proposed fix
     let tool = tool_key("", "t", None, json!({"messages": []}), &[]);
+    let tool = tool_key("key-test", "t", None, json!({"messages": []}), &[]);
     assert_ne!(llm, tool);

Replace the existing line rather than adding one; the namespace must match cache_all_config().namespace.

🤖 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/adaptive/tests/unit/response_cache/key_tests.rs` around lines 1121 -
1130, Update tool_keys_are_disjoint_from_llm_keys so tool_key uses the same
"key-test" namespace configured by cache_all_config(), replacing the existing
empty namespace argument. Keep the assertion unchanged so the test isolates the
surface discriminator rather than namespace differences.

Comment on lines +22 to +27
#[test]
fn cache_surfaces_have_stable_metadata_values() {
assert_eq!(CacheSurface::Llm.as_str(), "llm");
assert_eq!(CacheSurface::Tool.as_str(), "tool");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Add coverage for the emitted mark metadata, not only as_str.

This test checks the enum-to-string mapping. It does not check that emit_cache_mark writes nemo_relay.response_cache.surface as "tool" after CacheMark::surface(CacheSurface::Tool), nor that it writes nemo_relay.response_cache.saved_invocations after saved_invocations(n). Both are new behavior in crates/adaptive/src/response_cache/mark.rs lines 195 and 237-242, and both are the observable event contract that downstream consumers read.

Add a test that captures the emitted event and asserts those two metadata keys, including the case where saved_invocations is unset and the key must be absent.

As per path instructions: "Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests."

🤖 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/adaptive/tests/unit/response_cache/mark_tests.rs` around lines 22 -
27, Extend the response-cache mark tests beyond CacheSurface::as_str by
capturing the event emitted through emit_cache_mark for a CacheMark configured
with CacheSurface::Tool and saved_invocations(n), then assert the metadata keys
nemo_relay.response_cache.surface equals "tool" and
nemo_relay.response_cache.saved_invocations contains the expected value. Also
cover a mark without saved_invocations and assert that metadata key is absent.

Source: Path instructions

Comment on lines +68 to +91
fn start_redis_test_server(response: Vec<u8>) -> (String, thread::JoinHandle<Vec<u8>>) {
let listener = TcpListener::bind("127.0.0.1:0").expect("bind test Redis peer");
let url = format!(
"redis://{}/",
listener.local_addr().expect("test Redis address")
);
let server = thread::spawn(move || {
let (mut stream, _) = listener.accept().expect("accept Redis client");
// redis-rs identifies itself with two `CLIENT SETINFO` commands before
// it allows normal commands on a new connection.
for _ in 0..2 {
let setup = read_redis_command(&mut stream);
assert!(setup.windows(6).any(|window| window == b"CLIENT"));
stream
.write_all(b"+OK\r\n")
.expect("acknowledge Redis client setup");
}
let command = read_redis_command(&mut stream);
stream.write_all(&response).expect("write Redis response");
stream.flush().expect("flush Redis response");
command
});
(url, server)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

redis-rs 1.1 connection handshake CLIENT SETINFO LIB-NAME LIB-VER commands

💡 Result:

In recent versions of the redis-rs crate, the library automatically sends CLIENT SETINFO LIB-NAME and CLIENT SETINFO LIB-VER commands as part of the connection handshake [1]. This behavior was introduced to allow for better visibility into client usage, enabling server-side metrics and analytics to identify which libraries are connecting to the database [2][1]. Key details regarding this behavior include: 1. Purpose: The commands are sent as a low-cost, self-publishing act to help cloud providers and administrators collect statistics on client usage [1]. 2. Configuration and Control: - Users can manage this behavior through the RedisConnectionInfo struct [3]. - The API provides methods such as skip_set_lib_name and set_skip_set_lib_name to prevent these commands from being sent during connection initialization [3]. - Recent updates (e.g., PR #1970) have moved toward allowing users to explicitly override or configure the library name and version advertised to the server, and the previously used cargo feature flag (disable-client-setinfo) has been deprecated or removed in favor of direct connection configuration [4]. 3. Impact: Because these are additional commands sent during the handshake, they may introduce minor latency [5]. For applications highly sensitive to connection latency, users may choose to disable this behavior using the configuration methods mentioned above [3][5]. For the most up-to-date control, developers should refer to the RedisConnectionInfo API documentation to set or skip these parameters directly on their connection object [3][6].

Citations:


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- target test file ---'
cat -n crates/adaptive/tests/unit/response_cache/store_tests.rs | sed -n '1,125p'
printf '%s\n' '--- redis dependency declarations ---'
rg -n -C 3 'redis' --glob 'Cargo.toml' --glob 'Cargo.lock' .
printf '%s\n' '--- timeout patterns in nearby tests ---'
rg -n -C 2 'set_read_timeout|read_timeout|TcpListener' crates/adaptive/tests crates -g '*.rs' | head -200

Repository: NVIDIA/NeMo-Relay

Length of output: 22956


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- response-cache implementation and all helper call sites ---'
rg -n -C 5 'REDIS_OP_TIMEOUT|RedisCacheStore|start_redis_test_server|read_redis_command' crates/adaptive/src crates/adaptive/tests
printf '%s\n' '--- complete Redis-related test section ---'
cat -n crates/adaptive/tests/unit/response_cache/store_tests.rs | sed -n '65,280p'
printf '%s\n' '--- lockfile package metadata ---'
sed -n '2715,2765p' Cargo.lock

Repository: NVIDIA/NeMo-Relay

Length of output: 26247


🌐 Web query:

redis-rs 1.2.0 source CLIENT SETINFO handshake connection initialization

💡 Result:

In redis-rs, the CLIENT SETINFO command is sent automatically during connection initialization as part of a non-required handshake process [1]. This behavior was introduced to allow Redis servers, particularly those managed by cloud providers, to identify the client library and version being used for analytics, observability, and debugging purposes [1][2]. Key details regarding this behavior include: 1. Purpose: It is a low-cost mechanism for self-publishing, enabling server-side tools (like CLIENT LIST) to report which specific client (redis-rs) and version are active [1][2]. 2. Implementation: The library typically sends CLIENT SETINFO LIBNAME and CLIENT SETINFO LIBVER in a pipelined request when a new connection is established [1][3]. 3. Opt-out Mechanism: Because this initialization step can impact latency—particularly in scenarios involving high connection churn—the library provides an opt-out mechanism [3]. Users can disable this behavior by using the disable-client-setinfo feature or by configuring the RedisConnectionInfo to skip the command [4][3][5]. In version 1.2.0, while these commands are part of the standard connection handshake, they are not mandatory for protocol compliance and can be bypassed if they interfere with specific use cases or performance requirements [1][3].

Citations:


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- Redis constructor and test joins ---'
cat -n crates/adaptive/src/response_cache/store.rs | sed -n '314,372p'
cat -n crates/adaptive/tests/unit/response_cache/store_tests.rs | sed -n '330,430p'
printf '%s\n' '--- all joins in the target test file ---'
rg -n -C 3 '\.join\(' crates/adaptive/tests/unit/response_cache/store_tests.rs

Repository: NVIDIA/NeMo-Relay

Length of output: 6360


🏁 Script executed:

#!/bin/bash
set -eu
python3 - <<'PY'
from pathlib import Path
p = Path("crates/adaptive/tests/unit/response_cache/store_tests.rs").read_text()
start = p.index("fn start_redis_test_server")
end = p.index("\n}\n\n#[cfg(feature = \"redis-backend\")]", start) + 2
snippet = p[start:end]
print("helper uses blocking read_exact:", "read_exact" in snippet)
print("accepted stream timeout configured:", "set_read_timeout" in snippet)
print("fixed setup iterations:", snippet.count("for _ in 0..2"))
print("server thread returns captured command:", "command" in snippet and "thread::JoinHandle<Vec<u8>>" in snippet)
PY

Repository: NVIDIA/NeMo-Relay

Length of output: 307


Set a read timeout on the accepted stream.

If redis-rs sends fewer handshake commands, read_redis_command blocks in read_exact, and server.join() hangs because the server thread remains blocked. Use set_read_timeout so the test fails fast.

🤖 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/adaptive/tests/unit/response_cache/store_tests.rs` around lines 68 -
91, Update start_redis_test_server to call set_read_timeout on the accepted
TcpStream before any read_redis_command calls, using a short test-appropriate
duration and handling the Result consistently with the surrounding setup. This
ensures missing handshake commands fail promptly instead of blocking
server.join().

Comment on lines +216 to +285
#[tokio::test]
async fn disabling_error_caching_does_not_replay_an_opt_in_error_entry() {
let store = Arc::new(InMemoryCacheStore::new(1 << 20));
let response_cache = cache_config();
let opt_in_tools = Arc::new(ToolCacheConfig {
enabled: true,
cache_errors: true,
default: ToolClass {
cacheable: true,
..ToolClass::default()
},
..ToolCacheConfig::default()
});
let default_tools = Arc::new(ToolCacheConfig {
enabled: true,
default: ToolClass {
cacheable: true,
..ToolClass::default()
},
..ToolCacheConfig::default()
});
let calls = Arc::new(AtomicUsize::new(0));
let args = serde_json::json!({"query": "relay"});

let error = run_tool_cache(
"docs_lookup".to_string(),
args.clone(),
counting_next(
Arc::clone(&calls),
serde_json::json!({"error": "temporary outage"}),
),
store.clone(),
Arc::clone(&response_cache),
opt_in_tools,
)
.await
.unwrap();
assert_eq!(
error.result,
serde_json::json!({"error": "temporary outage"})
);

let success = run_tool_cache(
"docs_lookup".to_string(),
args.clone(),
counting_next(Arc::clone(&calls), serde_json::json!({"answer": "fresh"})),
store.clone(),
Arc::clone(&response_cache),
Arc::clone(&default_tools),
)
.await
.unwrap();
assert_eq!(success.result, serde_json::json!({"answer": "fresh"}));

let hit = run_tool_cache(
"docs_lookup".to_string(),
args,
counting_next(
Arc::clone(&calls),
serde_json::json!({"answer": "unexpected"}),
),
store,
response_cache,
default_tools,
)
.await
.unwrap();
assert_eq!(hit.result, serde_json::json!({"answer": "fresh"}));
assert_eq!(calls.load(Ordering::SeqCst), 2);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

The test name overstates what this asserts.

run_tool_cache folds tools.cache_errors into the key (tool.rs line 250). The write uses opt_in_tools (cache_errors: true) and the read uses default_tools (cache_errors: false), so the two calls address different keys. The third call is a normal miss followed by a hit on the success entry, not a suppressed replay of the opt-in error entry.

The cached_error branch at tool.rs lines 276-289 is exercised by stale_error_entries_are_not_replayed_when_error_caching_is_disabled, so coverage is intact. Rename this test to reflect key separation, or add a comment stating that toggling cache_errors partitions the key space.

🤖 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/adaptive/tests/unit/response_cache/tool_tests.rs` around lines 216 -
285, Rename disabling_error_caching_does_not_replay_an_opt_in_error_entry to
describe that changing cache_errors partitions the cache key space, or add a
concise comment documenting this behavior. Keep the existing assertions
unchanged, since the cached_error branch is covered by
stale_error_entries_are_not_replayed_when_error_caching_is_disabled.

Comment on lines +768 to +796
if let Some(tools) = config.tools.as_ref() {
let details = if tools.enabled {
let cacheable_classes = tools
.classes
.values()
.filter(|class| class.cacheable)
.count();
let cacheable_overrides = tools
.overrides
.values()
.filter(|override_| override_.cacheable == Some(true))
.count();
format!(
"on; {cacheable_classes} cacheable class(es); {cacheable_overrides} cacheable override(s); default {}",
if tools.default.cacheable {
"cacheable"
} else {
"uncached"
}
)
} else {
"configured but disabled".to_string()
};
checks.push(Check {
name: "Response cache (tools)",
status: Status::Info,
details,
});
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Report tool-cache state before the offline backend return.

When doctor --offline uses a non-in_memory response-cache backend, the function returns before this block. The CLI then omits Response cache (tools) even when tool caching is configured.

Emit the tool-cache check before the offline backend early return, or continue after adding the backend skip check.

🤖 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/diagnostics/mod.rs` around lines 768 - 796, Move the
tool-cache check construction around the visible config.tools handling before
the offline non-in_memory backend early return, or remove that return after
recording the backend skip check. Ensure doctor --offline always reports
“Response cache (tools)” when tool caching is configured, while preserving the
backend skip behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature a new feature lang:go PR changes/introduces Go code lang:js PR changes/introduces Javascript/Typescript code lang:python PR changes/introduces Python code lang:rust PR changes/introduces Rust code size:XL PR is extra large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants