Repository navigation
feat(cache): scope the response cache to the project, add --no-cache - #74
Merged
Merged
Conversation
The response cache was one machine-wide ~/.evalshift/cache.db keyed on the model name, prompt and inputs. A second project testing a different backend under the same model name replayed the first project's answers, and nothing said so. - Move the cache to .evalshift/cache.db in the folder the command runs in, beside .evalshift/runs/. `cache clear` names the path it cleared and points at the old machine-wide file when it exists (never deletes it). - `run --no-cache` / `compare --no-cache` send every run-stage call live and still write the fresh responses, so the next ordinary run does not bring back the answers that were bypassed. - `run` and `compare` print a warning when calls were replayed from the cache, with the count on the target side and a pointer to --no-cache. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.
Why
A tester found that a second run under the same candidate model name, from a different project folder, replayed the earlier answers. Answers only went live again once they renamed the candidate.
The cache was one machine-wide
~/.evalshift/cache.db, keyed on model name, prompt, inputs, temperature and max_tokens. Prompt and system-prompt edits that EvalShift sends are already in the key. Anything it doesn't send can't be in the key: another server behind the same id, a system prompt added server-side, or re-pulled weights. Those changes were invisible, and nothing told the user that calls had been replayed.What
~/.evalshift/cache.dbto.evalshift/cache.dbin the folder the command runs in, next to.evalshift/runs/.evalshift cache clearnames the path it cleared and mentions the old machine-wide file when it exists. It never deletes that file.run --no-cache/compare --no-cache. Every run-stage call is sent live, and the fresh responses still get written (CacheStore(refresh=True): reads always miss, writes still land). Without that, the next normal run would replay the answers the user just bypassed. The evaluate stage's judge and embedding cache is unaffected.runprints⚠ N model calls were replayed from this project's response cache (T on the target) …under its summary, andcompareprints it above the verdict.RunResultgainscached_target_calls.Docs travel with the change:
DOCS.md,llms-full.txt,docs/configuration.md,docs/getting-started.md,docs/faq.md,docs/index.md,CHANGELOG.md(Added + Changed).I chose not to add the endpoint (base URL) to the cache key, to avoid extra complexity for users.
Notes for reviewers
.gitignoreadvice (.evalshift/*) already covers the new file.Testing
cache clearpath and legacy hint, andrun/comparenotice and--no-cacheend to end. That includes the case "after--no-cache, the next cached run replays the fresh answers".ruff format,mypy --strictandpre-commit run --all-filespass.tests/unit/test_cli_capture_remote.py::test_online_sync_says_it_ignores_limits_it_cannot_read. It fails onmaintoo. It's flaky because the console wraps the temp folder path, and it's unrelated to this change.🤖 Generated with Claude Code