Skip to content

fix(cache): preserve locked probes under directory aliases - #1787

Merged
mldangelo-oai merged 1 commit into
mainfrom
fix/cache-clear-aliased-probe-lock
Jul 28, 2026
Merged

mldangelo-oai merged 1 commit into
mainfrom
fix/cache-clear-aliased-probe-lock

Conversation

@mldangelo-oai

Copy link
Copy Markdown
Contributor

Summary

  • Normalize cache-directory aliases before retaining a locked Windows identity probe during cache clearing.
  • Keep stale results removable after a probe-close failure, then remove the retained probe when a later close succeeds.
  • Add a deterministic failing-before regression and document the user-visible cache fix.

Validation

  • Complete cache suite: 222 passed, 6 skipped.
  • Release-workflow regressions: 132 passed.
  • Failing-before aliased-probe regression plus existing close-failure/retry regressions: passed.
  • Repository-wide Ruff lint and format checks: passed.
  • Changed-file mypy and strict modified-test mypy: passed.
  • Changelog Prettier and git diff whitespace checks: passed.

Full repository mypy on macOS still reports pre-existing platform/baseline findings; the exact-main GitHub Type Check is green.

Copilot AI review requested due to automatic review settings July 27, 2026 22:11
@mldangelo-oai

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: cbf3b27f09

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@github-actions

Copy link
Copy Markdown
Contributor

Workflow run and artifacts

Performance Benchmarks

Compared 13 shared benchmarks with a regression threshold of 15%.
Status: 0 regressions, 0 improved, 13 stable, 0 new, 0 missing.
Aggregate shared-benchmark median: 4.283s -> 4.359s (+1.8%).

Workload Benchmark Target Size Files Baseline Current Change Status
padded-multi-stream-upload tests/benchmarks/test_picklescan_benchmarks.py::test_picklescan_padded_multi_stream_upload multi_stream_padded 4.1 KiB 1 363.8us 344.9us -5.2% stable
nested-payload-review tests/benchmarks/test_picklescan_benchmarks.py::test_picklescan_nested_payload_review[nested_base64] nested_base64 98 B 1 302.8us 288.7us -4.7% stable
rejected-basic-auth-candidates tests/benchmarks/test_scan_benchmarks.py::test_rejected_basic_auth_candidates_scan_linearly - 371.1 KiB 1 2.433s 2.519s +3.6% stable
mixed-model-repository tests/benchmarks/test_scan_benchmarks.py::test_scan_release_candidate_repository release-candidate 547.3 KiB 32 656.67ms 633.45ms -3.5% stable
clean-training-checkpoint tests/benchmarks/test_picklescan_benchmarks.py::test_picklescan_clean_training_checkpoint safe_large 278.2 KiB 1 109.62ms 113.15ms +3.2% stable
direct-malicious-upload tests/benchmarks/test_picklescan_benchmarks.py::test_picklescan_direct_malicious_upload malicious_reduce 52 B 1 231.3us 226.3us -2.2% stable
nested-payload-review tests/benchmarks/test_picklescan_benchmarks.py::test_picklescan_nested_payload_review[nested_raw] nested_raw 78 B 1 283.2us 277.1us -2.1% stable
nested-payload-review tests/benchmarks/test_picklescan_benchmarks.py::test_picklescan_nested_payload_review[nested_hex] nested_hex 130 B 1 316.2us 310.7us -1.7% stable
suspicious-pickle-intake tests/benchmarks/test_scan_benchmarks.py::test_scan_suspicious_pickle_intake suspicious-intake 183.8 KiB 4 147.86ms 150.20ms +1.6% stable
chunked-upload-stream tests/benchmarks/test_picklescan_benchmarks.py::test_picklescan_chunked_upload_stream chunked_stream 278.2 KiB 1 112.69ms 113.71ms +0.9% stable
duplicate-heavy-registry tests/benchmarks/test_scan_benchmarks.py::test_scan_duplicate_registry_snapshot registry-snapshot 915.2 KiB 13 567.64ms 572.49ms +0.9% stable
single-checkpoint-preflight tests/benchmarks/test_scan_benchmarks.py::test_scan_single_checkpoint_before_load single_checkpoint.pkl 183.0 KiB 1 104.01ms 104.44ms +0.4% stable
warm-cache-rescan tests/benchmarks/test_scan_benchmarks.py::test_scan_warm_cached_repository_rescan release-candidate 547.3 KiB 32 150.16ms 150.65ms +0.3% stable

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@mldangelo-oai
mldangelo-oai merged commit caa2afe into main Jul 28, 2026
32 checks passed
@mldangelo-oai
mldangelo-oai deleted the fix/cache-clear-aliased-probe-lock branch July 28, 2026 08:03
@github-actions github-actions Bot mentioned this pull request Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants