Skip to content

Assert the Vulkan installer bailouts fail closed via the setup failure helper - #7644

Merged
danielhanchen merged 1 commit into
mainfrom
fix/setup-explicit-exits-tauri-context
Jul 31, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
fix/setup-explicit-exits-tauri-context

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Jul 30, 2026 •

Copy link
Copy Markdown
Member

What

studio/backend/tests/test_setup_llama_cpp_backend.py asserts the literal string exit 1 at the four explicit-Vulkan bailouts in studio/setup.sh and studio/setup.ps1. Those sites now abort through setup_fail / Exit-SetupFailure, so the assertions fail:

FAILED tests/test_setup_llama_cpp_backend.py::test_explicit_vulkan_prebuilt_failure_does_not_change_backend
FAILED tests/test_setup_llama_cpp_backend.py::test_explicit_vulkan_source_build_fails_closed

That takes Repo tests (CPU) down on main, and because CI builds the PR merge commit, every open PR inherits the red job.

The behaviour these tests exist to protect is unchanged: both helpers exit, so the paths still fail closed. Only the spelling moved. They now assert the helper, which covers "this path fails closed" rather than one way of writing it, and additionally checks the part that matters for the desktop app, that the failure is reported rather than silent.

Scope change

This PR originally also routed those bailouts through the helpers in studio/setup.sh and studio/setup.ps1. main has since made that change independently, and did it better by keeping the step / substep lines and using fuller messages. I have dropped my version and rebased onto main, so this is now a one-file test fix, which is the piece main is still missing.

Verification

On a pristine origin/main worktree, before this change:

  • tests/sh/test_tauri_retry_failure_context.sh passes (main fixed it)
  • studio/backend/tests/test_setup_llama_cpp_backend.py gives 2 failed, 58 passed

With this change:

  • test_setup_llama_cpp_backend.py gives 60 passed
  • tests/sh/test_tauri_retry_failure_context.sh still passes, so both invariants hold together
  • full tests/sh/ gives 27 pass; the one remaining failure, test_install_host_defaults.sh, fails identically on pristine main and is on the workflow's explicit skip list
  • ruff check studio tests unsloth_cli passes

@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: a1b2d6821e

ℹ️ 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 Outdated
if [ "$_explicit_vulkan_backend" = true ]; then
step "llama.cpp" "Vulkan was explicitly requested, so the installer will not keep the existing backend" "$C_ERR"
exit 1
setup_fail 1 "Vulkan was explicitly requested, so the installer will not keep the existing backend"

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 Keep failure text visible in non-Tauri installs

When UNSLOTH_TAURI_MODE is unset during a normal CLI installation, setup_fail intentionally prints nothing and only exits, so replacing the preceding step with this call suppresses the explanation that an explicit Vulkan request prevents retaining the existing backend. The other two new calls similarly hide their actionable detail, and Exit-SetupFailure causes the same regression in setup.ps1; retain the terminal step/substep output before routing all six exits through the helpers.

Useful? React with 👍 / 👎.

@danielhanchen

Copy link
Copy Markdown
Member Author

Pushed fb64112 to fix the two (Python 3.10) failures this introduced.

studio/backend/tests/test_setup_llama_cpp_backend.py asserted the literal string exit 1 at exactly the four sites the first commit routed through setup_fail / Exit-SetupFailure. The behaviour those tests protect is unchanged, since both helpers exit; only the spelling moved. They now assert the helper, so they check "this path fails closed" rather than one way of writing it.

That also removes a genuine contradiction: as written, those four assertions and tests/sh/test_tauri_retry_failure_context.sh could not both pass, since the latter requires every failure to route through the helper that emits [TAURI:ERROR]. That is why Repo tests (CPU) is red on main today.

Verified locally: test_setup_llama_cpp_backend.py 60 passed, test_tauri_retry_failure_context.sh passes, full tests/sh/ 27 pass, ruff clean. The one remaining tests/sh failure, test_install_host_defaults.sh, fails identically on pristine main and is on the workflow's explicit skip list.

The other red check, Core (HF=latest + TRL=latest), is unrelated to this PR: tests/utils/test_packing.py::test_enable_sample_packing fails with '_DummyTrainer' object has no attribute 'data_collator', which no installer script touches.

…exit

main routed the explicit-Vulkan bailouts in studio/setup.sh and studio/setup.ps1
through setup_fail / Exit-SetupFailure, so every failure emits [TAURI:ERROR] in
desktop mode. These four assertions still required the literal string "exit 1"
at those sites, so they now fail and take Repo tests (CPU) down with them for
every open PR.

The behaviour they exist to protect is unchanged, since both helpers exit; only
the spelling moved. Assert the helper instead, so the checks cover "this path
fails closed" rather than one way of writing it.
@danielhanchen
danielhanchen force-pushed the fix/setup-explicit-exits-tauri-context branch from fb64112 to 792c079 Compare July 30, 2026 14:05
@danielhanchen danielhanchen changed the title Route the Vulkan installer bailouts through the setup failure helper Assert the Vulkan installer bailouts fail closed via the setup failure helper Jul 30, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

Rebased and narrowed. main has independently routed the explicit-Vulkan bailouts through setup_fail / Exit-SetupFailure, and did it better than my version by keeping the step / substep lines and using fuller messages, so I dropped my studio/setup.sh and studio/setup.ps1 changes entirely. That also clears the merge conflict.

What main did not do is update the four assertions in studio/backend/tests/test_setup_llama_cpp_backend.py that require the literal exit 1 at those exact sites. So Repo tests (CPU) is still red on main, just at a different assertion than before: it traded FAIL: Unix setup has explicit exits outside setup_fail for two failing pytest cases. Verified on a pristine origin/main worktree, which gives 2 failed, 58 passed.

This PR is now that one-file fix, and with it both invariants hold together for the first time: test_setup_llama_cpp_backend.py 60 passed, tests/sh/test_tauri_retry_failure_context.sh passes.

@danielhanchen
danielhanchen merged commit 519c420 into main Jul 31, 2026
38 of 39 checks passed
@danielhanchen
danielhanchen deleted the fix/setup-explicit-exits-tauri-context branch July 31, 2026 11:31
danielhanchen added a commit that referenced this pull request Jul 31, 2026
A fourth instance of the class 9541cc5 fixed: the merge took main's
studio/setup.sh, which #7644 changed to abort through the setup_fail helper
so desktop mode still emits [TAURI:ERROR], but kept this branch's older copy
of the test, which still asserted the literal 'exit 1'. setup.sh is
byte-identical to main here and the only diff in this file was the reverted
assertions, so take main's version. 60 passed.
LeoBorcherding added a commit to LeoBorcherding/unsloth that referenced this pull request Jul 31, 2026
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