Skip to content

feat: opt-in exact-match LLM response cache (stage 1/5)#404

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

feat: opt-in exact-match LLM response cache (stage 1/5)#404
zhongxuanwang-nv wants to merge 3 commits into
NVIDIA:mainfrom
zhongxuanwang-nv:feat/response-cache-stage1

Conversation

@zhongxuanwang-nv

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

Copy link
Copy Markdown
Member

Overview

First stage of a five-stage series (exact match → logical keys → tool-result cache → semantic → streaming semantic), each stage a single reviewable commit with a matching docs PR. This stage is fully standalone.

Adds an opt-in, exact-match response cache for managed LLM calls as a response_cache section of the adaptive plugin config (no new plugin kind, no call-site changes). Repeated identical calls are served from an in-memory or Redis store instead of re-running the provider — instant repeats in dev loops and evals, and reproducible runs via the bypass_rate trust dial. Off by default; every cache error fails open to a live call.

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

Details

  • Keying (crates/adaptive/src/response_cache/key.rs): requests are keyed by a SHA-256 fingerprint of the RFC 8785-canonicalized, normalized request. The provider surface is auto-detected from the request shape (nothing to configure); the decode is trusted only where faithful — known-lossy shapes and decodes that fail a structural round-trip (tools, conversation, tool_choice, generation params) fall back to raw-body fingerprinting, which can only cost a miss, never a wrong reuse. Tool-call IDs are normalized; only allowlisted headers are keyed; namespace/provider/schema-version are folded in. Requests carrying integers beyond ±2^53 bypass (RFC 8785 serializes numbers as f64, so distinct IDs could share one key), as do Responses prompt-template references (server-side state); wrong-typed parallel_tool_calls/top_logprobs fall back to raw keying like the other guarded scalars.
  • Storage rules (response_cache/intercept.rs): only complete, replayable answers are stored — non-null error bodies, non-final status, truncated streams (no protocol-terminal event), and lossily-collected aggregates (thinking blocks, refusal-only choices) are never cached. Stateful calls (Responses persist-by-default without store: false, conversation, container) and nondeterministic calls under cache_nondeterministic: false bypass entirely.
  • Streaming: a miss tees the live stream and stores the codec-assembled aggregate (buffered and streaming share one keyspace); a hit replays provider-native chunks with the SSE content type — gated by a round-trip fidelity check, so a stored body whose chunk replay would lose content (e.g. a buffered-stored refusal-only answer) runs live instead of replaying degraded.
  • Store (response_cache/store.rs): in-memory backend bounded by an honest resident-size budget with oldest-first eviction; Redis backend (feature-gated) with hard per-op deadlines, native expiry plus an embedded-expiry re-check.
  • Gateway integration (crates/cli/src/gateway.rs): non-2xx / non-JSON upstream replies flow back as Err so nothing downstream can cache them, while the client still receives the upstream response verbatim. The verbatim relay is gated on the upstream exchange itself having failed, so a runtime rejection after a successful call (e.g. an execution intercept blocking a response) surfaces as the translated error rather than a passthrough of the blocked body. Short-circuited hits carry correct content types.
  • Config/validation: rejects zero/mistyped caps, answer-determining skip_keys, and auth headers in header_allowlist. Same typed config in Rust, Python, Node, and Go; nemo-relay doctor reports configuration and backend reachability.
  • Observability: response_cache hit/miss/bypass marks carry key fingerprints and savings, never bodies. Entries are stored unredacted (PII sanitize guardrails rewrite telemetry only), so shared Redis deployments must be trusted and namespaced — documented.

Validation run on this branch: cargo test -p nemo-relay-adaptive --lib --tests --features nemo-relay/openinference (all targets green, ~550 tests incl. integration + benchmark suites), gateway HTTP cache tests (server::tests::gateway_*, real mock upstream), cargo fmt --all --check, cargo clippy -- -D warnings on both crates. Python/Go surfaces are config mirrors validated by the shared Rust validator; their suites cover round-trip + validation parity. Known pre-existing sandbox failures (plugin-shim sidecar tests) are unrelated.

Where should the reviewer start?

  1. crates/adaptive/src/response_cache/key.rs — the key-derivation contract and the lossy-decode guards (the core correctness decisions: when to trust the normalized decode vs fall back to raw keying).
  2. crates/adaptive/tests/integration/response_cache_tests.rs — the behavioral contract as tests: exact repeats hit, guards force misses instead of wrong reuses, streams store only on terminal events.
  3. crates/cli/src/gateway.rs — the upstream-failure boundary (design decision: upstream failures relayed verbatim but invisible to the execution chain; post-success runtime rejections surface as errors).

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

Summary by CodeRabbit

  • New Features
    • Added opt-in exact-match LLM response caching for both buffered and streaming requests.
    • Supports in-memory and Redis backends, TTL, namespaces, bypass controls, and advanced cache key shaping.
    • Added typed configuration + editor schema support across Rust, Node.js, Go, and Python, including backend health checks and cache hit/miss observability.
  • Bug Fixes
    • Improved gateway replay behavior, upstream error handling, and streaming/non-streaming Content-Type handling for cached responses.
  • Tests
    • Added validation, end-to-end, streaming replay, backend sharing, and performance/benchmark coverage for response caching.

@github-actions github-actions Bot added size:XXL PR is very large Feature a new feature labels Jul 10, 2026
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Adds an opt-in exact-match LLM response cache with canonical keying, TTL-backed in-memory or Redis storage, buffered and streaming interception, provider-native replay, telemetry, configuration validation, gateway handling, and Rust, Go, Python, and Node APIs.

Changes

Response cache feature

Layer / File(s) Summary
Configuration and public contracts
crates/adaptive/src/config.rs, crates/adaptive/src/response_cache/*, crates/adaptive/src/lib.rs, crates/node/*, go/nemo_relay/*, python/nemo_relay/*, crates/adaptive/Cargo.toml
Adds response-cache configuration, backend specifications, editor metadata, public exports, language bindings, factory helpers, and integration-test targets.
Validation, storage, and runtime registration
crates/adaptive/src/plugin_component.rs, crates/adaptive/src/runtime/validation.rs, crates/adaptive/src/response_cache/store.rs, crates/adaptive/src/runtime/features.rs, crates/adaptive/src/redis.rs
Validates cache settings, implements bounded in-memory and optional Redis stores, exposes backend health checks, and registers shared buffered and streaming intercepts.
Keying, interception, and streaming replay
crates/adaptive/src/response_cache/key.rs, crates/adaptive/src/response_cache/intercept.rs, crates/adaptive/src/response_cache/replay.rs
Builds canonical SHA-256 keys with cacheability safeguards, handles buffered and streaming hits or misses, aggregates eligible streams, and replays supported provider-native chunk formats.
Savings, diagnostics, and gateway responses
crates/adaptive/src/response_cache/mark.rs, crates/cli/src/diagnostics/mod.rs, crates/cli/src/gateway/mod.rs, crates/cli/tests/coverage/shared/*
Reports cache decisions and savings, checks backend reachability, preserves captured upstream responses, serializes short-circuited JSON, and supplies gateway and doctor coverage.
Adaptive integration coverage
crates/adaptive/tests/integration/*, crates/adaptive/tests/unit/config_tests.rs, crates/adaptive/tests/unit/response_cache/*
Tests exact-match reuse, bypass rules, validation, telemetry, streaming replay exclusions, cross-mode reuse, Redis sharing, cache isolation, storage behavior, key safety, and latency behavior.
Cross-language configuration validation
go/nemo_relay/*, python/tests/test_adaptive_config.py
Tests typed configuration round trips, default factories, serialization, and invalid response-cache diagnostics across Go and Python surfaces.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

  • NVIDIA/NeMo-Relay#455: Both changes modify Redis connection-manager initialization in crates/adaptive/src/redis.rs.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Gateway
  participant ResponseCacheIntercept
  participant CacheStore
  participant Provider
  Client->>Gateway: submit LLM request
  Gateway->>ResponseCacheIntercept: execute buffered or streaming request
  ResponseCacheIntercept->>CacheStore: lookup canonical key
  alt cache hit
    CacheStore-->>ResponseCacheIntercept: cached response aggregate
    ResponseCacheIntercept-->>Gateway: return response or replay chunks
  else cache miss
    ResponseCacheIntercept->>Provider: execute upstream request
    Provider-->>ResponseCacheIntercept: response or stream
    ResponseCacheIntercept->>CacheStore: store eligible result
    ResponseCacheIntercept-->>Gateway: return live response or stream
  end
  Gateway-->>Client: response with appropriate content type
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title follows Conventional Commits and accurately summarizes the exact-match response cache feature.
Description check ✅ Passed The description matches the template with Overview, Details, reviewer start, checklist items, and a related issue entry.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@github-actions github-actions Bot added lang:go PR changes/introduces Go code lang:js PR changes/introduces Javascript/Typescript code lang:python PR changes/introduces Python code lang:rust PR changes/introduces Rust code labels Jul 10, 2026
@zhongxuanwang-nv zhongxuanwang-nv changed the title feat: opt-in exact-match LLM response cache feat: opt-in exact-match LLM response cache (stage 1/5) Jul 10, 2026
@github-actions

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown

License Diff

Compared against origin/main.

Lockfile license changes

Lockfile License Changes

Rust

Added

  • None

Removed

  • None

Updated/Changed

  • None

Node

Added

  • None

Removed

  • @openclaw/ai 2026.7.1 (MIT)
  • @opentelemetry/semantic-conventions 1.41.1 (Apache-2.0)

Updated/Changed

@agentclientprotocol/sdk

Before:

  • @agentclientprotocol/sdk 1.1.0 (Apache-2.0)

After:

  • @agentclientprotocol/sdk 0.22.1 (Apache-2.0)

@anthropic-ai/sdk

Before:

  • @anthropic-ai/sdk 0.109.1 (MIT)

After:

  • @anthropic-ai/sdk 0.100.1 (MIT)

@clack/core

Before:

  • @clack/core 1.4.2 (MIT)

After:

  • @clack/core 1.3.1 (MIT)

@clack/prompts

Before:

  • @clack/prompts 1.6.0 (MIT)

After:

  • @clack/prompts 1.4.0 (MIT)

@earendil-works/pi-tui

Before:

  • @earendil-works/pi-tui 0.80.3 (MIT)

After:

  • @earendil-works/pi-tui 0.78.0 (MIT)

@google/genai

Before:

  • @google/genai 2.10.0 (Apache-2.0)

After:

  • @google/genai 2.7.0 (Apache-2.0)

@grammyjs/types

Before:

  • @grammyjs/types 3.28.0 (MIT)

After:

  • @grammyjs/types 3.27.3 (MIT)

@mistralai/mistralai

Before:

  • @mistralai/mistralai 2.4.0 (Apache-2.0)

After:

  • @mistralai/mistralai 2.2.5 (Apache-2.0)

@openclaw/fs-safe

Before:

  • @openclaw/fs-safe 0.4.1 (MIT)

After:

  • @openclaw/fs-safe 0.3.0 (MIT)

@types/node

Before:

  • @types/node 24.12.4 (MIT)
  • @types/node 26.1.0 (MIT)

After:

  • @types/node 24.12.4 (MIT)
  • @types/node 25.9.1 (MIT)

bn.js

Before:

  • bn.js 4.12.4 (MIT)

After:

  • bn.js 4.12.3 (MIT)

body-parser

Before:

  • body-parser 2.3.0 (MIT)

After:

  • body-parser 2.2.2 (MIT)

brace-expansion

Before:

  • brace-expansion 5.0.6 (MIT)
  • brace-expansion 5.0.7 (MIT)

After:

  • brace-expansion 5.0.6 (MIT)

commander

Before:

  • commander 15.0.0 (MIT)

After:

  • commander 14.0.3 (MIT)

google-auth-library

Before:

  • google-auth-library 10.9.0 (Apache-2.0)

After:

  • google-auth-library 10.7.0 (Apache-2.0)

grammy

Before:

  • grammy 1.44.0 (MIT)

After:

  • grammy 1.43.0 (MIT)

linkify-it

Before:

  • linkify-it 5.0.2 (MIT)

After:

  • linkify-it 5.0.0 (MIT)

markdown-it

Before:

  • markdown-it 14.3.0 (MIT)

After:

  • markdown-it 14.1.1 (MIT)

marked

Before:

  • marked 18.0.5 (MIT)

After:

  • marked 15.0.12 (MIT)

node-addon-api

Before:

  • node-addon-api 8.9.0 (MIT)

After:

  • node-addon-api 8.8.0 (MIT)

openai

Before:

  • openai 6.45.0 (Apache-2.0)

After:

  • openai 6.39.1 (Apache-2.0)

openclaw

Before:

  • openclaw 2026.7.1 (MIT)

After:

  • openclaw 2026.6.10 (MIT)

playwright-core

Before:

  • playwright-core 1.61.1 (Apache-2.0)

After:

  • playwright-core 1.60.0 (Apache-2.0)

quickjs-wasi

Before:

  • quickjs-wasi 3.0.2 (MIT)

After:

  • quickjs-wasi 3.0.0 (MIT)

range-parser

Before:

  • range-parser 1.3.0 (MIT)

After:

  • range-parser 1.2.1 (MIT)

side-channel

Before:

  • side-channel 1.1.1 (MIT)

After:

  • side-channel 1.1.0 (MIT)

tar

Before:

  • tar 7.5.19 (BlueOak-1.0.0)

After:

  • tar 7.5.16 (BlueOak-1.0.0)

typebox

Before:

  • typebox 1.3.3 (MIT)

After:

  • typebox 1.1.39 (MIT)

undici-types

Before:

  • undici-types 7.16.0 (MIT)
  • undici-types 8.3.0 (MIT)

After:

  • undici-types 7.16.0 (MIT)
  • undici-types 7.24.6 (MIT)

web-tree-sitter

Before:

  • web-tree-sitter 0.26.10 (MIT)

After:

  • web-tree-sitter 0.26.9 (MIT)

yargs

Before:

  • yargs 15.4.1 (MIT)
  • yargs 17.7.2 (MIT)
  • yargs 17.7.3 (MIT)

After:

  • yargs 15.4.1 (MIT)
  • yargs 17.7.2 (MIT)

Python

Added

  • None

Removed

  • None

Updated/Changed

deepagents

Before:

  • deepagents 0.6.12 (MIT)

After:

  • deepagents 0.5.9 (MIT)

langchain

Before:

  • langchain 1.3.14 (MIT)

After:

  • langchain 1.3.11 (MIT)

langchain-core

Before:

  • langchain-core 1.4.9 (MIT)

After:

  • langchain-core 1.4.8 (MIT)

langchain-google-genai

Before:

  • langchain-google-genai 4.2.7 (MIT)

After:

  • langchain-google-genai 4.2.2 (MIT)

langgraph

Before:

  • langgraph 1.2.9 (MIT)

After:

  • langgraph 1.2.7 (MIT)

soupsieve

Before:

  • soupsieve 2.8.4 (MIT)

After:

  • soupsieve 2.8.3 (MIT)

uv

Before:

  • uv 0.11.29 (MIT OR Apache-2.0)

After:

  • uv 0.10.12 (MIT OR Apache-2.0)
Status output
[license-diff] selected languages: rust, node, python
[license-diff] generating current inventory
[license-diff] current: generating Rust inventory
[license-diff] current: Rust inventory complete (426 packages)
[license-diff] current: generating Node inventory
[license-diff] current: Node inventory complete (363 packages)
[license-diff] current: generating Python inventory
[license-diff] current: Python inventory complete (105 packages)
[license-diff] current inventory complete
[license-diff] checking out base ref origin/main into a temporary worktree
[license-diff] base: generating Rust inventory
[license-diff] base: Rust inventory complete (426 packages)
[license-diff] base: generating Node inventory
[license-diff] base: Node inventory complete (367 packages)
[license-diff] base: generating Python inventory
[license-diff] base: Python inventory complete (105 packages)
[license-diff] base inventory complete
[license-diff] removing temporary base worktree
[license-diff] comparing inventories
[license-diff] rendering Markdown output
[license-diff] done

@zhongxuanwang-nv
zhongxuanwang-nv force-pushed the feat/response-cache-stage1 branch from 4b575ad to 22b5fdb Compare July 10, 2026 23:57
@zhongxuanwang-nv
zhongxuanwang-nv force-pushed the feat/response-cache-stage1 branch from 22b5fdb to 17520f9 Compare July 11, 2026 00:55
@zhongxuanwang-nv
zhongxuanwang-nv force-pushed the feat/response-cache-stage1 branch from 17520f9 to 043afc6 Compare July 11, 2026 01:09
@zhongxuanwang-nv
zhongxuanwang-nv force-pushed the feat/response-cache-stage1 branch from 043afc6 to b149846 Compare July 13, 2026 15:47
@zhongxuanwang-nv zhongxuanwang-nv self-assigned this Jul 13, 2026
@zhongxuanwang-nv
zhongxuanwang-nv force-pushed the feat/response-cache-stage1 branch from b149846 to 7253a68 Compare July 13, 2026 23:57
@zhongxuanwang-nv
zhongxuanwang-nv force-pushed the feat/response-cache-stage1 branch from 7253a68 to 4363be4 Compare July 14, 2026 01:21
@zhongxuanwang-nv
zhongxuanwang-nv force-pushed the feat/response-cache-stage1 branch from 4363be4 to 83db5c1 Compare July 14, 2026 04:57
An opt-in feature of the adaptive plugin (a response_cache config
section, not a new plugin kind): managed LLM calls are keyed by a
SHA-256 fingerprint of the normalized request and repeats are served
from the store — instant, free, reproducible. Buffered and streaming
calls share one keyspace; a streamed miss is teed and stored as its
aggregated response, a hit replays provider-native chunks.

Keying auto-detects the provider surface from the request shape and
trusts the decode only where it is faithful: known-lossy shapes and
decodes that fail to round-trip fall back to raw-body fingerprinting,
which can only cost a miss. Stateful calls (Responses persistence,
conversations, containers) and nondeterministic calls under the safety
toggle bypass entirely. Stored answers must be complete: non-null
errors, non-final statuses, truncated or lossily-collected streams, and
upstream failures are never cached — the CLI gateway relays failed
upstream replies to the client verbatim while keeping them invisible to
the execution chain.

The in-memory store is bounded by an honest resident-size budget with
oldest-first eviction; the Redis backend runs under hard deadlines and
re-checks entry expiry. Everything fails open: any cache error falls
through to a live call. Same config surface in Rust, Python, Node, and
Go; doctor reports configuration and backend reachability; hit/miss/
bypass marks carry fingerprints and savings, never bodies.

Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
@zhongxuanwang-nv zhongxuanwang-nv added the DO NOT MERGE PR should not be merged; see PR for details label Jul 16, 2026
@zhongxuanwang-nv
zhongxuanwang-nv marked this pull request as ready for review July 16, 2026 21:07
@zhongxuanwang-nv
zhongxuanwang-nv requested a review from a team as a code owner July 16, 2026 21:07

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 9

🤖 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/plugin_component.rs`:
- Around line 337-355: Update validate_response_cache_backend_config_fields (or
its validate_response_cache caller) to validate Redis backend values for type,
requiring both url and key_prefix to be strings when provided. Report invalid
types through the existing ConfigDiagnostic validation path, preventing
build_redis_store from falling back to the shared prefix for mistyped key_prefix
values while preserving the canonical adaptive schema behavior.

In `@crates/adaptive/src/response_cache/intercept.rs`:
- Around line 269-291: Update the response-cache completion logic around the
collector loop and the aggregate cache condition to track each observed chat
choice index and whether that choice has reached a finish reason, requiring
every seen choice to terminate before caching. Replace the existing any-choice
completion behavior with an all-seen-choices check, while preserving
single-choice and non-chat stream behavior. Add a test covering a multi-choice
stream where one choice is truncated and verifying the aggregate is not cached.

In `@crates/adaptive/src/response_cache/key.rs`:
- Around line 424-989: Move the response-cache test modules out of source files
into the crate integration-test tree: relocate the tests under
crates/adaptive/src/response_cache/key.rs lines 424-989, replay.rs lines
264-368, and mark.rs lines 213-293 into crates/adaptive/tests/, preserving their
existing coverage and adapting imports or visibility as needed; remove the
in-source test modules after relocation.

In `@crates/adaptive/src/response_cache/replay.rs`:
- Around line 28-50: Update replay_is_lossy so an unrecognized response surface
is treated as lossy rather than returning false. Change the
detect_response_surface miss path to return true, forcing streaming replay to
use the provider instead of emitting a single aggregate frame; preserve the
existing codec comparison logic for recognized surfaces.

In `@crates/adaptive/src/runtime/validation.rs`:
- Around line 194-203: Update runtime validation and shared Redis cache setup
around config.namespace so an empty namespace cannot enable cross-tenant
response reuse by default. Report it as an error or require an explicit
unsafe-sharing opt-in, and ensure cache scope includes tenant isolation and root
UUID isolation rather than relying only on authentication-excluded request keys.
Preserve namespaced cache behavior for valid configurations.
- Around line 181-193: Update the Redis URL validation condition in the backend
configuration check to treat URLs containing only whitespace as missing:
retrieve the string from backend.config.url, trim it, and reject it when the
trimmed value is empty. Preserve acceptance of non-empty URLs and the existing
response_cache_error diagnostic.

In `@crates/adaptive/tests/integration/response_cache_benchmark_tests.rs`:
- Around line 201-205: Update the repeat and bypass benchmark assertions to
enforce a complete cache-status partition: assert hits + misses + bypasses
equals total_requests, and assert the status excluded by each scenario is zero.
Apply this in both assertion blocks so duplicate or missing lifecycle statuses
cannot pass.

In `@crates/adaptive/tests/integration/response_cache_tests.rs`:
- Around line 212-238: The integration tests need coverage for configured
nondeterministic request bypasses. Add a test alongside
stateful_responses_calls_bypass_the_cache that activates ResponseCacheConfig
with cache_nondeterministic disabled, repeats a request using a nonzero
temperature or top_p, and verifies the provider call counter is 2 and both cache
lifecycle results are marked bypass.
- Around line 1032-1074: Strengthen cache_coexists_with_acg_execution_intercept
by observing an ACG lifecycle event or request transformation during the first
cache miss, then assert the second request is served by the outer cache without
invoking the inner ACG intercept again. Keep the existing provider-count
assertion, and verify middleware ordering through the captured ACG behavior
rather than relying only on response caching.
🪄 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: cfe4d74d-7700-4f8e-a185-1442a614e9d1

📥 Commits

Reviewing files that changed from the base of the PR and between 45b3b44 and 96df1d9.

📒 Files selected for processing (31)
  • crates/adaptive/Cargo.toml
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/redis.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/cli/src/doctor.rs
  • crates/cli/src/gateway.rs
  • crates/cli/tests/coverage/doctor_tests.rs
  • crates/cli/tests/coverage/gateway_tests.rs
  • crates/cli/tests/coverage/server_tests.rs
  • crates/node/adaptive.d.ts
  • crates/node/adaptive.js
  • go/nemo_relay/adaptive.go
  • go/nemo_relay/adaptive/adaptive.go
  • go/nemo_relay/adaptive_runtime_test.go
  • python/nemo_relay/adaptive.py
  • python/nemo_relay/adaptive.pyi
  • python/tests/test_adaptive_config.py
📜 Review details
🧰 Additional context used
📓 Path-based instructions (32)
**/*.rs

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

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

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

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

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

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

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

Files:

  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/redis.rs
  • crates/cli/tests/coverage/gateway_tests.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/cli/tests/coverage/doctor_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/cli/tests/coverage/server_tests.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/cli/src/doctor.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/cli/src/gateway.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
{crates/core,crates/adaptive}/**/*

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

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

Files:

  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/redis.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/Cargo.toml
  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/redis.rs
  • crates/cli/tests/coverage/gateway_tests.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/cli/tests/coverage/doctor_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/tests/integration/response_cache_common.rs
  • python/nemo_relay/adaptive.py
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • python/tests/test_adaptive_config.py
  • crates/adaptive/src/response_cache/replay.rs
  • crates/cli/tests/coverage/server_tests.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/cli/src/doctor.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/cli/src/gateway.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/redis.rs
  • crates/cli/tests/coverage/gateway_tests.rs
  • crates/node/adaptive.js
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/cli/tests/coverage/doctor_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/node/adaptive.d.ts
  • python/nemo_relay/adaptive.py
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • python/tests/test_adaptive_config.py
  • crates/adaptive/src/response_cache/replay.rs
  • crates/cli/tests/coverage/server_tests.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/cli/src/doctor.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/cli/src/gateway.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
**/*.{rs,py,go,js,ts,c,h}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

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

Files:

  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/redis.rs
  • crates/cli/tests/coverage/gateway_tests.rs
  • crates/node/adaptive.js
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/features.rs
  • go/nemo_relay/adaptive/adaptive.go
  • crates/cli/tests/coverage/doctor_tests.rs
  • crates/adaptive/src/lib.rs
  • go/nemo_relay/adaptive.go
  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/node/adaptive.d.ts
  • python/nemo_relay/adaptive.py
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • go/nemo_relay/adaptive_runtime_test.go
  • python/tests/test_adaptive_config.py
  • crates/adaptive/src/response_cache/replay.rs
  • crates/cli/tests/coverage/server_tests.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/cli/src/doctor.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/cli/src/gateway.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/integration/response_cache_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/adaptive/src/response_cache/mod.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/redis.rs
  • crates/cli/tests/coverage/gateway_tests.rs
  • crates/node/adaptive.js
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/features.rs
  • go/nemo_relay/adaptive/adaptive.go
  • crates/cli/tests/coverage/doctor_tests.rs
  • crates/adaptive/src/lib.rs
  • go/nemo_relay/adaptive.go
  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/node/adaptive.d.ts
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • go/nemo_relay/adaptive_runtime_test.go
  • crates/adaptive/src/response_cache/replay.rs
  • crates/cli/tests/coverage/server_tests.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/cli/src/doctor.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/cli/src/gateway.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
{crates/**/src/**/*.rs,python/**/*.py}

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

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

Files:

  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/redis.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/src/lib.rs
  • python/nemo_relay/adaptive.py
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • python/tests/test_adaptive_config.py
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/cli/src/doctor.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/cli/src/gateway.rs
  • crates/adaptive/src/response_cache/key.rs
crates/adaptive/**

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

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

Files:

  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/redis.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/Cargo.toml
  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
**/*

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

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

Files:

  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/redis.rs
  • crates/cli/tests/coverage/gateway_tests.rs
  • crates/node/adaptive.js
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/features.rs
  • go/nemo_relay/adaptive/adaptive.go
  • python/nemo_relay/adaptive.pyi
  • crates/cli/tests/coverage/doctor_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/Cargo.toml
  • go/nemo_relay/adaptive.go
  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/node/adaptive.d.ts
  • python/nemo_relay/adaptive.py
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • go/nemo_relay/adaptive_runtime_test.go
  • python/tests/test_adaptive_config.py
  • crates/adaptive/src/response_cache/replay.rs
  • crates/cli/tests/coverage/server_tests.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/cli/src/doctor.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/cli/src/gateway.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
crates/{core,adaptive}/**/*

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

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

Files:

  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/redis.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/Cargo.toml
  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/integration/response_cache_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.

Files:

  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/redis.rs
  • crates/cli/tests/coverage/gateway_tests.rs
  • crates/node/adaptive.js
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/features.rs
  • go/nemo_relay/adaptive/adaptive.go
  • crates/cli/tests/coverage/doctor_tests.rs
  • crates/adaptive/src/lib.rs
  • go/nemo_relay/adaptive.go
  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/node/adaptive.d.ts
  • python/nemo_relay/adaptive.py
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • go/nemo_relay/adaptive_runtime_test.go
  • python/tests/test_adaptive_config.py
  • crates/adaptive/src/response_cache/replay.rs
  • crates/cli/tests/coverage/server_tests.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/cli/src/doctor.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/cli/src/gateway.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/integration/response_cache_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/response_cache/mod.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/redis.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}

⚙️ CodeRabbit configuration file

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

Files:

  • crates/cli/tests/coverage/gateway_tests.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/cli/tests/coverage/doctor_tests.rs
  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • go/nemo_relay/adaptive_runtime_test.go
  • python/tests/test_adaptive_config.py
  • crates/cli/tests/coverage/server_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
crates/node/**/*.{js,ts,jsx,tsx,json}

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

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

Files:

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

📄 CodeRabbit inference engine (AGENTS.md)

Use camelCase for Node.js public APIs.

Files:

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

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

Keep Python, Go, and Node.js config objects and subscriber/exporter methods aligned so all bindings expose the same logical knobs and semantics.

Files:

  • crates/node/adaptive.js
  • go/nemo_relay/adaptive/adaptive.go
  • go/nemo_relay/adaptive.go
  • crates/node/adaptive.d.ts
  • python/nemo_relay/adaptive.py
  • go/nemo_relay/adaptive_runtime_test.go
  • python/tests/test_adaptive_config.py
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/adaptive.js
  • crates/node/adaptive.d.ts
go/nemo_relay/**/*.go

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

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

Use PascalCase for public Go APIs.

Files:

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

📄 CodeRabbit inference engine (CONTRIBUTING.md)

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

Files:

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

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

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

Files:

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

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

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

Files:

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

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

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

Files:

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

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

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

Files:

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

⚙️ CodeRabbit configuration file

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

Files:

  • go/nemo_relay/adaptive/adaptive.go
  • go/nemo_relay/adaptive.go
  • go/nemo_relay/adaptive_runtime_test.go
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.pyi
  • python/nemo_relay/adaptive.py
**/Cargo.toml

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

Confirm or infer the target release version from upstream/main:Cargo.toml. Derive the release branch as release/<major>.<minor>.

Keep Rust package names and workspace metadata in Cargo.toml internally consistent across the project.

Files:

  • crates/adaptive/Cargo.toml
**/*.toml

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add the SPDX license header to all TOML files using the # comment form.

Files:

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

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

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

Files:

  • crates/node/adaptive.d.ts
python/nemo_relay/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

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

📄 CodeRabbit inference engine (CONTRIBUTING.md)

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

Files:

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

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

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

Files:

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

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

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

Files:

  • python/tests/test_adaptive_config.py
🧠 Learnings (1)
📚 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 (34)
go/nemo_relay/adaptive_runtime_test.go (1)

172-237: LGTM!

python/tests/test_adaptive_config.py (1)

18-18: LGTM!

Also applies to: 160-199

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

1-423: LGTM!

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

1-268: LGTM!

Also applies to: 292-338, 353-456

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

1-27: LGTM!

Also applies to: 51-263

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

1-212: LGTM!

crates/cli/src/gateway.rs (1)

283-292: LGTM!

Also applies to: 322-374, 388-388, 405-413, 455-478, 563-575

crates/cli/tests/coverage/gateway_tests.rs (1)

455-464: LGTM!

crates/cli/tests/coverage/server_tests.rs (1)

18-19: LGTM!

Also applies to: 100-106, 2692-3008

crates/adaptive/Cargo.toml (1)

25-25: LGTM!

Also applies to: 37-37, 50-57

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

55-67: LGTM!

Also applies to: 77-77, 261-274

crates/node/adaptive.js (1)

150-178: LGTM!

Also applies to: 237-237

go/nemo_relay/adaptive.go (1)

20-20: LGTM!

Also applies to: 70-112, 185-216

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

55-60: LGTM!

Also applies to: 122-136

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

7-10: LGTM!

Also applies to: 86-180, 204-236

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

34-50: LGTM!

Also applies to: 75-75

crates/cli/src/doctor.rs (1)

21-22: LGTM!

Also applies to: 705-711, 742-821

crates/cli/tests/coverage/doctor_tests.rs (1)

1005-1040: LGTM!

Also applies to: 1042-1067, 1069-1103

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

10-11: LGTM!

Also applies to: 37-40, 56-56, 194-242, 313-319, 392-410

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

33-34: LGTM!

Also applies to: 46-47, 56-56

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

1-56: LGTM!

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

1-27: LGTM!

python/nemo_relay/adaptive.py (1)

254-301: LGTM!

Also applies to: 314-314, 329-342, 439-439

python/nemo_relay/adaptive.pyi (1)

184-216: LGTM!

Also applies to: 229-240

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

185-185: LGTM!

Also applies to: 288-332

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

1-683: LGTM!

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

37-45: LGTM!

Also applies to: 477-482, 777-819

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

1-200: LGTM!


206-268: LGTM!

Also applies to: 273-367

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

1-58: LGTM!

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

1-211: LGTM!


239-1031: LGTM!


1075-1134: LGTM!

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

93-93: LGTM!

Also applies to: 122-136

Comment thread crates/adaptive/src/plugin_component.rs
Comment thread crates/adaptive/src/response_cache/intercept.rs Outdated
Comment thread crates/adaptive/src/response_cache/key.rs Outdated
Comment thread crates/adaptive/src/response_cache/replay.rs
Comment thread crates/adaptive/src/runtime/validation.rs
Comment thread crates/adaptive/src/runtime/validation.rs
Comment thread crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
Comment thread crates/adaptive/tests/integration/response_cache_tests.rs
Comment thread crates/adaptive/tests/integration/response_cache_tests.rs
…-stage1

Resolve conflicts with the upstream module splits and config changes:
- crates/adaptive/src/redis.rs: keep the shared connect() helper and move
  the upstream plugin-resource logging into it so both RedisBackend and
  the response-cache store emit the operational logging events.
- crates/cli/src/diagnostics/mod.rs (was doctor.rs): keep only the
  imports the merged module still uses.
- crates/cli/src/gateway/mod.rs (was gateway.rs): adopt the upstream
  session_finish flag while preserving the intercept short-circuit body
  handling and upstream-failure relay.
- Switch response-cache integration tests to initialize_plugins_exact so
  ambient plugins.toml discovery cannot leak into the asserted config
  (observability config v2 now rejects legacy ATOF fields as errors).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

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

⚠️ Outside diff range comments (3)
crates/adaptive/src/config.rs (1)

221-232: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Disable nondeterministic caching by default.

cache_nondeterministic: true makes an otherwise default response-cache configuration replay stochastic provider output. This conflicts with the stated bypass rule for nondeterministic calls and can return stale responses for later equivalent requests. Default this to false; callers can explicitly opt in.

Proposed fix
-            cache_nondeterministic: true,
+            cache_nondeterministic: false,
🤖 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/config.rs` around lines 221 - 232, Update the Default
implementation for the configuration so cache_nondeterministic is false instead
of true. Keep the existing explicit opt-in behavior available through the
configuration field and leave all other default values unchanged.
crates/adaptive/src/runtime/features.rs (1)

488-490: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Fail open when optional cache-store initialization fails.

ResponseCacheFeature::register propagates build_store(...).await?, and register_feature then rolls back the runtime. An unavailable Redis cache therefore prevents live provider calls entirely, contradicting the fail-open cache contract. Downgrade AdaptiveError::Storage from cache-store construction to a warning and skip cache interceptor registration; continue propagating invalid configuration errors.

🤖 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/runtime/features.rs` around lines 488 - 490, The
response-cache setup around ResponseCacheFeature::register and register_feature
must fail open when cache-store construction returns AdaptiveError::Storage: log
a warning, skip registering the cache interceptor, and allow live provider calls
to continue. Preserve propagation of invalid configuration errors and do not
roll back the runtime for storage initialization failures.
crates/adaptive/tests/integration/response_cache_benchmark_tests.rs (1)

300-317: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assert that each run produces the expected five hits.

Equality alone passes when both runs return zero because caching never activated.

Proposed fix
     let first_run = run_once("bench_determinism_a").await;
     let second_run = run_once("bench_determinism_b").await;

+    assert_eq!(first_run, 5, "the first workload must cache all five repeats");
+    assert_eq!(second_run, 5, "the fresh cache must cache all five repeats");
     assert_eq!(
         first_run, second_run,

As per path instructions, “Tests should cover the behavior promised by the changed API surface.”

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

In `@crates/adaptive/tests/integration/response_cache_benchmark_tests.rs` around
lines 300 - 317, Update the determinism test around run_once so each invocation
asserts that its hits count equals the expected five hits, in addition to
retaining the comparison between first_run and second_run. This must fail when
caching is inactive and still verify that results do not leak across plugin
re-initialization.

Source: Path instructions

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

Outside diff comments:
In `@crates/adaptive/src/config.rs`:
- Around line 221-232: Update the Default implementation for the configuration
so cache_nondeterministic is false instead of true. Keep the existing explicit
opt-in behavior available through the configuration field and leave all other
default values unchanged.

In `@crates/adaptive/src/runtime/features.rs`:
- Around line 488-490: The response-cache setup around
ResponseCacheFeature::register and register_feature must fail open when
cache-store construction returns AdaptiveError::Storage: log a warning, skip
registering the cache interceptor, and allow live provider calls to continue.
Preserve propagation of invalid configuration errors and do not roll back the
runtime for storage initialization failures.

In `@crates/adaptive/tests/integration/response_cache_benchmark_tests.rs`:
- Around line 300-317: Update the determinism test around run_once so each
invocation asserts that its hits count equals the expected five hits, in
addition to retaining the comparison between first_run and second_run. This must
fail when caching is inactive and still verify that results do not leak across
plugin re-initialization.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 98963021-fc91-4a67-99e0-d4ee10c28aaa

📥 Commits

Reviewing files that changed from the base of the PR and between 96df1d9 and 3b2f565.

📒 Files selected for processing (13)
  • crates/adaptive/Cargo.toml
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/redis.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/cli/src/gateway/mod.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/cli/tests/coverage/shared/gateway_tests.rs
  • crates/cli/tests/coverage/shared/server_tests.rs
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: Check / Run
  • GitHub Check: Preview docs
🧰 Additional context used
📓 Path-based instructions (16)
**/*.rs

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

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

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

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

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

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

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

Files:

  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/cli/tests/coverage/shared/gateway_tests.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/src/config.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/adaptive/src/redis.rs
  • crates/cli/tests/coverage/shared/server_tests.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/cli/src/gateway/mod.rs
{crates/core,crates/adaptive}/**/*

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

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

Files:

  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/Cargo.toml
  • crates/adaptive/src/redis.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/cli/tests/coverage/shared/gateway_tests.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/src/config.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/adaptive/src/redis.rs
  • crates/cli/tests/coverage/shared/server_tests.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/cli/src/gateway/mod.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/cli/tests/coverage/shared/gateway_tests.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/src/config.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/adaptive/src/redis.rs
  • crates/cli/tests/coverage/shared/server_tests.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/cli/src/gateway/mod.rs
**/*.{rs,py,go,js,ts,c,h}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

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

Files:

  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/cli/tests/coverage/shared/gateway_tests.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/src/config.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/adaptive/src/redis.rs
  • crates/cli/tests/coverage/shared/server_tests.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/cli/src/gateway/mod.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/integration/response_cache_common.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/cli/tests/coverage/shared/gateway_tests.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/src/config.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/adaptive/src/redis.rs
  • crates/cli/tests/coverage/shared/server_tests.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/cli/src/gateway/mod.rs
crates/adaptive/**

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

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

Files:

  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/Cargo.toml
  • crates/adaptive/src/redis.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
**/*

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

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

Files:

  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/cli/tests/coverage/shared/gateway_tests.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/src/config.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/adaptive/Cargo.toml
  • crates/adaptive/src/redis.rs
  • crates/cli/tests/coverage/shared/server_tests.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/cli/src/gateway/mod.rs
crates/{core,adaptive}/**/*

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

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

Files:

  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/Cargo.toml
  • crates/adaptive/src/redis.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_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.

Files:

  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/cli/tests/coverage/shared/gateway_tests.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/src/config.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/adaptive/src/redis.rs
  • crates/cli/tests/coverage/shared/server_tests.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/cli/src/gateway/mod.rs
**/*.{rs,py,js,ts,tsx,go,java,kt,swift}

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

**/*.{rs,py,js,ts,tsx,go,java,kt,swift}: Expose the new middleware surface with parity in every affected language binding.
Add focused tests covering registration and duplicate names, deregistration and missing names, priority ordering, callback error propagation, scope-local inheritance and cleanup, event input/output semantics, and binding parity.

Files:

  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/cli/tests/coverage/shared/gateway_tests.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/src/config.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/adaptive/src/redis.rs
  • crates/cli/tests/coverage/shared/server_tests.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/cli/src/gateway/mod.rs
crates/{core,adaptive}/**/*.rs

⚙️ CodeRabbit configuration file

crates/{core,adaptive}/**/*.rs: Review the Rust runtime for async correctness, scope isolation, middleware ordering, and event lifecycle regressions.
Pay close attention to task-local/thread-local scope propagation, callback lifetimes, stream finalization, and root_uuid isolation.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.

Files:

  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/redis.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}

⚙️ CodeRabbit configuration file

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

Files:

  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/cli/tests/coverage/shared/gateway_tests.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/cli/tests/coverage/shared/server_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
{crates/**/src/**/*.rs,python/**/*.py}

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

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

Files:

  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/redis.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/cli/src/gateway/mod.rs
**/Cargo.toml

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

Confirm or infer the target release version from upstream/main:Cargo.toml. Derive the release branch as release/<major>.<minor>.

Keep Rust package names and workspace metadata in Cargo.toml internally consistent across the project.

Files:

  • crates/adaptive/Cargo.toml
**/*.toml

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add the SPDX license header to all TOML files using the # comment form.

Files:

  • crates/adaptive/Cargo.toml
🔇 Additional comments (11)
crates/adaptive/src/config.rs (1)

40-40: 📐 Maintainability & Code Quality

Verify the required validation matrix.

No validation output is provided for these Rust and crates/adaptive changes. Please run cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings, just test-rust, and the repository’s Rust/Python/Go/Node matrix before handoff. As per coding guidelines, “If crates/core or crates/adaptive changed, run the full validation matrix across Rust, Python, Go, and Node.js.”

Source: Coding guidelines

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

212-238: Configured nondeterministic bypass coverage is still missing.

This was already flagged in the previous review.


1033-1074: The test still does not prove that the ACG intercept executes or that middleware ordering is correct.

This was already flagged in the previous review.


123-210: LGTM!

Also applies to: 240-273

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

30-31: LGTM!

Also applies to: 532-538, 569-570

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

180-187: LGTM!

Also applies to: 219-242, 251-277, 291-291, 310-318, 360-383, 472-484

crates/cli/tests/coverage/shared/doctor_tests.rs (1)

1050-1084: LGTM!

Also applies to: 1086-1111, 1113-1147

crates/cli/tests/coverage/shared/gateway_tests.rs (1)

15-15: LGTM!

Also applies to: 911-920

crates/cli/tests/coverage/shared/server_tests.rs (1)

18-19: LGTM!

Also applies to: 101-107, 3168-3223, 3225-3289, 3291-3350, 3352-3416, 3418-3483

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

34-44: LGTM!


34-39: 📐 Maintainability & Code Quality

Confirm the mandatory Rust and cross-language validation completed.

Please verify cargo fmt --all, strict workspace Clippy, just test-rust, the full Rust/Python/Go/Node matrix, and the final all-files pre-commit pass.

As per coding guidelines, “Changes to crates/core or crates/adaptive must run the full language matrix.”

Source: Coding guidelines

- Track per-choice completion in the streaming tee: a chat stream is
  terminal only when every choice that appeared carries a finish_reason,
  so a clean close after only some choices finished is a truncation and
  is never cached.
- Treat an unrecognized aggregate shape as lossy for the streaming hit
  tier: with no native chunk synthesis, the tier runs live instead of
  serving one aggregate-shaped frame; buffered hits are unaffected.
- Reject a wrong-typed redis key_prefix (it silently fell back to the
  shared default prefix) and treat a blank redis url as missing.
- Assert the hit/miss/bypass partition exhaustively in the benchmark
  accounting tests.
- Move the response-cache unit tests out of the src tree into
  tests/unit/response_cache/, matching the crate's #[path]-included
  test file convention.

Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

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

Inline comments:
In `@crates/adaptive/src/response_cache/store.rs`:
- Around line 500-501: Before handoff, validate the response_cache store test
integration around the tests module by running cargo fmt --all, cargo clippy
--workspace --all-targets -- -D warnings, just test-rust, the complete
Rust/Python/Go/Node test matrix, and uv run pre-commit run --all-files; resolve
any failures before completing the change.
🪄 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: 57ce3305-e947-4d3d-9462-b12f292c63c9

📥 Commits

Reviewing files that changed from the base of the PR and between 3b2f565 and 813e711.

📒 Files selected for processing (12)
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: Check / Run
  • GitHub Check: Preview docs
🧰 Additional context used
📓 Path-based instructions (14)
**/*.rs

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

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

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

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

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

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

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

Files:

  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/response_cache/store.rs
{crates/core,crates/adaptive}/**/*

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

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

Files:

  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/response_cache/store.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/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/response_cache/store.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/response_cache/store.rs
**/*.{rs,py,go,js,ts,c,h}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

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

Files:

  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/response_cache/store.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/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/response_cache/store.rs
crates/adaptive/**

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

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

Files:

  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/response_cache/store.rs
**/*

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

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

Files:

  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/response_cache/store.rs
crates/{core,adaptive}/**/*

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

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

Files:

  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/response_cache/store.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.

Files:

  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/response_cache/store.rs
**/*.{rs,py,js,ts,tsx,go,java,kt,swift}

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

**/*.{rs,py,js,ts,tsx,go,java,kt,swift}: Expose the new middleware surface with parity in every affected language binding.
Add focused tests covering registration and duplicate names, deregistration and missing names, priority ordering, callback error propagation, scope-local inheritance and cleanup, event input/output semantics, and binding parity.

Files:

  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/response_cache/store.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/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/response_cache/store.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/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
{crates/**/src/**/*.rs,python/**/*.py}

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

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

Files:

  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/src/response_cache/store.rs
🔇 Additional comments (16)
crates/adaptive/src/runtime/validation.rs (2)

7-10: LGTM!

Also applies to: 86-91, 99-159, 160-163, 167-193, 205-247


164-166: 🎯 Functional Correctness

Rust 1.86+ already supports Option::is_none_or, so this is fine.

			> Likely an incorrect or invalid review comment.
crates/adaptive/src/response_cache/store.rs (1)

478-483: 🗄️ Data Integrity & Integration

Check key_prefix handling in build_store. A present non-string backend.config.key_prefix should not fall back to nemo-relay:llm-cache:; if check_backend_health reaches this path directly, the default can hide malformed config and merge Redis keyspaces.

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

214-215: LGTM!

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

206-209: LGTM!

Also applies to: 277-278

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

921-935: LGTM!

Also applies to: 965-994

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

1-567: LGTM!

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

1-34: LGTM!

Also applies to: 53-83


35-52: 🩺 Stability & Availability

Scope the pricing-resolver override to this test. If the resolver is shared process-wide, wrap this setup/reset in the repo’s pricing test lock and an RAII guard so a panic can’t leak the override into later tests.

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

1-8: LGTM!

Also applies to: 24-110


9-23: 🎯 Functional Correctness

No change needed. system_fingerprint, service_tier, and logprobs are buffered-response metadata, not streamed chunk content, so leaving them out here does not make the replay lossy.

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

1-187: LGTM!

crates/adaptive/src/response_cache/intercept.rs (2)

19-19: LGTM!

Also applies to: 269-277, 290-299, 338-373


255-302: 📐 Maintainability & Code Quality

Run the required validation matrix before handoff.

Please run just test-rust, cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings, the full Rust/Python/Go/Node matrix, and uv run pre-commit run --all-files; no results are included in the review context.

As per coding guidelines, Rust changes in crates/adaptive require the full language matrix and pre-commit validation before review or handoff.

Source: Coding guidelines

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

425-426: LGTM!

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

19-21: LGTM!

Also applies to: 34-39, 267-268

Comment thread crates/adaptive/src/response_cache/store.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DO NOT MERGE PR should not be merged; see PR for details Feature a new feature lang:go PR changes/introduces Go code lang:js PR changes/introduces Javascript/Typescript code lang:python PR changes/introduces Python code lang:rust PR changes/introduces Rust code size:XXL PR is very large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant