fix: include all ToolsConfig fields in the response cache key - #155
Open
shrdgn wants to merge 1 commit into
Open
fix: include all ToolsConfig fields in the response cache key#155shrdgn wants to merge 1 commit into
shrdgn wants to merge 1 commit into
Conversation
cache_key() only folded web_search/web_fetch into the key, so changing tools.max_results, tools.engine, tools.excluded_domains, or tools.apply_to_judge in openfusion.yaml left cached answers from the old recipe in place. excluded_domains exists to keep specific domains out of results (e.g. to avoid benchmark contamination), so a stale cache entry here can silently serve an answer that used a since-blocked domain. Fixes #153. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SaxXY4Z8GtiPWB3vaNScaE
6 tasks
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 & why
cache_key()inopenfusion/responsecache.pyonly foldedtools.web_searchandtools.web_fetchinto the response cache key, omittingtools.max_results,tools.engine,tools.excluded_domains, andtools.apply_to_judge.excluded_domainsin particular exists "to prevent benchmark contamination" perToolsConfig's own docstring — so an operator adding a domain there (or switchingenginefromautotoexa, or changingmax_results) would keep silently getting cached answers generated under the old tools recipe, with no signal anything was stale.Adds the four omitted fields to the cache-key payload (
excluded_domainssorted, so entry order doesn't affect the key).Closes #153.
How it was tested
ruff check .passesmypy openfusion/responsecache.pypassespytest -qpasses (491 passed, no live network)test_cache_key_differs_on_tools_configintests/test_responsecache.py)bench/run.pynumber — not applicable, this only affects cache-key stability, not answer qualityNotes for reviewers
Small, self-contained change to
cache_key()'s payload dict plus one new regression test following the existingtest_cache_key_differs_on_*pattern in the same file. No behavior change outside cache-hit/miss decisions.Generated by Claude Code