Repository navigation
Stop the denied llama.cpp cache recovery littering, and say what Windows allows - #11220
Conversation
…ows allows Move-Item falls back to copy-then-delete when the rename is refused, which creates the aside folder and then dies on the unreadable contents, leaving a stray llama.cpp.denied-* beside the original on every run. Directory.Move is a bare rename that creates nothing when it throws. Measured on windows-latest: every read denial refuses the rename, and denying DELETE does not, so the recovery cannot fire on Windows. It does on POSIX, so the attempt stays and the expectations are now per platform.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0b95ecb27c
ℹ️ 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".
| # copy-then-delete when the rename fails, which creates $asideDir and then | ||
| # dies on the unreadable contents, leaving a stray llama.cpp.denied-* folder | ||
| # beside the original on every run. Directory.Move is a bare rename: it | ||
| # either moves the tree or throws having created nothing. |
There was a problem hiding this comment.
Keep the shared preflight implementations identical
The newly added comments differ from the corresponding block in studio/setup.ps1, but test_installer_copy_matches_setup compares the complete normalized source of Invoke-ManagedLlamaCppPreflight, including comments. Running python -m pytest -q tests/studio/install/test_denied_llama_cpp_preflight.py on this commit deterministically fails that parity check, so the shared helper text must be synchronized before Backend CI can pass.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and reproduced before fixing:
tests/studio/install/test_denied_llama_cpp_preflight.py
FAILED test_installer_copy_matches_setup[Invoke-ManagedLlamaCppPreflight]
FAILED test_a_denied_cache_is_moved_aside_only_when_it_is_ours_to_move
2 failed, 28 passed
My mistake: I ran the PowerShell suite on both Linux and windows-latest and did not run the Python installer contract tests, which is exactly the class of gap this PR is about. The comment blocks in install.ps1 and studio/setup.ps1 are now byte-identical (allowing for the 4-space indent difference the two files already have), so the parity check passes.
| # denying DELETE, which sounds like the blocker, does not stop it. On POSIX | ||
| # the rename needs only write+execute on the parent, so the recovery is real | ||
| # there and is why this stays rather than being deleted. | ||
| [System.IO.Directory]::Move($dir, $asideDir) |
There was a problem hiding this comment.
Update the contract test for Directory.Move
Changing the recovery primitive here guarantees that test_a_denied_cache_is_moved_aside_only_when_it_is_ours_to_move fails because it still requires the extracted function body to contain Move-Item -LiteralPath $dir -Destination $asideDir. This was reproduced by running the focused installer test file; update that contract to recognize the new Directory.Move call or the repo test suite remains red.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, same run. The contract now requires the new primitive instead:
assert "[System.IO.Directory]::Move($dir, $asideDir)" in body
code = "\n".join(line.split("#", 1)[0] for line in body.splitlines())
assert "Move-Item" not in code
The second assertion is the one worth having: it stops the copy-then-delete fallback coming back by any route, not just at this call site. It is scoped to code because the comment above the call names Move-Item to explain why it is not used, and my first version of the assertion tripped on its own prose.
The docstring now carries the measured reason rather than the old claim that a rename only needs DELETE plus parent write, which is what sent this wrong in the first place.
30 passed in that file; the PowerShell suite is still All checks passed on Linux, and was green on windows-latest before these two commits.
|
@codex review |
|
@codex security review |
|
Codex Review: Didn't find any major issues. Another round soon, please! 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". |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
The parity test compares the helper's whole normalised source including comments, and the contract test still required the Move-Item call.
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! 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". |
…ows allows (unslothai#11220) * Stop the denied llama.cpp cache recovery littering, and say what Windows allows Move-Item falls back to copy-then-delete when the rename is refused, which creates the aside folder and then dies on the unreadable contents, leaving a stray llama.cpp.denied-* beside the original on every run. Directory.Move is a bare rename that creates nothing when it throws. Measured on windows-latest: every read denial refuses the rename, and denying DELETE does not, so the recovery cannot fire on Windows. It does on POSIX, so the attempt stays and the expectations are now per platform. * Sync the two preflight copies and the Move-Item contract The parity test compares the helper's whole normalised source including comments, and the contract test still required the Move-Item call.
Why
Windows Unsloth GGUF CI / GGUF inference smoke (API, tools, vision)is red onmainand has been since 13:27, so every open pull request inherits it:Three consecutive completed runs on
mainare red (15:060408ff916, 15:27e43b2baea, 15:49062e64308); everything between is cancelled.Introduced by #10533, which added both the recovery and these three checks. Its only
Windows Unsloth GGUF CIrun, against its final head62960c80d, was cancelled at 13:27, the minute it merged, so the Windows path it added was never exercised on Windows before landing.What is actually true on Windows
The whole suite passes on Linux, so this is Windows-specific. Rather than reason about ACLs, I measured them on
windows-latest: build the tree, deny one shape on the folder, rename it.Move-Item[System.IO.Directory]::Move(OI)(CI)(RX)(what the harness uses)(OI)(CI)(R)(RX)(no inheritance)(DE)Two things follow, and both contradict what #10533 assumed:
SYNCHRONIZE, which any read deny removes. The recovery cannot fire for the denial this code exists to handle.DELETEdoes not stop the rename, which is the opposite of what the harness'sunmovablemode assumes. That mode only fails to move because the read deny applied to every mode already refuses it.And separately from the ACL question:
Move-Itemlitters. When the rename is refused it falls back to copy-then-delete, creating the aside folder and then dying on the unreadable contents. That leavesllama.cpp.denied-<timestamp>next to the original, one per run, in the user's.unslothdirectory.[System.IO.Directory]::Moveis a bare rename: it moves the tree or throws having created nothing.The change
Product, in both copies of the preflight (
install.ps1andstudio/setup.ps1): use[System.IO.Directory]::Moveinstead ofMove-Item, so a refused rename leaves nothing behind and still falls through to the guidance path. The attempt stays rather than being deleted, because on POSIX the rename needs only write and execute on the parent and the recovery genuinely works there.Test: the three checks are now per platform, because the behaviour is per platform rather than per implementation.
continue,ASIDE_COUNT: 1, original gone.stop,ASIDE_COUNT: 0, original still there.The measured table is written into both files, including the counter-intuitive row, so nobody re-derives it. I also fixed a comment in the harness that described the
unmovablemode as working by taking DELETE away; on Windows that is not what stops the move.Checks
The Windows leg ran on a staging branch carrying exactly these three files, since the point of this fix is that the last change here was never run on Windows before merging.
What I did not change
The guidance path, which was already correct and green: when the cache cannot be recovered the user is told which folder it is, that a reinstall will not help, and the takeown/icacls commands to run.