feat(adaptive): add opt-in caching for tool results - #597
feat(adaptive): add opt-in caching for tool results#597zhongxuanwang-nv wants to merge 7 commits into
Conversation
WalkthroughThe 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. ChangesTool-result response caching
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
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
63c056d to
aa0ff7e
Compare
aa0ff7e to
34cfa63
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
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
📒 Files selected for processing (31)
crates/adaptive/src/config.rscrates/adaptive/src/lib.rscrates/adaptive/src/plugin_component.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/src/response_cache/mod.rscrates/adaptive/src/response_cache/store.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/runtime/features.rscrates/adaptive/src/runtime/validation.rscrates/adaptive/tests/integration/response_cache_benchmark_tests.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/cli/src/diagnostics/mod.rscrates/cli/tests/coverage/shared/doctor_tests.rscrates/node/adaptive.d.tscrates/node/adaptive.jscrates/node/tests/adaptive_runtime_tests.mjscrates/node/tests/adaptive_tests.mjsgo/nemo_relay/adaptive.gogo/nemo_relay/adaptive/adaptive.gogo/nemo_relay/adaptive_runtime_test.gopython/nemo_relay/adaptive.pypython/nemo_relay/adaptive.pyipython/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 runjust test-rust
Any Rust change must runcargo fmt --all
Any Rust change must runcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allfor all FFI work since it is Rust work
Runjust test-rustto validate FFI changes
Runcargo clippy --workspace --all-targets -- -D warningsto enforce strict linting on FFI workWhen Rust files changed as part of Go work, also run
cargo fmt --all,just test-rust, andcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allwhen Rust files are changed as part of Node work
Runcargo clippy --workspace --all-targets -- -D warningswhen Rust files are changed as part of Node work
Runjust test-rustwhen Rust files are changed as part of Node workWhen changing the core Rust runtime or Rust-facing API surface, format Rust code with
cargo fmt(rustfmt defaults), keepcargo clippy -- -D warningsclean, and satisfycargo deny checkperdeny.toml.
**/*.rs: If any Rust code changed, always runjust test-rust.
If any Rust code changed, also runcargo fmt --all.
If any Rust code changed, also runcargo clippy --workspace --all-targets -- -D warnings.
For Rust changes headed for review, runcargo fmt --allandcargo clippy --workspace --all-targets -- -D warningseven if relying on pre-commit.
Files:
crates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/src/response_cache/store.rscrates/cli/tests/coverage/shared/doctor_tests.rscrates/adaptive/src/plugin_component.rscrates/cli/src/diagnostics/mod.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/lib.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/adaptive/src/runtime/validation.rscrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_benchmark_tests.rscrates/adaptive/src/config.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/src/response_cache/tool.rs
{crates/core,crates/adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
Changes to
crates/coreorcrates/adaptivemust run the full language matrix
Files:
crates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/src/response_cache/store.rscrates/adaptive/src/plugin_component.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/lib.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/adaptive/src/runtime/validation.rscrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_benchmark_tests.rscrates/adaptive/src/config.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/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.rscrates/adaptive/src/response_cache/store.rscrates/cli/tests/coverage/shared/doctor_tests.rscrates/adaptive/src/plugin_component.rscrates/cli/src/diagnostics/mod.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/lib.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/adaptive/src/runtime/validation.rspython/tests/test_adaptive_config.pycrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_benchmark_tests.rscrates/adaptive/src/config.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rspython/nemo_relay/adaptive.pycrates/adaptive/src/response_cache/config.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/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}: UseJson = serde_json::Valuein Rust-facing runtime APIs where the existing code expects JSON payloads.
UseResult<T>withFlowErrorin 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.rscrates/adaptive/src/response_cache/store.rscrates/cli/tests/coverage/shared/doctor_tests.rscrates/node/tests/adaptive_runtime_tests.mjscrates/adaptive/src/plugin_component.rscrates/node/tests/adaptive_tests.mjscrates/cli/src/diagnostics/mod.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/lib.rscrates/adaptive/src/response_cache/mark.rscrates/node/adaptive.jscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/adaptive/src/runtime/validation.rspython/tests/test_adaptive_config.pycrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_benchmark_tests.rscrates/adaptive/src/config.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rspython/nemo_relay/adaptive.pycrates/adaptive/src/response_cache/config.rscrates/node/adaptive.d.tscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/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 prefixednemo_relay_, GoPascalCase, Node.jscamelCase, and Pythonsnake_case.
Files:
crates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/src/response_cache/store.rscrates/cli/tests/coverage/shared/doctor_tests.rscrates/adaptive/src/plugin_component.rscrates/cli/src/diagnostics/mod.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/lib.rscrates/adaptive/src/response_cache/mark.rscrates/node/adaptive.jscrates/adaptive/tests/unit/response_cache/store_tests.rsgo/nemo_relay/adaptive/adaptive.gocrates/adaptive/tests/unit/response_cache/key_tests.rscrates/adaptive/src/runtime/validation.rspython/tests/test_adaptive_config.pycrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_benchmark_tests.rscrates/adaptive/src/config.rsgo/nemo_relay/adaptive_runtime_test.gocrates/adaptive/src/response_cache/key.rscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rspython/nemo_relay/adaptive.pycrates/adaptive/src/response_cache/config.rscrates/node/adaptive.d.tscrates/adaptive/tests/unit/response_cache/tool_tests.rsgo/nemo_relay/adaptive.gocrates/adaptive/tests/integration/response_cache_tests.rscrates/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.rscrates/adaptive/src/response_cache/store.rscrates/cli/tests/coverage/shared/doctor_tests.rscrates/adaptive/src/plugin_component.rscrates/cli/src/diagnostics/mod.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/lib.rscrates/adaptive/src/response_cache/mark.rscrates/node/adaptive.jscrates/adaptive/tests/unit/response_cache/store_tests.rsgo/nemo_relay/adaptive/adaptive.gocrates/adaptive/tests/unit/response_cache/key_tests.rscrates/adaptive/src/runtime/validation.rscrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_benchmark_tests.rscrates/adaptive/src/config.rsgo/nemo_relay/adaptive_runtime_test.gocrates/adaptive/src/response_cache/key.rscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/adaptive/src/response_cache/config.rscrates/node/adaptive.d.tscrates/adaptive/tests/unit/response_cache/tool_tests.rsgo/nemo_relay/adaptive.gocrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/src/response_cache/tool.rs
crates/adaptive/**
📄 CodeRabbit inference engine (.agents/skills/maintain-optimizer/SKILL.md)
Keep
crates/adaptivealigned 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.rscrates/adaptive/src/response_cache/store.rscrates/adaptive/src/plugin_component.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/lib.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/adaptive/src/runtime/validation.rscrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_benchmark_tests.rscrates/adaptive/src/config.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/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, usemaintain-dynamic-pluginsand 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, preferuv run pre-commit run --files <changed files...>.
Before review or handoff, runuv run pre-commit run --all-files.
Files:
crates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/src/response_cache/store.rscrates/cli/tests/coverage/shared/doctor_tests.rscrates/node/tests/adaptive_runtime_tests.mjscrates/adaptive/src/plugin_component.rscrates/node/tests/adaptive_tests.mjscrates/cli/src/diagnostics/mod.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/lib.rscrates/adaptive/src/response_cache/mark.rscrates/node/adaptive.jscrates/adaptive/tests/unit/response_cache/store_tests.rsgo/nemo_relay/adaptive/adaptive.gocrates/adaptive/tests/unit/response_cache/key_tests.rscrates/adaptive/src/runtime/validation.rspython/tests/test_adaptive_config.pycrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_benchmark_tests.rscrates/adaptive/src/config.rsgo/nemo_relay/adaptive_runtime_test.gocrates/adaptive/src/response_cache/key.rscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rspython/nemo_relay/adaptive.pypython/nemo_relay/adaptive.pyicrates/adaptive/src/response_cache/config.rscrates/node/adaptive.d.tscrates/adaptive/tests/unit/response_cache/tool_tests.rsgo/nemo_relay/adaptive.gocrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/src/response_cache/tool.rs
crates/{core,adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If
crates/coreorcrates/adaptivechanged, run the full validation matrix across Rust, Python, Go, and Node.js.
Files:
crates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/src/response_cache/store.rscrates/adaptive/src/plugin_component.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/lib.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/adaptive/src/runtime/validation.rscrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_benchmark_tests.rscrates/adaptive/src/config.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/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; resolveheader_envvalues 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 andjust test-rustwhen event fields change; runjust test-python,just test-go, andjust test-nodewhen binding-native configuration or lifecycle changes.
Files:
crates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/src/response_cache/store.rscrates/cli/tests/coverage/shared/doctor_tests.rscrates/adaptive/src/plugin_component.rscrates/cli/src/diagnostics/mod.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/lib.rscrates/adaptive/src/response_cache/mark.rscrates/node/adaptive.jscrates/adaptive/tests/unit/response_cache/store_tests.rsgo/nemo_relay/adaptive/adaptive.gocrates/adaptive/tests/unit/response_cache/key_tests.rscrates/adaptive/src/runtime/validation.rspython/tests/test_adaptive_config.pycrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_benchmark_tests.rscrates/adaptive/src/config.rsgo/nemo_relay/adaptive_runtime_test.gocrates/adaptive/src/response_cache/key.rscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rspython/nemo_relay/adaptive.pycrates/adaptive/src/response_cache/config.rscrates/node/adaptive.d.tscrates/adaptive/tests/unit/response_cache/tool_tests.rsgo/nemo_relay/adaptive.gocrates/adaptive/tests/integration/response_cache_tests.rscrates/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.rscrates/adaptive/src/response_cache/store.rscrates/cli/tests/coverage/shared/doctor_tests.rscrates/adaptive/src/plugin_component.rscrates/cli/src/diagnostics/mod.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/lib.rscrates/adaptive/src/response_cache/mark.rscrates/node/adaptive.jscrates/adaptive/tests/unit/response_cache/store_tests.rsgo/nemo_relay/adaptive/adaptive.gocrates/adaptive/tests/unit/response_cache/key_tests.rscrates/adaptive/src/runtime/validation.rspython/tests/test_adaptive_config.pycrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_benchmark_tests.rscrates/adaptive/src/config.rsgo/nemo_relay/adaptive_runtime_test.gocrates/adaptive/src/response_cache/key.rscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rspython/nemo_relay/adaptive.pycrates/adaptive/src/response_cache/config.rscrates/node/adaptive.d.tscrates/adaptive/tests/unit/response_cache/tool_tests.rsgo/nemo_relay/adaptive.gocrates/adaptive/tests/integration/response_cache_tests.rscrates/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.rscrates/adaptive/src/response_cache/store.rscrates/adaptive/src/plugin_component.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/lib.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/adaptive/src/runtime/validation.rscrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_benchmark_tests.rscrates/adaptive/src/config.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/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.rscrates/cli/tests/coverage/shared/doctor_tests.rscrates/node/tests/adaptive_runtime_tests.mjscrates/node/tests/adaptive_tests.mjscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rspython/tests/test_adaptive_config.pycrates/adaptive/tests/integration/response_cache_benchmark_tests.rsgo/nemo_relay/adaptive_runtime_test.gocrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/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 cratetests/trees, and Python SDK tests belong underpython/tests.
Files:
crates/adaptive/src/response_cache/store.rscrates/adaptive/src/plugin_component.rscrates/cli/src/diagnostics/mod.rscrates/adaptive/src/lib.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/src/runtime/validation.rspython/tests/test_adaptive_config.pycrates/adaptive/src/runtime/features.rscrates/adaptive/src/config.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/src/response_cache/mod.rspython/nemo_relay/adaptive.pycrates/adaptive/src/response_cache/config.rscrates/adaptive/src/response_cache/tool.rs
crates/node/**/*.{js,mjs,cjs,ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use
camelCasefor Node.js public APIs.
Files:
crates/node/tests/adaptive_runtime_tests.mjscrates/node/tests/adaptive_tests.mjscrates/node/adaptive.jscrates/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.mjscrates/node/tests/adaptive_tests.mjscrates/node/adaptive.jscrates/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.jscrates/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.jsgo/nemo_relay/adaptive/adaptive.gopython/tests/test_adaptive_config.pygo/nemo_relay/adaptive_runtime_test.gopython/nemo_relay/adaptive.pycrates/node/adaptive.d.tsgo/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 withcd go/nemo_relay && go fmt ./...
Run Go tests withjust test-goto build and test the NeMo Relay Go binding
Usejust build-gowhen you want an explicit build-only pass or need the artifact for other work
Usejust ci=true test-gowhen you need the CI-style coverage and JUnit path
On macOS, setDYLD_LIBRARY_PATHto the../../target/releasedirectory before running the rawgo testcommand directlyUse
PascalCasefor public Go APIs.
Files:
go/nemo_relay/adaptive/adaptive.gogo/nemo_relay/adaptive_runtime_test.gogo/nemo_relay/adaptive.go
**/*.go
📄 CodeRabbit inference engine (CONTRIBUTING.md)
When changing the experimental Go binding, format Go code with
gofmtand keepgo vet ./...passing.
Files:
go/nemo_relay/adaptive/adaptive.gogo/nemo_relay/adaptive_runtime_test.gogo/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.gogo/nemo_relay/adaptive_runtime_test.gopython/nemo_relay/adaptive.pypython/nemo_relay/adaptive.pyigo/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.gogo/nemo_relay/adaptive_runtime_test.gopython/nemo_relay/adaptive.pypython/nemo_relay/adaptive.pyigo/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/adaptivesynchronized 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_relayaligned with plugin registration, composition, and lifecycle behavior.
Files:
go/nemo_relay/adaptive/adaptive.gogo/nemo_relay/adaptive_runtime_test.gogo/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.gogo/nemo_relay/adaptive_runtime_test.gogo/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 passtytype checking.
Add the SPDX license header to all Python source files using the#comment form.
Files:
python/tests/test_adaptive_config.pypython/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.asyncioto any test; async tests are automatically detected and run by the async runner.
Do not add a-> Nonereturn type annotation to test functions.
When mocking a class, do not define a new class; useunittest.mock.MagicMockorunittest.mock.AsyncMock, with thespecconstructor argument when necessary.
Name mocked classes with themockprefix, notfake.
Prefer pytest fixtures over helper methods.
Do not repeat fixtures; if a fixture is needed in multiple test files, place it in aconftest.pyfile.
When creating a fixture, use@pytest.fixture(name="<fixture_name>"[, scope="<scope>"])and define the fixture function asdef <fixture_name>_fixture() -> <return_type>:; only specifyscopewhen it is notfunction.
Preferpytest.mark.parametrizeover 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 fromcrates/pythonwithmaturin.
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.pyandpython/nemo_relay/plugin.pysynchronized 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.pypython/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-nodeto 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 QualityDo not apply this lint finding.
field_reassign_with_defaultchecks assignments to top-level fields. All three sites assign the nested fieldconfig.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 CorrectnessKeep the assertion.
entry_sizedoes not usecreated_unix_msorexpires_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
|
Big PR. We are going to need to align this with #575 for the 0.8 release. Please include me in reviews before merge |
|
@bbednarski9 Sounds great! I think 575 can go in before this, and I would request your review after this PR is completely ready! |
There was a problem hiding this comment.
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 winReject 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 nonblanktypeandendpointbefore 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
📒 Files selected for processing (20)
crates/adaptive/src/plugin_component.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/tests/integration/response_cache_benchmark_tests.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/cli/src/diagnostics/mod.rscrates/cli/tests/coverage/shared/doctor_tests.rscrates/node/adaptive.d.tscrates/node/adaptive.jscrates/node/tests/adaptive_runtime_tests.mjscrates/node/tests/adaptive_tests.mjsgo/nemo_relay/adaptive.gogo/nemo_relay/adaptive_runtime_test.gopython/nemo_relay/adaptive.pypython/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
camelCasefor Node.js public APIs.
Files:
crates/node/tests/adaptive_tests.mjscrates/node/adaptive.d.tscrates/node/adaptive.jscrates/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}: UseJson = serde_json::Valuein Rust-facing runtime APIs where the existing code expects JSON payloads.
UseResult<T>withFlowErrorin 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.mjscrates/cli/src/diagnostics/mod.rspython/tests/test_adaptive_config.pycrates/adaptive/src/plugin_component.rscrates/adaptive/tests/unit/config_tests.rscrates/cli/tests/coverage/shared/doctor_tests.rspython/nemo_relay/adaptive.pycrates/node/adaptive.d.tscrates/node/adaptive.jscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/node/tests/adaptive_runtime_tests.mjscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/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, usemaintain-dynamic-pluginsand 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, preferuv run pre-commit run --files <changed files...>.
Before review or handoff, runuv run pre-commit run --all-files.
Files:
crates/node/tests/adaptive_tests.mjscrates/cli/src/diagnostics/mod.rspython/tests/test_adaptive_config.pycrates/adaptive/src/plugin_component.rscrates/adaptive/tests/unit/config_tests.rscrates/cli/tests/coverage/shared/doctor_tests.rsgo/nemo_relay/adaptive_runtime_test.gopython/nemo_relay/adaptive.pycrates/node/adaptive.d.tscrates/node/adaptive.jscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rsgo/nemo_relay/adaptive.gocrates/node/tests/adaptive_runtime_tests.mjscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/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.mjscrates/node/adaptive.d.tscrates/node/adaptive.jscrates/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.mjspython/tests/test_adaptive_config.pycrates/adaptive/tests/unit/config_tests.rscrates/cli/tests/coverage/shared/doctor_tests.rsgo/nemo_relay/adaptive_runtime_test.gocrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/node/tests/adaptive_runtime_tests.mjscrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/tests/integration/response_cache_benchmark_tests.rs
**/*.rs
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
**/*.rs: Any Rust change must runjust test-rust
Any Rust change must runcargo fmt --all
Any Rust change must runcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allfor all FFI work since it is Rust work
Runjust test-rustto validate FFI changes
Runcargo clippy --workspace --all-targets -- -D warningsto enforce strict linting on FFI workWhen Rust files changed as part of Go work, also run
cargo fmt --all,just test-rust, andcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allwhen Rust files are changed as part of Node work
Runcargo clippy --workspace --all-targets -- -D warningswhen Rust files are changed as part of Node work
Runjust test-rustwhen Rust files are changed as part of Node workWhen changing the core Rust runtime or Rust-facing API surface, format Rust code with
cargo fmt(rustfmt defaults), keepcargo clippy -- -D warningsclean, and satisfycargo deny checkperdeny.toml.
**/*.rs: If any Rust code changed, always runjust test-rust.
If any Rust code changed, also runcargo fmt --all.
If any Rust code changed, also runcargo clippy --workspace --all-targets -- -D warnings.
For Rust changes headed for review, runcargo fmt --allandcargo clippy --workspace --all-targets -- -D warningseven if relying on pre-commit.
Files:
crates/cli/src/diagnostics/mod.rscrates/adaptive/src/plugin_component.rscrates/adaptive/tests/unit/config_tests.rscrates/cli/tests/coverage/shared/doctor_tests.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/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.rspython/tests/test_adaptive_config.pycrates/adaptive/src/plugin_component.rscrates/adaptive/tests/unit/config_tests.rscrates/cli/tests/coverage/shared/doctor_tests.rspython/nemo_relay/adaptive.pycrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/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 prefixednemo_relay_, GoPascalCase, Node.jscamelCase, and Pythonsnake_case.
Files:
crates/cli/src/diagnostics/mod.rspython/tests/test_adaptive_config.pycrates/adaptive/src/plugin_component.rscrates/adaptive/tests/unit/config_tests.rscrates/cli/tests/coverage/shared/doctor_tests.rsgo/nemo_relay/adaptive_runtime_test.gopython/nemo_relay/adaptive.pycrates/node/adaptive.d.tscrates/node/adaptive.jscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rsgo/nemo_relay/adaptive.gocrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/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.rscrates/adaptive/src/plugin_component.rscrates/adaptive/tests/unit/config_tests.rscrates/cli/tests/coverage/shared/doctor_tests.rsgo/nemo_relay/adaptive_runtime_test.gocrates/node/adaptive.d.tscrates/node/adaptive.jscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rsgo/nemo_relay/adaptive.gocrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/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 cratetests/trees, and Python SDK tests belong underpython/tests.
Files:
crates/cli/src/diagnostics/mod.rspython/tests/test_adaptive_config.pycrates/adaptive/src/plugin_component.rspython/nemo_relay/adaptive.pycrates/adaptive/src/response_cache/key.rscrates/adaptive/src/response_cache/tool.rscrates/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; resolveheader_envvalues 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 andjust test-rustwhen event fields change; runjust test-python,just test-go, andjust test-nodewhen binding-native configuration or lifecycle changes.
Files:
crates/cli/src/diagnostics/mod.rspython/tests/test_adaptive_config.pycrates/adaptive/src/plugin_component.rscrates/adaptive/tests/unit/config_tests.rscrates/cli/tests/coverage/shared/doctor_tests.rsgo/nemo_relay/adaptive_runtime_test.gopython/nemo_relay/adaptive.pycrates/node/adaptive.d.tscrates/node/adaptive.jscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rsgo/nemo_relay/adaptive.gocrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/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.rspython/tests/test_adaptive_config.pycrates/adaptive/src/plugin_component.rscrates/adaptive/tests/unit/config_tests.rscrates/cli/tests/coverage/shared/doctor_tests.rsgo/nemo_relay/adaptive_runtime_test.gopython/nemo_relay/adaptive.pycrates/node/adaptive.d.tscrates/node/adaptive.jscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rsgo/nemo_relay/adaptive.gocrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/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 passtytype checking.
Add the SPDX license header to all Python source files using the#comment form.
Files:
python/tests/test_adaptive_config.pypython/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.asyncioto any test; async tests are automatically detected and run by the async runner.
Do not add a-> Nonereturn type annotation to test functions.
When mocking a class, do not define a new class; useunittest.mock.MagicMockorunittest.mock.AsyncMock, with thespecconstructor argument when necessary.
Name mocked classes with themockprefix, notfake.
Prefer pytest fixtures over helper methods.
Do not repeat fixtures; if a fixture is needed in multiple test files, place it in aconftest.pyfile.
When creating a fixture, use@pytest.fixture(name="<fixture_name>"[, scope="<scope>"])and define the fixture function asdef <fixture_name>_fixture() -> <return_type>:; only specifyscopewhen it is notfunction.
Preferpytest.mark.parametrizeover 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.pygo/nemo_relay/adaptive_runtime_test.gopython/nemo_relay/adaptive.pycrates/node/adaptive.d.tscrates/node/adaptive.jsgo/nemo_relay/adaptive.go
{crates/core,crates/adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
Changes to
crates/coreorcrates/adaptivemust run the full language matrix
Files:
crates/adaptive/src/plugin_component.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/tests/integration/response_cache_benchmark_tests.rs
crates/adaptive/**
📄 CodeRabbit inference engine (.agents/skills/maintain-optimizer/SKILL.md)
Keep
crates/adaptivealigned with the canonical adaptive config schema, built-in section helpers, plugin lifecycle, and validation/report behavior.
Files:
crates/adaptive/src/plugin_component.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/tests/integration/response_cache_benchmark_tests.rs
crates/{core,adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If
crates/coreorcrates/adaptivechanged, run the full validation matrix across Rust, Python, Go, and Node.js.
Files:
crates/adaptive/src/plugin_component.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/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.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/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 withcd go/nemo_relay && go fmt ./...
Run Go tests withjust test-goto build and test the NeMo Relay Go binding
Usejust build-gowhen you want an explicit build-only pass or need the artifact for other work
Usejust ci=true test-gowhen you need the CI-style coverage and JUnit path
On macOS, setDYLD_LIBRARY_PATHto the../../target/releasedirectory before running the rawgo testcommand directlyUse
PascalCasefor public Go APIs.
Files:
go/nemo_relay/adaptive_runtime_test.gogo/nemo_relay/adaptive.go
**/*.go
📄 CodeRabbit inference engine (CONTRIBUTING.md)
When changing the experimental Go binding, format Go code with
gofmtand keepgo vet ./...passing.
Files:
go/nemo_relay/adaptive_runtime_test.gogo/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.gopython/nemo_relay/adaptive.pygo/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.gopython/nemo_relay/adaptive.pygo/nemo_relay/adaptive.go
go/nemo_relay/**
📄 CodeRabbit inference engine (.agents/skills/maintain-optimizer/SKILL.md)
Keep shared plugin helpers in
go/nemo_relayaligned with plugin registration, composition, and lifecycle behavior.
Files:
go/nemo_relay/adaptive_runtime_test.gogo/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.gogo/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 fromcrates/pythonwithmaturin.
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.pyandpython/nemo_relay/plugin.pysynchronized 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.tscrates/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-nodeto 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.rscrates/adaptive/src/plugin_component.rscrates/adaptive/tests/unit/config_tests.rscrates/cli/tests/coverage/shared/doctor_tests.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/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.toolsreached the native configuration. Add a positive assertion forComponentSpec(...).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!
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>
557adcf to
deb61a5
Compare
|
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. |
There was a problem hiding this comment.
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 winDo not reuse
CACHE_SCHEMA_VERSION = 1after changing the LLM key document. Keep version2or 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
📒 Files selected for processing (40)
crates/adaptive/src/config.rscrates/adaptive/src/lib.rscrates/adaptive/src/plugin_component.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/src/response_cache/mod.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/runtime/features.rscrates/adaptive/src/runtime/validation.rscrates/adaptive/tests/integration/response_cache_benchmark_tests.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/tests/unit/cache_diagnostics_tests.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/tests/unit/plugin_component_tests.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/adaptive/tests/unit/response_cache/mark_tests.rscrates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/tests/unit/runtime_features_tests.rscrates/adaptive/tests/unit/runtime_tests.rscrates/cli/src/diagnostics/mod.rscrates/cli/tests/coverage/shared/doctor_tests.rscrates/core/tests/unit/codec/anthropic_tests.rscrates/core/tests/unit/codec/openai_chat_tests.rscrates/core/tests/unit/codec/openai_responses_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/node/adaptive.d.tscrates/node/adaptive.jscrates/node/tests/adaptive_runtime_tests.mjscrates/node/tests/adaptive_tests.mjsgo/nemo_relay/adaptive.gogo/nemo_relay/adaptive/adaptive.gogo/nemo_relay/adaptive_runtime_test.gopython/nemo_relay/adaptive.pypython/nemo_relay/adaptive.pyipython/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, usemaintain-dynamic-pluginsand 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, preferuv run pre-commit run --files <changed files...>.
Before review or handoff, runuv run pre-commit run --all-files.
**/*: Use release tags in raw Rust-compatible SemVer without a leadingv; tags such asv0.1.0are prohibited.
Use branch prefixesfeat/,fix/,docs/,test/, orrefactor/according to the change purpose.
Every commit in a pull request must include a DCOSigned-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 latestmainare complete.
Use commit messages in the formtype: 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-changematrix 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.pycrates/adaptive/tests/unit/plugin_component_tests.rscrates/adaptive/tests/unit/cache_diagnostics_tests.rscrates/adaptive/tests/unit/runtime_tests.rscrates/adaptive/src/lib.rscrates/core/tests/unit/codec/anthropic_tests.rscrates/adaptive/src/plugin_component.rscrates/core/tests/unit/codec/openai_chat_tests.rscrates/node/tests/adaptive_tests.mjsgo/nemo_relay/adaptive_runtime_test.gocrates/node/tests/adaptive_runtime_tests.mjscrates/cli/src/diagnostics/mod.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/node/adaptive.jscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/mark_tests.rscrates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/adaptive/src/config.rscrates/cli/tests/coverage/shared/doctor_tests.rspython/nemo_relay/adaptive.pygo/nemo_relay/adaptive.gogo/nemo_relay/adaptive/adaptive.gocrates/node/adaptive.d.tscrates/adaptive/src/response_cache/key.rspython/nemo_relay/adaptive.pyicrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/runtime/validation.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/adaptive/tests/unit/runtime_features_tests.rscrates/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.pycrates/adaptive/tests/unit/plugin_component_tests.rscrates/adaptive/tests/unit/cache_diagnostics_tests.rscrates/adaptive/tests/unit/runtime_tests.rscrates/adaptive/src/lib.rscrates/core/tests/unit/codec/anthropic_tests.rscrates/adaptive/src/plugin_component.rscrates/core/tests/unit/codec/openai_chat_tests.rsgo/nemo_relay/adaptive_runtime_test.gocrates/cli/src/diagnostics/mod.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/node/adaptive.jscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/mark_tests.rscrates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/adaptive/src/config.rscrates/cli/tests/coverage/shared/doctor_tests.rspython/nemo_relay/adaptive.pygo/nemo_relay/adaptive.gogo/nemo_relay/adaptive/adaptive.gocrates/node/adaptive.d.tscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/runtime/validation.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/adaptive/tests/unit/runtime_features_tests.rscrates/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.pycrates/adaptive/tests/unit/plugin_component_tests.rscrates/adaptive/tests/unit/cache_diagnostics_tests.rscrates/adaptive/tests/unit/runtime_tests.rscrates/adaptive/src/lib.rscrates/core/tests/unit/codec/anthropic_tests.rscrates/adaptive/src/plugin_component.rscrates/core/tests/unit/codec/openai_chat_tests.rsgo/nemo_relay/adaptive_runtime_test.gocrates/cli/src/diagnostics/mod.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/node/adaptive.jscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/mark_tests.rscrates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/adaptive/src/config.rscrates/cli/tests/coverage/shared/doctor_tests.rspython/nemo_relay/adaptive.pygo/nemo_relay/adaptive.gogo/nemo_relay/adaptive/adaptive.gocrates/node/adaptive.d.tscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/runtime/validation.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/adaptive/tests/unit/runtime_features_tests.rscrates/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.pycrates/adaptive/tests/unit/plugin_component_tests.rscrates/adaptive/tests/unit/cache_diagnostics_tests.rscrates/adaptive/tests/unit/runtime_tests.rscrates/adaptive/src/lib.rscrates/core/tests/unit/codec/anthropic_tests.rscrates/adaptive/src/plugin_component.rscrates/core/tests/unit/codec/openai_chat_tests.rsgo/nemo_relay/adaptive_runtime_test.gocrates/cli/src/diagnostics/mod.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/node/adaptive.jscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/mark_tests.rscrates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/adaptive/src/config.rscrates/cli/tests/coverage/shared/doctor_tests.rspython/nemo_relay/adaptive.pygo/nemo_relay/adaptive.gogo/nemo_relay/adaptive/adaptive.gocrates/node/adaptive.d.tscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/runtime/validation.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/adaptive/tests/unit/runtime_features_tests.rscrates/core/tests/unit/codec/openai_responses_tests.rs
**/*.{rs,py}
📄 CodeRabbit inference engine (AGENTS.md)
Use
snake_casenaming in Rust and Python.
Files:
python/tests/test_adaptive_config.pycrates/adaptive/tests/unit/plugin_component_tests.rscrates/adaptive/tests/unit/cache_diagnostics_tests.rscrates/adaptive/tests/unit/runtime_tests.rscrates/adaptive/src/lib.rscrates/core/tests/unit/codec/anthropic_tests.rscrates/adaptive/src/plugin_component.rscrates/core/tests/unit/codec/openai_chat_tests.rscrates/cli/src/diagnostics/mod.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/mark_tests.rscrates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/adaptive/src/config.rscrates/cli/tests/coverage/shared/doctor_tests.rspython/nemo_relay/adaptive.pycrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/runtime/validation.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/adaptive/tests/unit/runtime_features_tests.rscrates/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.pycrates/adaptive/tests/unit/plugin_component_tests.rscrates/adaptive/tests/unit/cache_diagnostics_tests.rscrates/adaptive/tests/unit/runtime_tests.rscrates/adaptive/src/lib.rscrates/core/tests/unit/codec/anthropic_tests.rscrates/adaptive/src/plugin_component.rscrates/core/tests/unit/codec/openai_chat_tests.rscrates/node/tests/adaptive_tests.mjscrates/node/tests/adaptive_runtime_tests.mjscrates/cli/src/diagnostics/mod.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/node/adaptive.jscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/mark_tests.rscrates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/adaptive/src/config.rscrates/cli/tests/coverage/shared/doctor_tests.rspython/nemo_relay/adaptive.pycrates/node/adaptive.d.tscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/runtime/validation.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/adaptive/tests/unit/runtime_features_tests.rscrates/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.asyncioto tests; async tests are automatically detected by the async runner.
Do not add a-> Nonereturn type annotation to test functions.
When mocking a class, useunittest.mock.MagicMockorunittest.mock.AsyncMock, usingspecwhen necessary, rather than defining a new class.
Prefix mocked class names withmock, notfake.
Prefer pytest fixtures over helper methods.
If a fixture is needed in multiple test files, define it in aconftest.pyfile instead of repeating it.
Define fixtures using@pytest.fixture(name="<fixture_name>"[, scope="<scope>"])and a<fixture_name>_fixturefunction; specifyscopeonly when it is notfunction.
Preferpytest.mark.parametrizeover separate tests for different input types.
Run focused pytest tests first when the affected area is known, and run the full suite withjust test-pythonbefore review.
Files:
python/tests/test_adaptive_config.py
**/*.py
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.py: Lint Python with Ruff using rule setsE,F,W, andI.
Format Python with the Ruff formatter, using a 120-character line length and double quotes.
Runtyfor Python type checking.
Use Pythonsnake_casenaming conventions.
Files:
python/tests/test_adaptive_config.pypython/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.
UseSONAR_IGNORE_START/SONAR_IGNORE_ENDonly 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.pycrates/adaptive/tests/unit/plugin_component_tests.rscrates/adaptive/tests/unit/cache_diagnostics_tests.rscrates/adaptive/tests/unit/runtime_tests.rscrates/adaptive/src/lib.rscrates/core/tests/unit/codec/anthropic_tests.rscrates/adaptive/src/plugin_component.rscrates/core/tests/unit/codec/openai_chat_tests.rsgo/nemo_relay/adaptive_runtime_test.gocrates/cli/src/diagnostics/mod.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/node/adaptive.jscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/mark_tests.rscrates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/adaptive/src/config.rscrates/cli/tests/coverage/shared/doctor_tests.rspython/nemo_relay/adaptive.pygo/nemo_relay/adaptive.gogo/nemo_relay/adaptive/adaptive.gocrates/node/adaptive.d.tscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/runtime/validation.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/adaptive/tests/unit/runtime_features_tests.rscrates/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.pycrates/adaptive/tests/unit/plugin_component_tests.rscrates/adaptive/tests/unit/cache_diagnostics_tests.rscrates/adaptive/tests/unit/runtime_tests.rscrates/core/tests/unit/codec/anthropic_tests.rscrates/core/tests/unit/codec/openai_chat_tests.rscrates/node/tests/adaptive_tests.mjscrates/node/tests/adaptive_runtime_tests.mjscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/tests/unit/response_cache/mark_tests.rscrates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/cli/tests/coverage/shared/doctor_tests.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/adaptive/tests/unit/runtime_features_tests.rscrates/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.pycrates/adaptive/tests/unit/plugin_component_tests.rscrates/adaptive/tests/unit/cache_diagnostics_tests.rscrates/adaptive/tests/unit/runtime_tests.rscrates/adaptive/src/lib.rscrates/core/tests/unit/codec/anthropic_tests.rscrates/adaptive/src/plugin_component.rscrates/core/tests/unit/codec/openai_chat_tests.rsgo/nemo_relay/adaptive_runtime_test.gocrates/cli/src/diagnostics/mod.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/node/adaptive.jscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/mark_tests.rscrates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/adaptive/src/config.rscrates/cli/tests/coverage/shared/doctor_tests.rspython/nemo_relay/adaptive.pygo/nemo_relay/adaptive.gogo/nemo_relay/adaptive/adaptive.gocrates/node/adaptive.d.tscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/runtime/validation.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/adaptive/tests/unit/runtime_features_tests.rscrates/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.0in examples unless a plugin intentionally declares a narrower range.
Files:
python/tests/test_adaptive_config.pycrates/adaptive/tests/unit/plugin_component_tests.rscrates/adaptive/tests/unit/cache_diagnostics_tests.rscrates/adaptive/tests/unit/runtime_tests.rscrates/adaptive/src/lib.rscrates/core/tests/unit/codec/anthropic_tests.rscrates/adaptive/src/plugin_component.rscrates/core/tests/unit/codec/openai_chat_tests.rscrates/cli/src/diagnostics/mod.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/mark_tests.rscrates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/adaptive/src/config.rscrates/cli/tests/coverage/shared/doctor_tests.rspython/nemo_relay/adaptive.pycrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/runtime/validation.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/adaptive/tests/unit/runtime_features_tests.rscrates/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 withuv run ruff format python python/plugin.
Runuv run ruff format python python/pluginafter changing Python wrapper or test files.
Files:
python/tests/test_adaptive_config.pypython/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.pycrates/adaptive/tests/unit/plugin_component_tests.rscrates/adaptive/tests/unit/cache_diagnostics_tests.rscrates/adaptive/tests/unit/runtime_tests.rscrates/core/tests/unit/codec/anthropic_tests.rscrates/core/tests/unit/codec/openai_chat_tests.rscrates/node/tests/adaptive_tests.mjsgo/nemo_relay/adaptive_runtime_test.gocrates/node/tests/adaptive_runtime_tests.mjscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/tests/unit/response_cache/mark_tests.rscrates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/cli/tests/coverage/shared/doctor_tests.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/adaptive/tests/unit/runtime_features_tests.rscrates/core/tests/unit/codec/openai_responses_tests.rs
**/*.rs
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
**/*.rs: Any Rust change must runjust test-rust
Any Rust change must runcargo fmt --all
Any Rust change must runcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allfor all FFI work since it is Rust work
Runjust test-rustto validate FFI changes
Runcargo clippy --workspace --all-targets -- -D warningsto enforce strict linting on FFI workWhen Rust files changed as part of Go work, also run
cargo fmt --all,just test-rust, andcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allwhen Rust files are changed as part of Node work
Runcargo clippy --workspace --all-targets -- -D warningswhen Rust files are changed as part of Node work
Runjust test-rustwhen Rust files are changed as part of Node work
**/*.rs: If any Rust code changed, always runjust test-rust.
If any Rust code changed, also runcargo fmt --all.
If any Rust code changed, also runcargo clippy --workspace --all-targets -- -D warnings.
For Rust changes headed for review, runcargo fmt --allandcargo clippy --workspace --all-targets -- -D warningseven if relying on pre-commit.
**/*.rs: Format Rust code with rustfmt defaults usingcargo fmt.
Runcargo clippy -- -D warnings; all Rust warnings must be treated as errors.
Use Rustsnake_casenaming conventions.
Files:
crates/adaptive/tests/unit/plugin_component_tests.rscrates/adaptive/tests/unit/cache_diagnostics_tests.rscrates/adaptive/tests/unit/runtime_tests.rscrates/adaptive/src/lib.rscrates/core/tests/unit/codec/anthropic_tests.rscrates/adaptive/src/plugin_component.rscrates/core/tests/unit/codec/openai_chat_tests.rscrates/cli/src/diagnostics/mod.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/mark_tests.rscrates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/adaptive/src/config.rscrates/cli/tests/coverage/shared/doctor_tests.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/runtime/validation.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/adaptive/tests/unit/runtime_features_tests.rscrates/core/tests/unit/codec/openai_responses_tests.rs
{crates/core,crates/adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
Changes to
crates/coreorcrates/adaptivemust run the full language matrix
Files:
crates/adaptive/tests/unit/plugin_component_tests.rscrates/adaptive/tests/unit/cache_diagnostics_tests.rscrates/adaptive/tests/unit/runtime_tests.rscrates/adaptive/src/lib.rscrates/core/tests/unit/codec/anthropic_tests.rscrates/adaptive/src/plugin_component.rscrates/core/tests/unit/codec/openai_chat_tests.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/mark_tests.rscrates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/adaptive/src/config.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/runtime/validation.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/adaptive/tests/unit/runtime_features_tests.rscrates/core/tests/unit/codec/openai_responses_tests.rs
crates/adaptive/**
📄 CodeRabbit inference engine (.agents/skills/maintain-optimizer/SKILL.md)
Keep
crates/adaptivealigned with the canonical adaptive config schema, built-in section helpers, plugin lifecycle, and validation/report behavior.
Files:
crates/adaptive/tests/unit/plugin_component_tests.rscrates/adaptive/tests/unit/cache_diagnostics_tests.rscrates/adaptive/tests/unit/runtime_tests.rscrates/adaptive/src/lib.rscrates/adaptive/src/plugin_component.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/mark_tests.rscrates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/adaptive/src/config.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/runtime/validation.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/adaptive/tests/unit/runtime_features_tests.rs
crates/{core,adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If
crates/coreorcrates/adaptivechanged, 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.rscrates/adaptive/tests/unit/cache_diagnostics_tests.rscrates/adaptive/tests/unit/runtime_tests.rscrates/adaptive/src/lib.rscrates/core/tests/unit/codec/anthropic_tests.rscrates/adaptive/src/plugin_component.rscrates/core/tests/unit/codec/openai_chat_tests.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/mark_tests.rscrates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/adaptive/src/config.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/runtime/validation.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/adaptive/tests/unit/runtime_features_tests.rscrates/core/tests/unit/codec/openai_responses_tests.rs
crates/**/*.rs
📄 CodeRabbit inference engine (AGENTS.md)
crates/**/*.rs: UseJson = serde_json::Valuein 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, andplugins validatemust report lifecycle and compatibility status without leaking secret configuration.
Top-leveldoctormust report resolved dynamic-plugin and host-configuration status.
Files:
crates/adaptive/tests/unit/plugin_component_tests.rscrates/adaptive/tests/unit/cache_diagnostics_tests.rscrates/adaptive/tests/unit/runtime_tests.rscrates/adaptive/src/lib.rscrates/core/tests/unit/codec/anthropic_tests.rscrates/adaptive/src/plugin_component.rscrates/core/tests/unit/codec/openai_chat_tests.rscrates/cli/src/diagnostics/mod.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/mark_tests.rscrates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/adaptive/src/config.rscrates/cli/tests/coverage/shared/doctor_tests.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/runtime/validation.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/adaptive/tests/unit/runtime_features_tests.rscrates/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, andcargo clippy --workspace --all-targets -- -D warningsas the default validation sequence.
Files:
crates/adaptive/tests/unit/plugin_component_tests.rscrates/adaptive/tests/unit/cache_diagnostics_tests.rscrates/adaptive/tests/unit/runtime_tests.rscrates/adaptive/src/lib.rscrates/core/tests/unit/codec/anthropic_tests.rscrates/adaptive/src/plugin_component.rscrates/core/tests/unit/codec/openai_chat_tests.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/mark_tests.rscrates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/adaptive/src/config.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/runtime/validation.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/adaptive/tests/unit/runtime_features_tests.rscrates/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 affectingcrates/core,crates/adaptive, or shared Rust runtime semantics, expand validation to the full binding matrix withvalidate-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, orcrates/core/crates/adaptivebehavior changes, also runvalidate-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.rscrates/adaptive/tests/unit/cache_diagnostics_tests.rscrates/adaptive/tests/unit/runtime_tests.rscrates/adaptive/src/lib.rscrates/core/tests/unit/codec/anthropic_tests.rscrates/adaptive/src/plugin_component.rscrates/core/tests/unit/codec/openai_chat_tests.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/mark_tests.rscrates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/adaptive/src/config.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/runtime/validation.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/adaptive/tests/unit/runtime_features_tests.rscrates/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.rscrates/adaptive/tests/unit/cache_diagnostics_tests.rscrates/adaptive/tests/unit/runtime_tests.rscrates/adaptive/src/lib.rscrates/core/tests/unit/codec/anthropic_tests.rscrates/adaptive/src/plugin_component.rscrates/core/tests/unit/codec/openai_chat_tests.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/mark_tests.rscrates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/adaptive/src/config.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/runtime/validation.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/adaptive/tests/unit/runtime_features_tests.rscrates/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 cratetests/trees.
Files:
crates/adaptive/src/lib.rscrates/adaptive/src/plugin_component.rscrates/cli/src/diagnostics/mod.rscrates/adaptive/src/response_cache/mod.rscrates/adaptive/src/config.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/src/runtime/validation.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/src/runtime/features.rs
crates/core/**/*.rs
📄 CodeRabbit inference engine (.agents/skills/test-go-binding/SKILL.md)
If the change touched
crates/coreor shared runtime semantics, also usevalidate-changefor broader validationUse
Result<T>withFlowErrorin core runtime paths, keeping wrapper-layer errors explicit and binding-appropriate.
Files:
crates/core/tests/unit/codec/anthropic_tests.rscrates/core/tests/unit/codec/openai_chat_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/core/tests/unit/codec/openai_responses_tests.rs
crates/node/**/*.{js,mjs,ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use
camelCasenaming for Node.js APIs.
Files:
crates/node/tests/adaptive_tests.mjscrates/node/tests/adaptive_runtime_tests.mjscrates/node/adaptive.jscrates/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.mjscrates/node/tests/adaptive_runtime_tests.mjscrates/node/adaptive.jscrates/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 withcd go/nemo_relay && go fmt ./...
Run Go tests withjust test-goto build and test the NeMo Relay Go binding
Usejust build-gowhen you want an explicit build-only pass or need the artifact for other work
Usejust ci=true test-gowhen you need the CI-style coverage and JUnit path
On macOS, setDYLD_LIBRARY_PATHto the../../target/releasedirectory before running the rawgo testcommand directly
Files:
go/nemo_relay/adaptive_runtime_test.gogo/nemo_relay/adaptive.gogo/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.gopython/nemo_relay/adaptive.pygo/nemo_relay/adaptive.gogo/nemo_relay/adaptive/adaptive.gopython/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.gopython/nemo_relay/adaptive.pygo/nemo_relay/adaptive.gogo/nemo_relay/adaptive/adaptive.gopython/nemo_relay/adaptive.pyi
go/nemo_relay/**
📄 CodeRabbit inference engine (.agents/skills/maintain-optimizer/SKILL.md)
Keep shared plugin helpers in
go/nemo_relayaligned with plugin registration, composition, and lifecycle behavior.
Files:
go/nemo_relay/adaptive_runtime_test.gogo/nemo_relay/adaptive.gogo/nemo_relay/adaptive/adaptive.go
go/**/*.go
📄 CodeRabbit inference engine (AGENTS.md)
Use
PascalCasefor public Go APIs.
Files:
go/nemo_relay/adaptive_runtime_test.gogo/nemo_relay/adaptive.gogo/nemo_relay/adaptive/adaptive.go
**/*.go
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.go: Format Go code withgofmt.
Rungo vet ./...for Go static analysis.
Use GoPascalCasenaming conventions.
Files:
go/nemo_relay/adaptive_runtime_test.gogo/nemo_relay/adaptive.gogo/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.gogo/nemo_relay/adaptive.gogo/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.jscrates/node/adaptive.d.ts
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Use Node.js
camelCasenaming conventions.
Files:
crates/node/adaptive.jscrates/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.pyandpython/nemo_relay/plugin.pysynchronized 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 fromcrates/pythonwithmaturin.
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.pypython/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/adaptivesynchronized 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-nodeto 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.rscrates/adaptive/tests/unit/cache_diagnostics_tests.rscrates/adaptive/tests/unit/runtime_tests.rscrates/adaptive/src/lib.rscrates/core/tests/unit/codec/anthropic_tests.rscrates/adaptive/src/plugin_component.rscrates/core/tests/unit/codec/openai_chat_tests.rscrates/cli/src/diagnostics/mod.rscrates/adaptive/tests/unit/response_cache/tool_policy_tests.rscrates/adaptive/src/response_cache/mod.rscrates/adaptive/tests/unit/response_cache/mark_tests.rscrates/adaptive/tests/unit/response_cache/replay_tests.rscrates/adaptive/tests/unit/response_cache/intercept_tests.rscrates/adaptive/src/config.rscrates/cli/tests/coverage/shared/doctor_tests.rscrates/adaptive/src/response_cache/key.rscrates/adaptive/tests/unit/config_tests.rscrates/adaptive/src/runtime/validation.rscrates/adaptive/tests/unit/response_cache/tool_tests.rscrates/adaptive/src/response_cache/tool.rscrates/adaptive/src/response_cache/config.rscrates/adaptive/src/response_cache/mark.rscrates/adaptive/src/runtime/features.rscrates/adaptive/tests/integration/response_cache_tests.rscrates/adaptive/tests/unit/response_cache/store_tests.rscrates/adaptive/tests/unit/response_cache/key_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/adaptive/tests/unit/runtime_features_tests.rscrates/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
| #[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); | ||
| } |
There was a problem hiding this comment.
🎯 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.
| #[test] | ||
| fn cache_surfaces_have_stable_metadata_values() { | ||
| assert_eq!(CacheSurface::Llm.as_str(), "llm"); | ||
| assert_eq!(CacheSurface::Tool.as_str(), "tool"); | ||
| } | ||
|
|
There was a problem hiding this comment.
📐 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
| 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) | ||
| } |
There was a problem hiding this comment.
🩺 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:
- 1: Feature "disable-client-setinfo" missing from Documentation redis-rs/redis-rs#1535
- 2: Call CLIENT SETINFO on new connections. redis-rs/redis-rs#945
- 3: https://docs.rs/redis/latest/redis/struct.RedisConnectionInfo.html
- 4: redis-rs/redis-rs@e3bea03
- 5: Opt-out client set info when creating new connection redis-rs/redis-rs#1034
- 6: https://docs.rs/redis/latest/redis/struct.ConnectionInfo.html
🏁 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 -200Repository: 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.lockRepository: 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:
- 1: Feature "disable-client-setinfo" missing from Documentation redis-rs/redis-rs#1535
- 2: Call CLIENT SETINFO on new connections. redis-rs/redis-rs#945
- 3: Opt-out client set info when creating new connection redis-rs/redis-rs#1034
- 4: https://docs.rs/redis/latest/redis/struct.RedisConnectionInfo.html
- 5: feat: add disable client setinfo feature and its default mode is off redis-rs/redis-rs#1036
🏁 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.rsRepository: 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)
PYRepository: 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().
| #[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); | ||
| } |
There was a problem hiding this comment.
📐 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.
| 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, | ||
| }); | ||
| } |
There was a problem hiding this comment.
🎯 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.
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.
Details
mainat93c8be34; earlier logical-key and staged documentation changes are not part of this diff.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 upstreamscope_stack.rsdoctest reference to unavailablenemo_relay::Result.Where should the reviewer start?
Start with
crates/adaptive/src/response_cache/tool.rsfor policy resolution and fail-open execution, thencrates/adaptive/tests/integration/response_cache_tests.rsfor the behavioral contract.Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)
Summary by CodeRabbit
New Features
Bug Fixes