Repository navigation
Uninstall the whisper.cpp prebuilt and the node/whisper install locks - #7686
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c2fa013247
ℹ️ 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".
| # Managed whisper.cpp dictation engine (install_whisper_prebuilt.py), a sibling | ||
| # of studio in default mode. Only present when a whisper prebuilt matching the | ||
| # pinned llama.cpp build existed at install time, so many installs lack it. | ||
| _remove_path "$HOME/.unsloth/whisper.cpp" |
There was a problem hiding this comment.
Preserve user-configured whisper.cpp directories
When UNSLOTH_WHISPER_CPP_PATH points to $HOME/.unsloth/whisper.cpp, or UNSLOTH_SKIP_WHISPER_INSTALL=1 is used with a user-owned checkout there, studio/setup.sh:2207-2210 explicitly skips the managed installation, but this unconditional removal still recursively deletes that directory during uninstall. Gate deletion on an Unsloth ownership marker or prebuilt manifest so uninstalling Studio cannot erase a supported user-managed whisper.cpp tree.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not taking this one. The whisper line is symmetric with the long-standing llama.cpp behaviour two lines above it, so it is a pre-existing design decision rather than something this PR introduces. grep for UNSLOTH_LLAMA_CPP_PATH in scripts/uninstall.sh returns exactly one hit, the comment on line 261 itself: the uninstaller never reads the variable. "A user-set UNSLOTH_LLAMA_CPP_PATH is intentionally kept" therefore means only that a custom path elsewhere is untouched because we delete the fixed default path. A user pointing the variable at the managed default has always had that directory removed. The ownership marker you point at (_assert_studio_owned_or_absent, setup.sh) is gated on the studio home being custom, so it deliberately does not apply in default mode, where ~/.unsloth/whisper.cpp is the managed location. Adding a marker for whisper alone while llama.cpp, node and .cache stay unconditional would make the uninstaller less consistent, and --help now states plainly that these siblings are removed.
| HOME="$FIXTURE_HOME" sh "$UNINSTALL_SH" > "$_TMP_ROOT/out.log" 2>&1 || { | ||
| echo " FAIL: uninstall exited $?"; FAIL=$((FAIL + 1)); cat "$_TMP_ROOT/out.log"; } |
There was a problem hiding this comment.
Isolate WSL-wide cleanup before invoking the real uninstaller
When this test suite is run on WSL, overriding HOME does not isolate the platform-wide cleanup because the uninstaller detects WSL from /proc/version and then uses the real powershell.exe, /mnt/*/Users, and /etc/profile.d paths in scripts/uninstall.sh:324-463. This invocation can therefore remove the developer's live Windows shortcuts, shared icon, and /etc/profile.d/unsloth-rocm-wsl.sh; stub WSL detection and its external commands, or add a narrowly scoped test mode, before running the uninstaller against the fixture.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, fixed in d8bf12c. The sibling suite tests/sh/test_uninstall_arg_guard.sh already skips on WSL for exactly this reason ("the uninstall body reaches Windows-side state outside the fixture") and this one did not. Confirmed the reachable paths: the WSL branch shells out to powershell.exe to delete "Unsloth Studio*.lnk" and the shared unsloth.ico, the interop-off fallback scans /mnt/{c,d,e}/Users, and it sudo-removes /etc/profile.d/unsloth-rocm-wsl.sh. None of those sit under HOME. The suite now exits 0 early when /proc/version reports microsoft.
|
Verified on real runners before and after, using a staging copy of this repo so the org queue is not charged for it. The job runs Before the fix, both platforms left the same thing behind:
After the fix, with the audit turned from a probe into a hard assertion: The same job also confirms the update is idempotent ( |
scripts/uninstall.sh removed the llama.cpp prebuilt and its install lock but not the whisper.cpp prebuilt, and not the node or whisper install locks. Every prebuilt serializes on <parent>/.<name>.install.lock (prebuilt_core.py install_lock_path), so a normal install leaves ~/.unsloth/.node.install.lock behind. The final rmdir refuses a non-empty directory, so one stray zero-byte lock keeps the whole ~/.unsloth tree on disk. Confirmed on a real ubuntu-latest install -> update x3 -> uninstall run: ~/.unsloth and ~/.unsloth/.node.install.lock both survived. whisper.cpp is only installed when a prebuilt matching the pinned llama.cpp build exists, so runs that skip it never exercised that path. Also removes the .stale.<pid> locks that a lock takeover renames rather than deletes, documents the sibling prebuilts in --help, and adds a ~/.unsloth catch-all to the smoke workflow's leak list so a future artifact cannot be missed the same way. tests/sh/test_uninstall_prebuilt_artifacts.sh runs the uninstaller for real against a fixture HOME: 19 checks pass here and 8 of them fail against the previous uninstall.sh. It also asserts user content under ~/.unsloth is kept.
c2fa013 to
081d4e0
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 081d4e0159
ℹ️ 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".
| # Managed whisper.cpp dictation engine (install_whisper_prebuilt.py), a sibling | ||
| # of studio in default mode. Only present when a whisper prebuilt matching the | ||
| # pinned llama.cpp build existed at install time, so many installs lack it. | ||
| _remove_path "$HOME/.unsloth/whisper.cpp" |
There was a problem hiding this comment.
Mirror the prebuilt cleanup in uninstall.ps1
This cleanup only updates the POSIX uninstaller, so native Windows installations still leave the managed whisper.cpp tree and the Node/whisper lock files behind. studio/setup.ps1:4085-4099 installs whisper.cpp under %USERPROFILE%\.unsloth\whisper.cpp, while scripts/uninstall.ps1:361-425 removes only llama.cpp, Node, staging, and the llama lock; its Windows smoke assertion at .github/workflows/studio-windows-update-smoke.yml:313-317 also checks only the Studio tree. Mirror these removals in scripts/uninstall.ps1 and extend that smoke check so Windows users receive the same complete uninstall behavior.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, fixed in d8bf12c. Confirmed against origin/main: uninstall.ps1 removed llama.cpp, .cache, node and .staging, plus only .llama.cpp.install.lock, while setup.ps1 installs whisper.cpp at %USERPROFILE%.unsloth\whisper.cpp. The locks are generic (install_dir.parent/'..install.lock' in prebuilt_core.py), so .node.install.lock and .whisper.cpp.install.lock were both leaking and either one blocks the empty-dir prune. Added the whisper dir, all three locks and the .stale. sweep, put the whisper dir in the handle-releasing list so a running whisper-server does not refuse the delete, updated -Help, and extended the Windows smoke assertion with the same catch-all the POSIX one got. Also added tests/studio/test_uninstall_prebuilt_parity.ps1, which asserts the two uninstallers cover the same artifacts; against the previous uninstall.ps1 it fails on exactly the four missing behaviours.
|
The new suite also runs clean on both POSIX runners, with a negative control proving it discriminates:
macOS runs one fewer argument-guard case because the truncated-download check needs Linux The eight failures on the pre-fix script are the same set on both platforms: |
…n WSL Two review findings. uninstall.ps1 removed llama.cpp, node, .staging and the llama lock, but not the whisper.cpp tree or the node and whisper locks, while setup.ps1 installs whisper.cpp at %USERPROFILE%\.unsloth\whisper.cpp. A native Windows uninstall therefore left a prebuilt tree behind and could never prune ~/.unsloth. Adds the whisper dir, all three locks and the .stale.<pid> sweep, puts the whisper dir in the handle-releasing list so a running whisper-server does not block the delete, updates -Help, and extends the Windows smoke assertion with the same catch-all the POSIX one got. tests/sh/test_uninstall_prebuilt_artifacts.sh runs the real uninstaller, and overriding HOME does not contain that on WSL: the body detects WSL from /proc/version and then deletes Windows-side shortcuts under /mnt/*/Users and /etc/profile.d/unsloth-rocm-wsl.sh. The sibling arg-guard suite already skips there for exactly this reason; this one now does too. tests/studio/test_uninstall_prebuilt_parity.ps1 asserts the two uninstallers cover the same artifacts, since drift between them is what caused this. It cannot run the body (that kills processes and writes the registry) so it parses uninstall.ps1 instead. Against the previous uninstall.ps1 it fails on exactly the four missing behaviours. Also corrects the stale-lock comment: install_node_prebuilt.py renames then unlinks, so a stranded .stale file needs a crash between the two steps.
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. 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". |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0185fdd5be
ℹ️ 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".
| for _stale in "$HOME"/.unsloth/.*.install.lock.stale.*; do | ||
| [ -e "$_stale" ] && _remove_path "$_stale" |
There was a problem hiding this comment.
Restrict stale-lock deletion to managed component names
When a user keeps any file or directory under ~/.unsloth whose name happens to match .*.install.lock.stale.*, this catch-all deletes it recursively even though the uninstaller promises to retain unrelated content. The installers only create stale locks for the known llama.cpp, node, and whisper.cpp components, so enumerate those prefixes instead; the mirrored *.install.lock.stale.* sweep in uninstall.ps1 has the same issue.
Useful? React with 👍 / 👎.
| # The uninstaller body kills processes and writes to the registry, so it cannot | ||
| # be executed here; this asserts PARITY of the artifact list instead, plus that | ||
| # uninstall.ps1 still parses. | ||
| # | ||
| # Run: pwsh -NoProfile -File tests/studio/test_uninstall_prebuilt_parity.ps1 |
There was a problem hiding this comment.
Run the new PowerShell parity test in CI
This test is never invoked by any workflow: the Windows update workflow's unit-test step only runs test_uninstall_arg_guard.ps1 and test_uninstall_dual_install_icon.ps1, while the repository's automatic shell discovery only covers tests/sh/test_*.sh. Consequently a future Windows parity regression can pass CI whenever the live install skips the optional whisper prebuilt—the exact scenario this static test was added to cover.
Useful? React with 👍 / 👎.
Problem
scripts/uninstall.shremoved the llama.cpp prebuilt and its install lock, but not:~/.unsloth/whisper.cpp(the managed dictation engine)~/.unsloth/.node.install.lock~/.unsloth/.whisper.cpp.install.lock~/.unsloth/.<name>.install.lock.stale.<pid>Every prebuilt serializes on
<parent>/.<name>.install.lock(prebuilt_core.pyinstall_lock_path), so llama.cpp, node and whisper.cpp each leave one. Only the llama.cpp lock was being cleared.A stray zero-byte lock looks harmless, but the last step of the block is
rmdir "$HOME/.unsloth", andrmdirrefuses a non-empty directory. So a single missed lock keeps the entire~/.unslothtree on disk after a "successful" uninstall.Evidence
A real
install.sh->unsloth studio updatex3 ->scripts/uninstall.shrun on ubuntu-latest, diffing the whole$HOMEtree against a pristine snapshot:whisper.cppdid not appear there only because that run skipped it: the installer loggedwhisper.cpp no compatible prebuilt (installed llama.cpp b10194-mix-f08678f; whisper requires b10173-mix-2c8b9c1). Installs that do get a matching prebuilt leave the wholewhisper.cpptree behind, which is why the new test creates it unconditionally rather than relying on a live install to produce it.Changes
~/.unsloth/whisper.cpp, the node and whisper install locks, and any.stale.<pid>locks left by a lock takeover (install_node_prebuilt.pyrenames rather than deletes those).--helpnow names the sibling prebuilts it removes (~/.unsloth/{llama.cpp,node,whisper.cpp,.cache}); previously it only mentioned the install dir.studio-update-smoke.ymlgains the specific paths plus a~/.unslothcatch-all. Nothing but Unsloth writes there on a runner, so a surviving directory means the uninstaller missed something. That assertion does not need editing when a new artifact is added, which is exactly the failure mode here.Tests
tests/sh/test_uninstall_prebuilt_artifacts.shruns the uninstaller for real against a fixtureHOME(picked up automatically by thetests/sh/test_*.shdiscovery instudio-backend-ci.yml).scripts/uninstall.sh, so the test discriminates rather than passing vacuously.~/.unslothis kept,~/.unslothis then correctly retained for it, and the Unsloth artifacts around it are still cleared.tests/sh/test_uninstall_arg_guard.shstill passes 25/25.dash,bashandbusybox shall parse the modified script.Not changed
Two survivors are deliberate and left alone:
~/Documents/Unsloth Studio/is user project content, in the same class as the Hugging Face cache the uninstaller already documents as preserved.export PATH="$HOME/.local/bin:$PATH"lineinstall.shappends to the shell rc. That is the standard XDG user bin directory, shared with anything else installed there, so removing it could break unrelated tools.