Repository navigation
feat(cache): add a guarded native response-cache resolver foundation - #42769
Merged
Merged
Conversation
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
|
…uard matches Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
4 of 6 tasks
…_cache_foundation
…ger matches its facade Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
|
@greptileai please re-review the new tip: the resolver now declines on a facade mismatch instead of taking the Python callback path |
yujonglee-berri
approved these changes
Sep 23, 2026
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.
TLDR
Problem this solves:
Cachefacade's resolved native serviceHow it solves it:
PYTHON_ONLY; no production route calls the resolver yetUser Flow
This PR is a resolver foundation with no production consumer, so end-user behavior is unchanged in this revision
Before: a configured response cache behaves exactly as today
litellm.cache = Cache(type="local")After: identical
litellm.cache = Cache(type="local")Relevant issues
Affected release
Linear ticket
Pre-Submission checklist
uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
No end-to-end proof is possible for this revision: the default catalog keeps every cache rule
PYTHON_ONLYand no production route calls_CacheResolver, so a live proxy behaves identically at the merge base and at the tip. The resolver's native-reuse, decline, and Python-fallback behavior is covered by the behavioral tests intests/test_litellm_rust/test_cache.py(test_inference_resolver_uses_the_configured_native_cache_directlyandtest_inference_resolver_declines_a_native_runtime_whose_facade_changed), and a live before/after run will be attached by the PR that wires the first production route to the resolverType
Caveats (if any)
Medium
facade.cacheis replaced, the facade's ownget_cache/add_cachestill use the stale_native_cacheuntil the owner rebuilds it; this PR only stops the resolver from reusing itLow
Final Attestation
I have reviewed this PR and confirm that it is ready for review
Link to Devin session: https://app.devin.ai/sessions/6663034c50e246e686b624c794a71fdb
Open in Devin Desktop: https://app.devin.ai/desktop/session/6663034c50e246e686b624c794a71fdb?variant=devin
Requested by: @yujonglee-berri