feat(adaptive): add logical response cache keys - #818
Draft
zhongxuanwang-nv wants to merge 7 commits into
Draft
Conversation
A higher-hit-rate `key_strategy`: tools are keyed by a structural, description- and order-insensitive schema hash, so rewording or reordering tool definitions no longer busts the cache — only a changed tool interface does. Every other field keys exactly as `exact_request`; the two strategies never share keys. Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
zhongxuanwang-nv
force-pushed
the
feat/response-cache-logical-keys
branch
from
August 20, 2026 16:18
f98b3a5 to
46238bc
Compare
2 tasks
Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Adds a logical key strategy for LLM response caching so description-only edits and tool-definition reordering do not invalidate otherwise compatible cache entries.
Details
key_strategy = "logical", which recursively removes string-valued tool-description fields and canonically sorts the request's tool definitions before keying. Tool names, parameter schemas, constraints, settings, and every non-tool request field remain key-significant.logicalandexact_requestentries in separate keyspaces.ResponseCacheConfig.key_strategyhelpers now use a strategy type instead of a plain string; the JSON/TOML wire values remain unchanged. The Node.js TypeScript surface narrows the field fromstringto the supported strategy union.cargo fmt --all -- --checkcargo test -p nemo-relay-adaptivejust test-rustcargo clippy --workspace --all-targets -- -D warningsjust test-python(686 passed)just test-node(391 passed)just test-gouv run pre-commit run --all-filesuv run pre-commit run --files <changed code files>Where should the reviewer start?
Start with
build_cache_keyandstructural_tool_schemaincrates/adaptive/src/response_cache/key.rs, then review the logical-key cases incrates/adaptive/tests/unit/response_cache/key_tests.rs.Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)