Skip to content

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

Open
zhongxuanwang-nv wants to merge 9 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 9 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.

Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
@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/*
Adds integration, key, error-result, Redis, guardrail, wildcard-validation, and warm-cache latency 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 | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 76.55% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title follows Conventional Commits format, uses an allowed type and lowercase scope, states the feature clearly, and is under 72 characters.
Description check ✅ Passed The description includes all required sections, completed confirmations, implementation details, reviewer guidance, and a valid related-issue action keyword.
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

Warning

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

🔧 golangci-lint (2.12.2)

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


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

@github-actions 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

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

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 Outdated
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!

Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
@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
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 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!

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.

2 participants