Skip to content

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

Open
zhongxuanwang-nv wants to merge 6 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 6 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 buffered and streaming requests, including TTL, namespace/key strategy, bypass controls, request-key exclusions, and configurable in-memory/Redis backends.
    • Exposed configuration in Rust, Go, JavaScript/TypeScript, and Python SDKs, with editor/schema support.
    • Added structured cache hit/miss/bypass telemetry and backend reachability checks.
  • Bug Fixes
    • Improved gateway handling for cached/replayed responses, including consistent JSON/SSE content types and safer upstream failure replay behavior.
  • Tests
    • Added extensive unit, integration, coverage, and benchmark tests validating correctness, replay semantics, configuration validation, sharing across modes/stores, and performance.

@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

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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#485: Both changes handle malformed buffered upstream JSON through upstream-shaped gateway error behavior.
  • NVIDIA/NeMo-Relay#496: Both changes modify managed buffered gateway responses and runtime/upstream body handling.

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 uses valid Conventional Commits syntax and clearly summarizes the response-cache feature.
Description check ✅ Passed The description includes the required Overview, Details, reviewer-start, and related-issue sections with sufficient specificity.
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

github-actions Bot commented Jul 10, 2026

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

  • None

Updated/Changed

  • None

Python

Added

  • None

Removed

  • None

Updated/Changed

  • None
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 (367 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

@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: 2

🤖 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/intercept.rs`:
- Around line 62-90: Update poll_next to remove the inline CacheCommit state and
polling branch, and when TeeMessage::Commit is received, detach it with
tokio::spawn instead of storing it for stream completion. Keep natural upstream
closure returning Poll::Ready(None) immediately, while preserving the existing
early-close behavior that drops queued commit messages without spawning them.

In `@crates/adaptive/tests/integration/response_cache_tests.rs`:
- Around line 723-747: Move the close_calls assertion in
naturally_completed_stream_closes_upstream_before_cache_commit to immediately
after the first stream_call, confirming the upstream closes exactly once before
the second request can reuse the cache entry. Keep the calls assertion after the
second stream_call to verify only one upstream invocation occurred.
🪄 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: 0802cf7e-0164-49eb-9ff1-ae0967df93df

📥 Commits

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

📒 Files selected for processing (5)
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/cli/src/gateway/mod.rs
  • crates/cli/tests/coverage/shared/gateway_tests.rs
📜 Review details
🧰 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/cli/tests/coverage/shared/gateway_tests.rs
  • crates/cli/src/gateway/mod.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/intercept.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • crates/cli/tests/coverage/shared/gateway_tests.rs
  • crates/cli/src/gateway/mod.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/intercept.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/cli/tests/coverage/shared/gateway_tests.rs
  • crates/cli/src/gateway/mod.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/intercept.rs
**/*.{rs,py,go,js,ts,c,h}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

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

Files:

  • crates/cli/tests/coverage/shared/gateway_tests.rs
  • crates/cli/src/gateway/mod.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/intercept.rs
**/*.{rs,go,js,ts}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

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

Files:

  • crates/cli/tests/coverage/shared/gateway_tests.rs
  • crates/cli/src/gateway/mod.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/intercept.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/cli/tests/coverage/shared/gateway_tests.rs
  • crates/cli/src/gateway/mod.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/intercept.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/cli/tests/coverage/shared/gateway_tests.rs
  • crates/cli/src/gateway/mod.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/intercept.rs
**/*.{rs,py,js,ts,tsx,go,java,kt,swift}

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

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

Files:

  • crates/cli/tests/coverage/shared/gateway_tests.rs
  • crates/cli/src/gateway/mod.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/intercept.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/shared/gateway_tests.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
{crates/**/src/**/*.rs,python/**/*.py}

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

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

Files:

  • crates/cli/src/gateway/mod.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/src/response_cache/intercept.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/replay.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/intercept.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/replay.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/intercept.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/replay.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/intercept.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/replay.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/intercept.rs
🔇 Additional comments (11)
crates/adaptive/src/response_cache/intercept.rs (3)

7-58: LGTM!


92-119: LGTM! Drop and close() correctly cancel and drain without ever executing a queued commit, consistent with the "no cache on early close" invariant covered by the existing regression test.


340-419: LGTM! Upstream-error and cancellation paths correctly avoid caching, and live.close() is invoked exactly once on every exit path.

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

22-27: LGTM!

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

84-124: LGTM!


172-283: LGTM! The response-body reconstruction correctly special-cases the no-upstream-bytes (cache-hit/short-circuit) path by injecting Content-Type: application/json, and prefers the runtime response_json over stale captured bytes when they diverge.


288-395: LGTM! Per-attempt reset of upstream_failed and the retry-aware strict-JSON-parse early return keep the capture slots consistent with the exchange they describe, and structured FlowError::Upstream failures for retry-aware dispatch avoid needing the capture slots at all.


583-614: LGTM! Immediate error propagation on decode failure and switch to LlmJsonStream::new match the SSE decode test coverage.

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

877-914: LGTM! Good coverage of the new SSE decode-error propagation and the retry-aware invalid-JSON structured-failure path, including header/body/class assertions.

Also applies to: 975-1037

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

89-184: LGTM!


649-721: LGTM!

Comment on lines +62 to +90
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
if self.finished {
return Poll::Ready(None);
}

loop {
if let Some(commit) = self.commit.as_mut() {
match commit.as_mut().poll(cx) {
Poll::Ready(()) => {
self.commit = None;
self.finished = true;
return Poll::Ready(None);
}
Poll::Pending => return Poll::Pending,
}
}

match Pin::new(&mut self.receiver).poll_next(cx) {
Poll::Ready(Some(TeeMessage::Chunk(item))) => return Poll::Ready(Some(item)),
Poll::Ready(Some(TeeMessage::Commit(commit))) => self.commit = Some(commit),
Poll::Ready(None) => {
self.finished = true;
return Poll::Ready(None);
}
Poll::Pending => return Poll::Pending,
}
}
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🚀 Performance & Scalability | 🟠 Major | ⚡ Quick win

Cache-write latency now blocks the stream's terminal None.

poll_next polls the Commit future inline (Line 68-77) before it will return Poll::Ready(None), and tee_and_aggregate only enqueues that commit after upstream close (Line 421-432). This means any consumer that drains the stream naturally (the expected/common path) will have its final .next() call block on maybe_store completing — i.e., on the cache backend's write latency (network round-trip for the Redis-backed store). This couples perceived stream completion (SSE close, session-finish hooks, etc.) to cache-store health/latency, and a slow/unavailable store could stall stream finalization for the request lifetime of that store call.

Since close()/Drop already discard any buffered TeeMessage::Commit by dropping the raw channel contents (Line 102-104) without ever routing through poll_next's match arms, the "don't cache on early close" invariant doesn't actually depend on inline-polling the commit in poll_next. Detaching the write via tokio::spawn when the Commit message is naturally received preserves that invariant while removing the write from the consumer's critical path.

♻️ Proposed fix: spawn the commit instead of polling it inline
-            match Pin::new(&mut self.receiver).poll_next(cx) {
-                Poll::Ready(Some(TeeMessage::Chunk(item))) => return Poll::Ready(Some(item)),
-                Poll::Ready(Some(TeeMessage::Commit(commit))) => self.commit = Some(commit),
-                Poll::Ready(None) => {
-                    self.finished = true;
-                    return Poll::Ready(None);
-                }
-                Poll::Pending => return Poll::Pending,
-            }
+            match Pin::new(&mut self.receiver).poll_next(cx) {
+                Poll::Ready(Some(TeeMessage::Chunk(item))) => return Poll::Ready(Some(item)),
+                Poll::Ready(Some(TeeMessage::Commit(commit))) => {
+                    tokio::spawn(commit);
+                    self.finished = true;
+                    return Poll::Ready(None);
+                }
+                Poll::Ready(None) => {
+                    self.finished = true;
+                    return Poll::Ready(None);
+                }
+                Poll::Pending => return Poll::Pending,
+            }

(the commit: Option<CacheCommit> field and its poll branch at the top of the loop, Line 68-77, can then be dropped entirely.)

As per path instructions, "Pay close attention to ... stream finalization" for crates/{core,adaptive}/**/*.rs.

Also applies to: 421-432

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

In `@crates/adaptive/src/response_cache/intercept.rs` around lines 62 - 90, Update
poll_next to remove the inline CacheCommit state and polling branch, and when
TeeMessage::Commit is received, detach it with tokio::spawn instead of storing
it for stream completion. Keep natural upstream closure returning
Poll::Ready(None) immediately, while preserving the existing early-close
behavior that drops queued commit messages without spawning them.

Source: Path instructions

Comment on lines +723 to +747
#[tokio::test]
async fn naturally_completed_stream_closes_upstream_before_cache_commit() {
let _guard = TEST_MUTEX.lock().await;
reset_global();
activate_cache(ResponseCacheConfig::default()).await;

let calls = Arc::new(AtomicUsize::new(0));
let close_calls = Arc::new(AtomicUsize::new(0));
let provider = close_tracking_stream_provider(
Arc::clone(&calls),
Arc::clone(&close_calls),
openai_chat_stream_chunks(),
None,
);

stream_call(&provider, chat_request("natural completion")).await;
stream_call(&provider, chat_request("natural completion")).await;

assert_eq!(calls.load(Ordering::SeqCst), 1);
assert_eq!(
close_calls.load(Ordering::SeqCst),
1,
"the live upstream must be closed exactly once before the entry is reusable"
);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assertion placement doesn't actually pin the claimed ordering.

The test name/comment claims the upstream is "closed... before the cache entry becomes reusable," but close_calls and calls are only asserted after both stream_call invocations finish. This passes even if close happens after the cache write becomes visible — it doesn't establish precedence. Move the close_calls assertion right after the first stream_call (which fully drains to natural EOF), before issuing the second request.

As per path instructions, tests should "prefer assertions on lifecycle events... and binding parity over shallow smoke tests."

🧪 Proposed fix to pin the ordering claim
-    stream_call(&provider, chat_request("natural completion")).await;
-    stream_call(&provider, chat_request("natural completion")).await;
-
-    assert_eq!(calls.load(Ordering::SeqCst), 1);
-    assert_eq!(
-        close_calls.load(Ordering::SeqCst),
-        1,
-        "the live upstream must be closed exactly once before the entry is reusable"
-    );
+    stream_call(&provider, chat_request("natural completion")).await;
+    assert_eq!(
+        close_calls.load(Ordering::SeqCst),
+        1,
+        "upstream must already be closed once the consumer observes natural EOF"
+    );
+
+    stream_call(&provider, chat_request("natural completion")).await;
+    assert_eq!(calls.load(Ordering::SeqCst), 1);
+    assert_eq!(close_calls.load(Ordering::SeqCst), 1);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#[tokio::test]
async fn naturally_completed_stream_closes_upstream_before_cache_commit() {
let _guard = TEST_MUTEX.lock().await;
reset_global();
activate_cache(ResponseCacheConfig::default()).await;
let calls = Arc::new(AtomicUsize::new(0));
let close_calls = Arc::new(AtomicUsize::new(0));
let provider = close_tracking_stream_provider(
Arc::clone(&calls),
Arc::clone(&close_calls),
openai_chat_stream_chunks(),
None,
);
stream_call(&provider, chat_request("natural completion")).await;
stream_call(&provider, chat_request("natural completion")).await;
assert_eq!(calls.load(Ordering::SeqCst), 1);
assert_eq!(
close_calls.load(Ordering::SeqCst),
1,
"the live upstream must be closed exactly once before the entry is reusable"
);
}
#[tokio::test]
async fn naturally_completed_stream_closes_upstream_before_cache_commit() {
let _guard = TEST_MUTEX.lock().await;
reset_global();
activate_cache(ResponseCacheConfig::default()).await;
let calls = Arc::new(AtomicUsize::new(0));
let close_calls = Arc::new(AtomicUsize::new(0));
let provider = close_tracking_stream_provider(
Arc::clone(&calls),
Arc::clone(&close_calls),
openai_chat_stream_chunks(),
None,
);
stream_call(&provider, chat_request("natural completion")).await;
assert_eq!(
close_calls.load(Ordering::SeqCst),
1,
"upstream must already be closed once the consumer observes natural EOF"
);
stream_call(&provider, chat_request("natural completion")).await;
assert_eq!(calls.load(Ordering::SeqCst), 1);
assert_eq!(close_calls.load(Ordering::SeqCst), 1);
}
🤖 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_tests.rs` around lines 723 -
747, Move the close_calls assertion in
naturally_completed_stream_closes_upstream_before_cache_commit to immediately
after the first stream_call, confirming the upstream closes exactly once before
the second request can reuse the cache entry. Keep the calls assertion after the
second stream_call to verify only one upstream invocation occurred.

Source: Path instructions

Resolve the buffered gateway conflict and adapt response-cache streams to the close-aware LlmJsonStream API.

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: 3

🤖 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/config.rs`:
- Around line 51-55: The BackendConfig editor metadata currently advertises
redis unconditionally while validation only accepts it with the redis-backend
feature. Update the kind enum in the BackendConfig nemo_relay::editor_config!
declaration to include redis only when that feature is enabled, keeping
in_memory always available and matching the canonical schema and validation
behavior.

In `@crates/adaptive/tests/unit/response_cache/mark_tests.rs`:
- Around line 35-52: Wrap the process-wide pricing resolver override created by
set_active_pricing_resolver in a drop/unwind guard so
reset_active_pricing_resolver is always called, including when savings_from
panics. Update the test setup around these resolver functions while preserving
the existing pricing assertions and cleanup behavior.

In `@crates/node/adaptive.d.ts`:
- Around line 55-65: The Node response-cache API currently exposes snake_case
fields; change it to camelCase publicly and translate only at the plugin JSON
serialization boundary. In crates/node/adaptive.d.ts lines 55-65, rename
ResponseCacheConfig fields such as ttlSeconds, bypassRate, and
cacheNondeterministic; in lines 77-77 expose the section as responseCache;
update the factory documentation and types in lines 261-274 accordingly. In
crates/node/adaptive.js lines 163-176, accept and return camelCase values while
mapping them to the required snake_case Rust schema when generating plugin JSON.
🪄 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: 4a4856bb-f447-48fe-89ec-f63d3b2465a2

📥 Commits

Reviewing files that changed from the base of the PR and between e55f0aa and 4d0d5e3.

📒 Files selected for processing (35)
  • 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/adaptive/tests/unit/response_cache/key_tests.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/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
  • 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 (33)
{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:

  • python/nemo_relay/adaptive.pyi
  • go/nemo_relay/adaptive_runtime_test.go
  • go/nemo_relay/adaptive/adaptive.go
  • go/nemo_relay/adaptive.go
  • python/nemo_relay/adaptive.py
{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:

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

📄 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:

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

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

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

Files:

  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/src/redis.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/adaptive/Cargo.toml
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.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/store_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/cli/tests/coverage/shared/gateway_tests.rs
  • crates/adaptive/src/redis.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/config.rs
  • python/tests/test_adaptive_config.py
  • crates/adaptive/src/runtime/features.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/cli/tests/coverage/shared/server_tests.rs
  • crates/adaptive/src/config.rs
  • python/nemo_relay/adaptive.py
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/cli/src/gateway/mod.rs
  • crates/adaptive/tests/unit/response_cache/key_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/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/cli/tests/coverage/shared/gateway_tests.rs
  • crates/adaptive/src/redis.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/node/adaptive.js
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/config.rs
  • python/tests/test_adaptive_config.py
  • crates/adaptive/src/runtime/features.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/cli/tests/coverage/shared/server_tests.rs
  • crates/node/adaptive.d.ts
  • crates/adaptive/src/config.rs
  • python/nemo_relay/adaptive.py
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/cli/src/gateway/mod.rs
  • crates/adaptive/tests/unit/response_cache/key_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/tests/unit/response_cache/store_tests.rs
  • go/nemo_relay/adaptive_runtime_test.go
  • crates/adaptive/src/lib.rs
  • go/nemo_relay/adaptive/adaptive.go
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/cli/tests/coverage/shared/gateway_tests.rs
  • crates/adaptive/src/redis.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/node/adaptive.js
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/config.rs
  • python/tests/test_adaptive_config.py
  • crates/adaptive/src/runtime/features.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/cli/tests/coverage/shared/server_tests.rs
  • crates/node/adaptive.d.ts
  • crates/adaptive/src/config.rs
  • go/nemo_relay/adaptive.go
  • python/nemo_relay/adaptive.py
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/cli/src/gateway/mod.rs
  • crates/adaptive/tests/unit/response_cache/key_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/tests/unit/response_cache/store_tests.rs
  • go/nemo_relay/adaptive_runtime_test.go
  • crates/adaptive/src/lib.rs
  • go/nemo_relay/adaptive/adaptive.go
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/cli/tests/coverage/shared/gateway_tests.rs
  • crates/adaptive/src/redis.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/node/adaptive.js
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/cli/tests/coverage/shared/server_tests.rs
  • crates/node/adaptive.d.ts
  • crates/adaptive/src/config.rs
  • go/nemo_relay/adaptive.go
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/cli/src/gateway/mod.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
crates/adaptive/**

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

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

Files:

  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/src/redis.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/adaptive/Cargo.toml
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/adaptive/tests/unit/response_cache/key_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/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/src/redis.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/adaptive/Cargo.toml
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/adaptive/tests/unit/response_cache/key_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/unit/response_cache/store_tests.rs
  • go/nemo_relay/adaptive_runtime_test.go
  • crates/adaptive/src/lib.rs
  • go/nemo_relay/adaptive/adaptive.go
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/cli/tests/coverage/shared/gateway_tests.rs
  • crates/adaptive/src/redis.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/node/adaptive.js
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/config.rs
  • python/tests/test_adaptive_config.py
  • crates/adaptive/src/runtime/features.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/cli/tests/coverage/shared/server_tests.rs
  • crates/node/adaptive.d.ts
  • crates/adaptive/src/config.rs
  • go/nemo_relay/adaptive.go
  • python/nemo_relay/adaptive.py
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/cli/src/gateway/mod.rs
  • crates/adaptive/tests/unit/response_cache/key_tests.rs
**/*.{rs,py,js,ts,tsx,go,java,kt,swift}

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

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

Files:

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

⚙️ CodeRabbit configuration file

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

Files:

  • crates/adaptive/tests/unit/response_cache/store_tests.rs
  • crates/adaptive/src/lib.rs
  • crates/adaptive/src/redis.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/config.rs
  • crates/adaptive/src/runtime/features.rs
  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/adaptive/src/config.rs
  • crates/adaptive/src/runtime/validation.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/mark.rs
  • crates/adaptive/tests/integration/response_cache_benchmark_tests.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/adaptive/tests/integration/response_cache_tests.rs
  • crates/adaptive/src/response_cache/intercept.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/adaptive/tests/unit/response_cache/key_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/unit/response_cache/store_tests.rs
  • go/nemo_relay/adaptive_runtime_test.go
  • crates/cli/tests/coverage/shared/doctor_tests.rs
  • crates/cli/tests/coverage/shared/gateway_tests.rs
  • crates/adaptive/tests/unit/response_cache/replay_tests.rs
  • crates/adaptive/tests/unit/config_tests.rs
  • crates/adaptive/tests/unit/response_cache/mark_tests.rs
  • python/tests/test_adaptive_config.py
  • crates/adaptive/tests/integration/response_cache_common.rs
  • crates/cli/tests/coverage/shared/server_tests.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
go/nemo_relay/**/*.go

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

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

Use PascalCase for public Go APIs.

Files:

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

📄 CodeRabbit inference engine (CONTRIBUTING.md)

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

Files:

  • go/nemo_relay/adaptive_runtime_test.go
  • go/nemo_relay/adaptive/adaptive.go
  • go/nemo_relay/adaptive.go
**/*.{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:

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

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

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

Files:

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

⚙️ CodeRabbit configuration file

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

Files:

  • go/nemo_relay/adaptive_runtime_test.go
  • go/nemo_relay/adaptive/adaptive.go
  • go/nemo_relay/adaptive.go
{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/lib.rs
  • crates/adaptive/src/redis.rs
  • crates/adaptive/src/response_cache/mod.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/config.rs
  • python/tests/test_adaptive_config.py
  • crates/adaptive/src/runtime/features.rs
  • crates/cli/src/diagnostics/mod.rs
  • crates/adaptive/src/config.rs
  • python/nemo_relay/adaptive.py
  • crates/adaptive/src/runtime/validation.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/intercept.rs
  • crates/adaptive/src/response_cache/store.rs
  • crates/cli/src/gateway/mod.rs
go/nemo_relay/adaptive/**

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

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

Files:

  • go/nemo_relay/adaptive/adaptive.go
crates/node/**/*.{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
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
**/*.py

📄 CodeRabbit inference engine (CONTRIBUTING.md)

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

Files:

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

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

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

Files:

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

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

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

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

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

Files:

  • python/nemo_relay/adaptive.py
🧠 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 (45)
crates/adaptive/tests/integration/response_cache_benchmark_tests.rs (1)

166-372: LGTM!

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

15-58: LGTM!

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

123-1181: LGTM!

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

93-138: LGTM!

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

9-567: LGTM!

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

8-110: LGTM!

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

9-187: LGTM!

python/tests/test_adaptive_config.py (1)

18-198: LGTM!

go/nemo_relay/adaptive_runtime_test.go (1)

173-237: LGTM!

crates/adaptive/Cargo.toml (2)

26-26: 📐 Maintainability & Code Quality

Confirm the required Rust validation suite.

Please provide passing results for cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings, just test-rust, and uv run pre-commit run --all-files for this Rust change set. As per coding guidelines, “Any Rust change must run just test-rust,” cargo fmt --all, and strict Clippy before review.

Source: Coding guidelines


51-58: LGTM!

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

1-49: LGTM!

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

33-34: LGTM!

Also applies to: 46-47, 56-56

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

11-27: LGTM!

go/nemo_relay/adaptive.go (1)

20-20: 📐 Maintainability & Code Quality

Confirm required Go validation for both binding surfaces.

  • go/nemo_relay/adaptive.go#L20-L20: include this API expansion in validation.
  • go/nemo_relay/adaptive.go#L70-L112: include new config serialization in validation.
  • go/nemo_relay/adaptive.go#L185-L216: include constructors in validation.
  • go/nemo_relay/adaptive/adaptive.go#L55-L60: include shorthand aliases in validation.
  • go/nemo_relay/adaptive/adaptive.go#L122-L136: include shorthand constructors in validation.

Please provide passing cd go/nemo_relay && go fmt ./..., go vet ./..., and just test-go results. As per coding guidelines, changed Go bindings must be formatted, vetted, and tested.

Source: Coding guidelines

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

37-40: LGTM!

Also applies to: 56-56, 194-241, 313-319, 392-409

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

185-185: LGTM!

Also applies to: 288-331, 337-355

python/nemo_relay/adaptive.py (1)

254-299: LGTM!

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

python/nemo_relay/adaptive.pyi (1)

184-216: LGTM!

Also applies to: 229-229, 240-240

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

7-10: LGTM!

Also applies to: 86-91, 93-223, 225-247

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

36-88: LGTM!

Also applies to: 141-166, 189-305, 313-432, 440-497

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

34-83: LGTM!

Also applies to: 109-109

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

37-45: LGTM!

Also applies to: 485-490, 785-826

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

50-134: LGTM!


139-155: LGTM!


207-317: LGTM!


424-426: LGTM!

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

302-371: LGTM!


407-443: LGTM!


445-546: LGTM!

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

22-83: LGTM!


91-264: LGTM!

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

28-101: LGTM!


155-215: LGTM!

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

532-538: LGTM!


575-647: 🗄️ Data Integrity & Integration

Response cache diagnostics flow is correct. Not configured/disabled stays Info; validation failures short-circuit to Fail without probing; otherwise the backend health check runs.

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

217-281: LGTM!


301-393: LGTM!


479-491: LGTM!

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

101-108: LGTM!


3168-3350: LGTM!


3352-3483: LGTM!

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

1049-1147: LGTM!

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

948-959: LGTM!


1006-1017: LGTM!

Comment thread crates/adaptive/src/response_cache/config.rs
Comment thread crates/adaptive/tests/unit/response_cache/mark_tests.rs Outdated
Comment thread crates/node/adaptive.d.ts
Comment on lines +55 to +65
/** Opt-in LLM response cache (exact-match) settings. */
export interface ResponseCacheConfig {
ttl_seconds?: number;
namespace?: string;
priority?: number;
bypass_rate?: number;
cache_nondeterministic?: boolean;
key_strategy?: string;
header_allowlist?: string[];
skip_keys?: string[];
backend?: BackendSpec;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift

Keep the Node public response-cache API camelCase.

The new Node surface exposes snake_case configuration fields, contrary to the binding convention. Expose camelCase properties and convert them to the Rust JSON schema at the serialization boundary.

  • crates/node/adaptive.d.ts#L55-L65: rename public fields such as ttl_seconds, bypass_rate, and cache_nondeterministic to camelCase.
  • crates/node/adaptive.d.ts#L77-L77: expose the section as responseCache.
  • crates/node/adaptive.d.ts#L261-L274: update factory docs/types to the camelCase public contract.
  • crates/node/adaptive.js#L163-L176: accept and return camelCase API values, then map them to snake_case only when producing plugin JSON.

As per coding guidelines, crates/node/**/*.{js,mjs,cjs,ts,tsx} must “Use camelCase for Node.js public APIs.”

📍 Affects 2 files
  • crates/node/adaptive.d.ts#L55-L65 (this comment)
  • crates/node/adaptive.d.ts#L77-L77
  • crates/node/adaptive.d.ts#L261-L274
  • crates/node/adaptive.js#L163-L176
🤖 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/node/adaptive.d.ts` around lines 55 - 65, The Node response-cache API
currently exposes snake_case fields; change it to camelCase publicly and
translate only at the plugin JSON serialization boundary. In
crates/node/adaptive.d.ts lines 55-65, rename ResponseCacheConfig fields such as
ttlSeconds, bypassRate, and cacheNondeterministic; in lines 77-77 expose the
section as responseCache; update the factory documentation and types in lines
261-274 accordingly. In crates/node/adaptive.js lines 163-176, accept and return
camelCase values while mapping them to the required snake_case Rust schema when
generating plugin JSON.

Source: Coding guidelines

Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
@zhongxuanwang-nv
zhongxuanwang-nv requested a review from a team as a code owner July 22, 2026 21:31
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