fix(cache): preserve locked probes under directory aliases - #1787
Conversation
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Performance BenchmarksCompared
|
There was a problem hiding this comment.
Pull request overview
This PR fixes a Windows-specific cache-clearing edge case where an open (locked) cache identity probe could be reached via a directory alias (e.g., symlink/junction), causing clear_cache() to mistakenly treat the probe as unrelated and attempt to delete it while still locked. The change normalizes alias paths so stale cache entries can still be cleared safely, and the probe is removed once a later close succeeds.
Changes:
- Normalize/cache-resolve probe and cache directory paths during
clear_cache()to correctly retain locked probes even when referenced through directory aliases. - Add a regression test that simulates a Windows “open file cannot be unlinked” behavior when the probe name points through an aliased cache directory, validating close-failure then close-success cleanup.
- Document the user-visible fix in the changelog.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
modelaudit/cache/scan_results_cache.py |
Resolves cache/probe directory aliases before deciding whether to retain a still-locked probe during cache clearing. |
tests/cache/test_cache_correctness.py |
Adds a deterministic regression test covering aliased cache-directory probes across close-failure and retry success. |
CHANGELOG.md |
Notes the Windows alias + locked probe preservation behavior as a bug fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Validation
Full repository mypy on macOS still reports pre-existing platform/baseline findings; the exact-main GitHub Type Check is green.