Repository navigation
Studio: explain failed and recurring llama.cpp runtime repairs - #12106
Conversation
|
Checked that a failed or repeated llama.cpp runtime repair now names security software and the runtime folder instead of repairing silently, which matches what #11432 asks for. Will get this reviewed. |
NilayYadav
left a comment
There was a problem hiding this comment.
Review + reproduction evidence
Pinned review: 31685b54a2. Two findings, both fixed and pushed to this branch:
157f91f5a1:managed-environment-wait.test.tsliftscheckInstallAndStartinto a harness whose scope lackedwasRuntimeRepairedRecently, so "a stale install that is not busy still repairs" failed on Linux and Windows. The harness now stubs it, and a new case covers the recurrence branch (fails on main, passes here).31685b54a2:transitionBrowserAccountremoves everyunsloth*localStorage key on an account switch, which dropped the repair record and let the next quarantine repair silently again. The record is now kept across switches, with a test.
I reproduced it in the real packaged desktop app: an AppImage built from main and from this PR, Ubuntu 22.04 under Xvfb, driven through tauri-driver. The managed install is a fixture CLI whose desktop-capabilities reports llama_runtime_ok: false / llama_runtime_binaries_missing whenever ~/.unsloth/llama.cpp/build/bin/llama-server is missing, and whose studio update puts the file back. The frontend and the Rust preflight and repair code are the shipped code on both sides.
| launch | main 8d675fda |
this PR |
|---|---|---|
| healthy | app opens | app opens |
| runtime quarantined | repairs (1 studio update), app opens |
repairs (1 studio update), app opens, record saved |
| quarantined again | repairs again silently (1 studio update), app opens |
"Unsloth's llama.cpp runtime is missing files again soon after a repair. Security software may be removing them. Allow the runtime folder, usually ~/.unsloth/llama.cpp, ...", 0 studio update |
| repair fails (outbound network blocked for the app user) | "Update failed / Installation failed: Could not install uv" | "Unsloth could not repair its llama.cpp runtime. Security software may be blocking the reinstall ... Repair error: Installation failed: Could not install uv" |
non llama damage (studio_install_incomplete), twice |
repairs each time | identical |
| non llama repair fails | raw error | identical raw error |
- Actions A/B on fresh main: with the fix reverted (run), 5 frontend tests fail, including "a runtime damaged again soon after a repair explains instead of repairing" at its assertion. With the PR (run), Frontend build + bundle sanity and Frontend unit tests (Windows) pass. Locally the full frontend suite is 9163/9163 and typecheck is clean.
- The remaining red jobs (Repo tests CPU rest/studio, Python 3.13 rest) fail the same way on current main (
NameError: raise_if_merging_mistral_format_view, the skip guard check) and are not from this PR. - Checked and unaffected: non llama repair reasons, the Settings forced repair, and the elevation resume (the reason is carried through). Reason strings match what
install_llama_prebuilt.pyandmanaged.rsemit, and the Windows folder matchessetup.ps1.
One design point for a maintainer to decide, not blocking: on the recurrence screen, Retry runs preflight again and shows the same message for up to 7 days (confirmed in the app: Retry, 0 studio update, same text). The message points to unsloth studio update, which is on PATH for desktop installs and does reinstall the runtime, so users are not stuck. Someone who adds the exclusion and presses Retry may still expect a repair. If that is wanted, Retry on this screen could run the repair once.
Conclusion: the issue is real and this PR fixes both halves of #11432 in the shipped desktop flow. With the two fixes above it is ready to merge.
…virus and the network in the messages
NilayYadav
left a comment
There was a problem hiding this comment.
Review update: Retry and message changes, re-verified
Pinned review: d92af2bd6f. Since the first evidence comment, two more commits went onto this branch, and the desktop reproduction was re-run.
12d3b50c0b: Retry on the "missing files again" screen now runs the repair once, instead of re-running the preflight into the same message. The messages say "antivirus" throughout, the failure message also names the network as a possible cause, and the recurrence message ends with "then press Retry to reinstall it" instead of a terminal command.d92af2bd6f: a repair started from that Retry that then fails kept sending the next Retry through the preflight, which held the repair back again. Retry after a failed runtime repair now reruns that repair directly. One click, as the failure message says.
Same packaged desktop app flow as before (AppImage built from this branch at 12d3b50c on main 757a3f6e, Ubuntu 22.04 under Xvfb, tauri-driver, fixture managed CLI):
| launch | main 8d675fda |
this PR |
|---|---|---|
| runtime quarantined | repairs, app opens | repairs, app opens, record saved |
| quarantined again | repairs again silently, app opens | "Unsloth's llama.cpp runtime is missing files again soon after a repair. Antivirus may be removing them. Allow the runtime folder, usually ~/.unsloth/llama.cpp, in your antivirus, then press Retry to reinstall it." No repair. |
| Retry pressed on that screen | n/a | one studio update ran, app opened |
| repair fails (outbound network blocked) | "Installation failed: Could not install uv" | "Unsloth could not repair its llama.cpp runtime. Antivirus may be blocking the download or removing files as they are installed. Allow the runtime folder, usually ~/.unsloth/llama.cpp, in your antivirus, or check your connection, then retry. Repair error: Installation failed: Could not install uv" |
| non llama damage twice, and a non llama repair failure | repairs / raw error | identical |
- Actions A/B on fresh main at
d92af2bd: fix reverted (run) fails 6 frontend tests, including "retry on the runtime recurrence screen runs the repair the message asked for" and "a runtime damaged again soon after a repair explains instead of repairing". With the PR (run), Frontend build + bundle sanity and Frontend unit tests (Windows) pass. Locally: 9167/9167 frontend tests, typecheck clean. - Review of the current head found no remaining items.
- The failed-repair Retry path is covered by the unit test, not the desktop run: the last commit only changes that branch of
retry().
Conclusion: ready to merge at d92af2bd6f.
NilayYadav
left a comment
There was a problem hiding this comment.
Review update: Retry goes through the preflight
Pinned review: abff25d684. This replaces how Retry worked in my previous update.
45640ed8ee: Retry no longer calls the repair directly. On main, Retry after an automatic repair runs the preflight, and only a forced repair from Settings skips it; the preflight is what catches a busy environment, an external backend or an install that is already fixed. Retry now keeps that, and lifts the recent-repair hold for that one check. The hold still applies to the automatic check at launch.abff25d684: if that check lands on a busy environment, the lift carries through the wait, so the check after the wait still repairs.
Packaged desktop app, same flow as before, built from this branch at 45640ed8 on main (Ubuntu 22.04 under Xvfb, tauri-driver, fixture managed CLI):
| launch | main 8d675fda |
this PR |
|---|---|---|
| quarantined again after a repair | repairs again silently, app opens | "Unsloth's llama.cpp runtime is missing files again soon after a repair. Antivirus may be removing them. Allow the runtime folder, usually ~/.unsloth/llama.cpp, in your antivirus, then press Retry to reinstall it." No repair. |
| Retry pressed | n/a | Tauri log: desktop_preflight completed disposition=ManagedStale, then start_managed_repair, then Managed repair complete after update; Studio starting |
| repair fails (outbound network blocked) | "Installation failed: Could not install uv" | "Unsloth could not repair its llama.cpp runtime. Antivirus may be blocking the download or removing files as they are installed. Allow the runtime folder, usually ~/.unsloth/llama.cpp, in your antivirus, or check your connection, then retry. Repair error: Installation failed: Could not install uv" |
| first quarantine, non llama damage, non llama repair failure | repairs / raw error | identical |
- Actions on fresh main at
abff25d6: with the fix reverted (run), Frontend build + bundle sanity and Frontend unit tests (Windows) fail; with the PR (run), Frontend unit tests (Windows) pass. Locally: 9166/9166 frontend tests, typecheck clean. The pre-existing retry tests on main are unchanged. - The busy-wait carry is covered by a unit test; the desktop fixture has no busy state.
- The red "Repo tests (CPU, rest)" job fails
test_runtime_text_encodingonstudio/backend/vendor/laya/agent.py, added to main in #12202. This PR only changesstudio/frontend/.
Conclusion: ready to merge at abff25d684 once CI is green.
…thai#12106) * studio: explain failed and recurring llama runtime repairs * Stub the runtime repair history in the managed environment wait harness * Keep the llama.cpp runtime repair record across account switches * Let Retry reinstall a runtime that preflight held back, and name antivirus and the network in the messages * Retry a failed runtime repair directly instead of through the held-back preflight * Keep Retry on the preflight and lift the runtime repair hold for that one check * Carry the Retry allowance through the managed environment wait --------- Co-authored-by: Nilay Yadav <[email protected]>



Fixes #11432.
When the desktop finds missing llama.cpp runtime files, it normally starts a repair before showing the user the preflight warning. If that repair fails, the screen currently shows only the installer error. If the same damage returns after a successful repair, startup quietly tries again.
This change carries the runtime verdict into the repair flow, including an elevation retry. A failed runtime repair now shows the installer error alongside a cautious antivirus hint and the usual runtime folder. After a successful automatic runtime repair, the desktop remembers it for seven days. If preflight finds the runtime damaged again during that window, it shows the exclusion and reinstall steps instead of starting another automatic repair. Other repair reasons keep their existing behavior.
I ran the focused frontend tests (21 passing) and the frontend TypeScript typecheck. I could not reproduce an actual quarantine in this environment, so the warning and recurrence paths are covered with tests.