Skip to content

Studio setup: report a missing llama.cpp in Tauri mode instead of aborting the install - #7720

Merged
danielhanchen merged 2 commits into
mainfrom
pr-setup-degrade
Aug 1, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
pr-setup-degrade

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Aug 1, 2026 •

Copy link
Copy Markdown
Member

This is a behaviour change to first-launch install, so it wants a look before merging. After this, a desktop install whose llama.cpp prebuilt failed to download succeeds without GGUF inference, where today it fails outright.

The problem

setup.sh ends with:

if [ "$_LLAMA_CPP_DEGRADED" = true ] && [ "${SKIP_STUDIO_BASE:-0}" = "1" ]; then
    setup_fail 1 "llama.cpp setup did not produce a usable server"
fi

The intent is right for the shell installer. install.sh needs the non-zero exit so it can finish PATH and shortcut setup and only then report the GGUF failure. The comment above the block says exactly that.

In Tauri mode it does something else. install.rs turns the resulting error into Installation failed, so the whole first-launch install of the desktop app is aborted. One transient prebuilt download failure is enough, and a single HTTP 403 rate limit will do it.

The result the user sees is a contradiction: setup.sh's own footer prints the Installed banner and the usage hints, and then the app reports that installation failed. Nothing is repaired by retrying the install, because the venv, the frontend, the shortcuts and every non-GGUF workflow were all set up correctly. Only the llama.cpp binary is missing, and unsloth studio update fetches it later.

whisper.cpp in this same script already handles its own prebuilt failure this way. It prints a warning naming what is unavailable and what still works, and does not fail the install.

The change

Tauri mode emits a [TAURI:PROGRESS] line saying what is missing and how to get it back:

llama.cpp unavailable; GGUF inference is disabled until 'unsloth studio update' succeeds

Every other caller keeps setup_fail 1 exactly as before. install.sh is unaffected.

setup.ps1 gets the same treatment, because Windows had the identical defect: install.ps1 sets both SKIP_STUDIO_BASE=1 and UNSLOTH_TAURI_MODE, then turns any non-zero setup.ps1 status into Exit-InstallFailure, which install.rs reports as "Installation failed". The guard is the same @("1", "true") -contains $env:UNSLOTH_TAURI_MODE form that Exit-SetupFailure already uses at the top of that file.

Why the progress channel and not the step channel

The first version of this used [TAURI:STEP], which was wrong twice over:

  • install.rs maps it to install-step, and use-tauri-backend.ts only increments a counter with it. The payload is never stored, so the text was silently discarded.
  • install.sh already emits exactly 7 unique STEP markers, against a 7-entry INSTALL_STEPS list in startup-screen.tsx. An eighth marker pushes currentStepIndex past the end, and stepNum is not clamped, so the screen renders "Step 8 of 7".

[TAURI:PROGRESS] becomes install-progress-detail, which setProgressDetail stores and the installing screen renders verbatim below the step line. It also leaves the step counter alone.

Testing

tests/sh/test_llama_degraded_tauri_mode.sh, 8 cases, all passing. It extracts the block and runs it with setup_fail stubbed, so the contract is pinned without executing an install:

  • Tauri mode reports instead of aborting, and names the recovery command
  • the shell installer still gets its non-zero exit, with UNSLOTH_TAURI_MODE unset or 0
  • a direct unsloth studio update (SKIP_STUDIO_BASE=0) is still silent
  • a healthy llama.cpp still says nothing
  • the notice never emits [TAURI:STEP], so it cannot consume an install step
  • setup.ps1 gates on UNSLOTH_TAURI_MODE, emits the progress line, and still reaches Exit-SetupFailure otherwise

The first two cases fail against the current setup.sh and pass with this change. The file is picked up automatically by the discovery-based Backend CI shell step, and tests/studio/test_ci_shell_suite_coverage.py still passes 15/15.

…rting the install

setup.sh ends by exiting non-zero when the llama.cpp prebuilt did not produce a
usable server and it was called from install.sh, so the installer can report the
GGUF failure after finishing PATH and shortcut setup.

In Tauri mode that non-zero exit is not "report", it is "abort": install.rs
turns it into "Installation failed". So one transient prebuilt download failure,
and a single HTTP 403 rate limit is enough, fails the entire first-launch install
of the desktop app, moments after setup.sh's own footer said Installed. Everything
except GGUF inference is in fact working, and whisper.cpp in this same script
already degrades rather than failing for exactly this case.

Tauri mode now emits a [TAURI:STEP] line naming what is missing and how to get it
back. Every other caller keeps the non-zero exit unchanged.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2733359e4b

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

Comment thread studio/setup.sh
Comment on lines +2344 to +2347
case "${UNSLOTH_TAURI_MODE:-0}" in
1|true)
printf '[TAURI:STEP] %s\n' \
"llama.cpp unavailable; GGUF inference is disabled until 'unsloth studio update' succeeds"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Apply degraded Tauri handling to the Windows installer

This special case only changes the Unix setup path. On Windows, install.rs::resolve_install_script selects install.ps1, which sets UNSLOTH_TAURI_MODE and invokes studio/setup.ps1; its degraded footer still calls Exit-SetupFailure, and install.ps1 converts that nonzero status into an installation failure. Consequently, the same transient llama.cpp download failure that this change tolerates on Linux/macOS still aborts the desktop first-launch install on Windows; mirror this handling in setup.ps1 and cover that path.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Confirmed and fixed in 2637490. install.ps1 sets SKIP_STUDIO_BASE=1 (2764) and UNSLOTH_TAURI_MODE (2787), then turns any non-zero setup.ps1 status into Exit-InstallFailure (2826), which install.rs reports as "Installation failed", so Windows reproduced this exactly. setup.ps1 now gates on UNSLOTH_TAURI_MODE the same way Exit-SetupFailure already does at line 83, and still fails for every other caller. Pinned by a static block check in tests/sh/test_llama_degraded_tauri_mode.sh.

Comment thread studio/setup.sh Outdated
Comment on lines +2346 to +2347
printf '[TAURI:STEP] %s\n' \
"llama.cpp unavailable; GGUF inference is disabled until 'unsloth studio update' succeeds"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Surface the degradation as a visible warning

During a full first-launch install, install.rs converts this marker into an install-step event, but the frontend listener in use-tauri-backend.ts discards the payload and only increments currentStepIndex; InstallingContent displays a fixed label from INSTALL_STEPS, not the emitted text. The successful exit then immediately starts the backend and leaves the setup screen, so users are never actually told that GGUF is disabled or how to repair it even though the install is now recorded as successful; emit or persist this through a warning channel that the post-install UI displays.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Right, and worse than I thought. install.rs maps [TAURI:STEP] to install-step, and use-tauri-backend.ts only increments a counter without ever storing the payload, so the text was discarded. install.sh already emits exactly 7 unique STEP markers against the 7-entry INSTALL_STEPS list, so an eighth rendered "Step 8 of 7". Switched to [TAURI:PROGRESS] in 2637490, which becomes install-progress-detail and is rendered verbatim on the installing screen. New test asserts the notice never emits [TAURI:STEP].

Comment thread studio/setup.sh
case "${UNSLOTH_TAURI_MODE:-0}" in
1|true)
printf '[TAURI:STEP] %s\n' \
"llama.cpp unavailable; GGUF inference is disabled until 'unsloth studio update' succeeds"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include GGUF export in the disabled-feature notice

When this branch is reached on a fresh install after both the prebuilt and source fallback fail, the llama.cpp directory also lacks llama-quantize, not just llama-server. setup.sh installs that binary for the GGUF export pipeline, and unsloth/save.py::check_llama_cpp raises when it is absent, so the successful degraded install disables normal quantized GGUF exports as well as inference. Reporting only that inference is disabled misleads users into expecting Studio's advertised GGUF export workflow to work; name both unavailable capabilities in the recovery notice.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not taking this one. GGUF export self-heals: unsloth/save.py wraps check_llama_cpp() in try/except and falls back to install_llama_cpp(), so an export run installs what it needs on demand. Only llama-server inference has no fallback, which is what the notice already says. Naming export here would tell the user something is broken when it is not.

Two problems with the first version, both found in review.

The notice used [TAURI:STEP], which is the wrong channel twice over. install.rs
maps it to install-step, and use-tauri-backend.ts counts those without ever
storing the payload, so the text was thrown away. Worse, install.sh already
emits exactly seven unique STEP markers against the seven-entry INSTALL_STEPS
list, so an eighth pushed the counter past the end and rendered 'Step 8 of 7'.
[TAURI:PROGRESS] becomes install-progress-detail, which the installing screen
renders verbatim.

Windows had the identical defect and was not covered. install.ps1 sets both
SKIP_STUDIO_BASE=1 and UNSLOTH_TAURI_MODE, then turns any non-zero setup.ps1
status into Exit-InstallFailure, which install.rs reports as 'Installation
failed'. setup.ps1 now gates on UNSLOTH_TAURI_MODE the same way Exit-SetupFailure
already does, and still fails for every other caller.

Tests: 8 cases, adding one that the notice never emits [TAURI:STEP] and a
setup.ps1 block check for the Windows parity.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 263749068e

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

Comment thread studio/setup.sh
Comment on lines +2352 to +2353
printf '[TAURI:PROGRESS] %s\n' \
"llama.cpp unavailable; GGUF inference is disabled until 'unsloth studio update' succeeds"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Persist the degraded-install warning after setup

On a Tauri first-launch install where llama.cpp fails, this progress event is emitted at the very end of setup and the successful start_install invocation immediately switches the frontend to starting (use-tauri-backend.ts:363-370); progressDetail is rendered only by the installing screen (startup-screen.tsx:391-392), so the warning at best flashes briefly and then disappears while the app continues successfully. The fresh evidence in this revision is that the new notice is sent only through [TAURI:PROGRESS], without any state or post-install warning that survives that status transition; persist and display the degraded state after installation instead.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The observations about the frontend are right, but the conclusion rests on there being no other channel, and there is one. LLAMA_SERVER_NOT_FOUND_DETAIL (llama_cpp.py:131) says "This is a GGUF model, but the llama.cpp runtime (llama-server) is not installed. Run unsloth studio setup..." and is raised both at load (llama_cpp.py:7470) and in the remote-GGUF preflight before any multi-GB download (model_config.py:3114). routes/inference.py:6504 and :6926 turn it into a 400 with that detail rather than a generic 500, and the chat runtime shows it as an error toast plus a native notification. So the user is told at the moment it matters, with the recovery command, and the vanishing install-time line loses no information.

Separately and worth recording: there is a real gap here, just not one this PR creates. get_update_status cannot distinguish "no llama.cpp at all" from "up to date" (both give supported=false, update_available=false), so discovery is reactive rather than proactive and the update banner never appears. Closing that needs a new missing state on the status endpoint plus UI, which is a feature and unrelated to whether setup.sh aborts or reports.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 263749068e

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

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 263749068e

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

@danielhanchen
danielhanchen merged commit 2d61c3a into main Aug 1, 2026
78 of 81 checks passed
@danielhanchen
danielhanchen deleted the pr-setup-degrade branch August 1, 2026 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant