Repository navigation
Conversation
PromptCache.invalidate() deleted every key starting with the prompt name,
so create_prompt("summary") or update_prompt(name="summary") also evicted
cached prompts such as "summary_detailed" and "summary-v2". Matching on
"{name}-" is not enough, because prompt names can contain hyphens. Compare
the name of each cached prompt instead of the key prefix.
Mo0nl19ht
force-pushed
the
fix/prompt-cache-invalidate-exact-name
branch
from
November 17, 2026 02:14
68178f1 to
f0c2495
Compare
This branch has not been deployed
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.
What does this PR do?
create_promptandupdate_promptcallPromptCache.invalidate(name), which deletes every cache key that starts with the prompt name. Updatingsummarytherefore also evicts cached prompts such assummary_detailedandsummary-v2, and their nextget_promptcall goes back to the server.invalidate()now compares the name of each cached prompt instead of the key prefix. The cache key format and the public API are unchanged.Related PRs
Supersedes #1829 and #1671, which match on key prefixes. #1829 checks
key.startswith(f"{name}-"), which still evictssummary-detailedandsummary-v2, because prompt names can contain hyphens (as Greptile noted there). #1671 was closed by its author.Type of change
Verification
List the main commands you ran:
The new
tests/unit/test_prompt.py::test_invalidate_only_evicts_entries_of_the_given_prompt_namecachessummary(production, staging, version 3) next tosummary_detailed,summary-detailed,summary-v2andsummary/nested, then invalidatessummary. Onmainit fails with all 4 other prompts evicted; with the change from #1829 it still fails withsummary-detailedandsummary-v2evicted; with this change it passes.The comparison relies on the fetched prompt's name being the requested name, which
tests/e2e/test_prompt.py::test_update_prompt_in_folderalready asserts for folder prompts. I did not run the e2e suite locally.Checklist
code_review.md..env.templateif needed. (Not needed; no public API change.)

Confidence Score: 5/5
This change appears safe to merge.Summary
PromptCache.invalidatenow checks each stored prompt’s name instead of matching the start of its cache key.Reviews (1) · Last reviewed commit: "fix(prompts): invalidate only cache entr..." · Reviewed by Greptile