Skip to content

fix: include all ToolsConfig fields in the response cache key - #155

Open
shrdgn wants to merge 1 commit into
mainfrom
claude/vibrant-archimedes-uyw16u
Open

fix: include all ToolsConfig fields in the response cache key#155
shrdgn wants to merge 1 commit into
mainfrom
claude/vibrant-archimedes-uyw16u

Conversation

@shrdgn

@shrdgn shrdgn commented Aug 21, 2026

Copy link
Copy Markdown
Owner

What & why

cache_key() in openfusion/responsecache.py only folded tools.web_search and tools.web_fetch into the response cache key, omitting tools.max_results, tools.engine, tools.excluded_domains, and tools.apply_to_judge.

excluded_domains in particular exists "to prevent benchmark contamination" per ToolsConfig's own docstring — so an operator adding a domain there (or switching engine from auto to exa, or changing max_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_domains sorted, so entry order doesn't affect the key).

Closes #153.

How it was tested

  • ruff check . passes
  • mypy openfusion/responsecache.py passes
  • pytest -q passes (491 passed, no live network)
  • New behavior has a test (test_cache_key_differs_on_tools_config in tests/test_responsecache.py)
  • Docs updated if config / request surface / defaults changed — not needed, no public behavior/interface changed, only cache-key internals
  • No secrets, prompts, or response bodies added to logs or metrics
  • Quality/cost claims backed by a reproducible bench/run.py number — not applicable, this only affects cache-key stability, not answer quality

Notes for reviewers

Small, self-contained change to cache_key()'s payload dict plus one new regression test following the existing test_cache_key_differs_on_* pattern in the same file. No behavior change outside cache-hit/miss decisions.


Generated by Claude Code

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Response cache key omits most of ToolsConfig, serving stale answers after a tools change

2 participants