Repository navigation
Studio: propagate required backend version to repair pipeline (#8610) - #8670
Conversation
9e10e7d to
25f23ca
Compare
|
Codex Review: Didn't find any major issues. Keep it up! 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". |
9dfd060 to
faab4f4
Compare
faab4f4 to
94e4573
Compare
…hai#8610) Fix second-launch infinite repair loop when installed backend version is outdated (unslothai#8610). When the Desktop App launches with an installed managed venv whose version is older than expected_backend_version() (e.g. 2026.8.4 < 2026.8.15), preflight flags the install as ManagedStale with desktop_backend_version_outdated. On auto-repair, unsloth studio update ran setup.sh/setup.ps1 from the old venv, which skipped python dependency installation because INSTALLED_VER == LATEST_VER on PyPI or PyPI timeout, leaving the venv unchanged. The installer fallback (install.sh/install.ps1) also lacked version floor pins on standard fresh paths, locking the user in a permanent repair error loop. Key changes: - Pass UNSLOTH_DESKTOP_BACKEND_VERSION from Tauri (update.rs & install.rs) to child process environments. - Force Python dependency pass in setup.sh & setup.ps1 when UNSLOTH_DESKTOP_BACKEND_VERSION is set and INSTALLED_VER < UNSLOTH_DESKTOP_BACKEND_VERSION. - Apply UNSLOTH_DESKTOP_BACKEND_VERSION floor constraint when updating core packages in install_python_stack.py. - Ensure standard fresh install paths in install.sh and install.ps1 use "unsloth>=2026.8.15". - Bump MIN_DESKTOP_BACKEND_VERSION in preflight/version.rs to "2026.8.15". - Add shell and Python unit tests for the fast-path escape and desktop backend version constraint. Fixes unslothai#8610
94e4573 to
a0e610d
Compare
|
Confirmed the repair path never sees the required backend version, since expected_backend_version() in studio/src-tauri/src/preflight/version.rs is compile-time only and nothing passes it to setup.sh, so this matches the loop reported in #8610. The propagation part is right, but could you split out the hardcoded floors (the MIN_DESKTOP_BACKEND_VERSION bump and the literal date in install.sh and install.ps1) so this stays just the version propagation? |
|
Codex Review: Didn't find any major issues. 🎉 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". |
|
Addressed in 2135580: the desktop backend version is still propagated through setup and every installer path, while the minimum-version bump and non-desktop installer floor changes are removed from this PR. |
|
Codex Review: Didn't find any major issues. Keep them coming! 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". |
|
deterministic A/B results
the same probe was used for A and B and confirms stale backends now trigger the repair path correctly |
|
pre merge summary
ready to merge |
…i#9342) * Stub the two helpers the sliced harnesses started importing Backend CI's "Repo tests (CPU)" has been red on main since 588405d, with 111 failures in two files. Both are the same defect, and neither is about what the tests claim to be testing. These harnesses replay real studio source with its import block stripped, so every name the sliced region calls has to be defined in the harness. Two landed without one: refresh-context-usage.ts findLatestUserVideoBase64 (unslothai#9056, decline to price a prompt carrying video) chat-runtime-store.ts resolvePreserveThinkingOnLoad Both product changes are right. The first is the more dangerous shape: with no stub the replayed body throws a ReferenceError, the effect bails, `counts` stays 0, and the assertion reads "the empty New Chat view must be priced exactly once" -- a pricing bug that does not exist. 41 tests failed that way, and bisecting main was the only way to see it, because the message points at the wrong thing. test_chat_autoload_failure_gate.py already guards this and said exactly what was missing, which is why its 70 failures named resolvePreserveThinkingOnLoad outright. test_new_chat_context_recount.py had no such guard; it does now, built the same way -- parse the real import list, assert the harness defines each name. Mutation-tested: dropping the video stub turns it red with the name in the message. The preserve-thinking stub is the real resolver's rule verbatim, since no scenario here sets a stored preference. tests/studio: 0 failures, from 111. * Count nesting when finding install.sh's GPU-detection fallback With the harness stubs in place, Repo tests (CPU) is down to one failure, and it is the last of the same kind: correct product code reported as a defect by a scan that reads the file too loosely. test_no_torch_backend_auto_outside_fallback allows --torch-backend=auto only inside install.sh's "GPU detection failed" branch, and located the end of that branch as the first line equal to `fi` after the comment. unslothai#8670 put a `case` into the branch to choose the desktop install spec, with an `if`/`fi` inside one of its arms. That `fi` is now the first one, so the block ended four lines early and the branch's own install call -- line 5280, the one the test exists to permit -- was reported as a primary path using the flag. The end is now found by counting nesting. `case` counts too: it closes with `esac`, so an `if`/`fi` inside a case arm would still throw off a counter that only tracked `if`. Added test_the_fallback_range_reaches_the_end_of_the_branch, because the bug here was in the range and not in what the range was used for, so nothing was checking the range itself. It pins both ends: the block contains the branch's first `if` and both of its --torch-backend=auto calls, and does not run past its closing `fi`. Mutation-tested both ways. Adding --torch-backend=auto outside the branch still fails the original assertion; reverting the nesting count to the first-`fi` behaviour fails the new one. tests/python/test_cross_platform_parity.py 78 passed. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Summary
Fixes an issue where the Unsloth Desktop app gets stuck in an infinite auto-repair loop on startup when the installed managed venv version is older than the app's
expected_backend_version()(e.g.2026.8.4installed vs2026.8.15expected).Fixes #8610
Root Cause
ManagedStale(desktop_backend_version_outdated), auto-repair executesunsloth studio updatefrom the installed venv. In older venvs,setup.sh/setup.ps1checked ifINSTALLED_VER == LATEST_VERfrom PyPI without knowing what version the Desktop App required (UNSLOTH_DESKTOP_BACKEND_VERSION), setting_SKIP_PYTHON_DEPS=trueand skipping package installation.unsloth studio updatecompleted without upgradingunsloth, Tauri fell back to running the bundledinstall.sh/install.ps1. The standard fresh install paths used$PACKAGE_NAMEwithout a version floor (unlike_MIGRATEDandSKIP_TORCHbranches which specified"unsloth>=2026.8.15"), leaving the venv on the old version.unslothagain, sawversion < expected_backend_version(), and failed permanently with[ERROR] Repair finished, but Unsloth install is still not desktop-ready.Key Changes
UNSLOTH_DESKTOP_BACKEND_VERSIONfrom Tauri (studio/src-tauri/src/update.rsandstudio/src-tauri/src/install.rs) to child update and installer script environments.studio/setup.shandstudio/setup.ps1, added an escape in theINSTALLED_VER == LATEST_VERfast-path check: ifUNSLOTH_DESKTOP_BACKEND_VERSIONis set andINSTALLED_VER < UNSLOTH_DESKTOP_BACKEND_VERSION,_SKIP_PYTHON_DEPSis forced tofalse.studio/install_python_stack.py, appliedUNSLOTH_DESKTOP_BACKEND_VERSIONconstraint (f"unsloth>={desktop_min_ver}") when updating core packages in bothNO_TORCHand standard update paths.install.shandinstall.ps1to use"unsloth>=2026.8.15"when$PACKAGE_NAME == "unsloth".MIN_DESKTOP_BACKEND_VERSIONinstudio/src-tauri/src/preflight/version.rsto"2026.8.15".startup-screen.tsxandupdate-screen.tsxwhen clickingCopy Diagnostics.tests/sh/test_setup_desktop_backend_version_fastpath.sh(5/5 PASSED).TestDesktopBackendVersionConstraintintests/python/test_install_python_stack.py(12/12 PASSED).Test Matrix
tests/sh/test_setup_desktop_backend_version_fastpath.sh(5 PASSED)tests/sh/test_setup_xpu_fastpath_escape.sh(75 PASSED)tests/sh/test_setup_webview_cache_clear.sh(37 PASSED)tests/sh/test_install_python_guard.sh(25 PASSED)tests/python/test_install_python_stack.py(12 PASSED)tsc --noEmit) (0 errors)bash -n)