Repository navigation
🐛 fix(cache): keep shim results out of shared cache - #232
Merged
Merged
Conversation
A checkout can change the interpreter selected by a launcher without changing the launcher's path or mtime. Its cached result then affects later checkouts. Cache a query only when the probed path is the interpreter that answered. This also keeps unsupported-version verdicts tied to the interpreter that produced them. Fixes tox-dev#194.
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.
An untrusted checkout can make a launcher select an unsupported Python. The process cache and disk cache keyed that verdict by the launcher's unchanged path, so a later unrelated checkout could inherit the failure. This PR caches a query only when the probed path is the interpreter that answered. This addresses draft advisory ANT-2026-HK25S1M7.
Launcher results crossed directories
pyenv selects a version from the current directory's
.python-version. Before this change,_get_from_cacheretained every result under the launcher path, while_get_via_file_cachewrote successful and unsupported results to disk under the same path. The new identity check compares the queried path with the interpreter that answered before either cache accepts the result.flowchart LR Q[Query candidate] --> Old[Before: cache by candidate path] Q --> Same{Now: candidate is the interpreter?} Same -- yes --> Keep[Cache the result] Same -- no --> Retry[Return without caching] classDef old fill:#ffd6d6,stroke:#c1121f,color:#5c0000; classDef fixed fill:#d8f3dc,stroke:#2d6a4f,color:#1b4332; class Old old; class Same,Keep,Retry fixed;Unsupported-version verdict identity
The old version gate reported only the version. The updated gate also reports its
sys.executable, and_query_failurepasses that identity to the cache decision. The user-facing error still names the queried candidate and its version.Behavior changes
Direct interpreter paths and symlinks to them remain cacheable. Discovery queries launchers and generic failures again on later calls, including calls from a different current directory. The collector script change also invalidates older disk entries through the existing script hash.
Closes #194.
Reported by Anthropic's OSS Scanner: ANT-2026-HK25S1M7.