Studio: propagate required backend version to repair pipeline (#8610) (#8670)

* Studio: propagate required backend version to repair pipeline (#8610)

Fix second-launch infinite repair loop when installed backend version is outdated (#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 #8610

* Narrow desktop repair to version propagation

* Handle version suffixes in repair fallback

---------

Co-authored-by: imagineer99 <samleejackson0@gmail.com>
Co-authored-by: Lee Jackson <130007945+Imagineer99@users.noreply.github.com>
This commit is contained in:
karan yadav 2026-08-19 23:42:22 +05:30 committed by GitHub
parent 92d3f87055
commit dc26127a42
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 231 additions and 19 deletions

View file

@ -767,3 +767,29 @@ class TestBuildPipCmdUpgradeIntent:
def test_commands_without_the_flag_are_untouched(self):
cmd = ips._build_pip_cmd(("--no-cache-dir", "somepackage"))
assert cmd == [sys.executable, "-m", "pip", "install", "--no-cache-dir", "somepackage"]
class TestDesktopBackendVersionConstraint:
"""Verify that UNSLOTH_DESKTOP_BACKEND_VERSION adds the floor pin when upgrading unsloth."""
def test_spec_includes_floor_when_env_set(self):
with mock.patch.dict(os.environ, {"UNSLOTH_DESKTOP_BACKEND_VERSION": "2026.8.15"}):
desktop_min_ver = os.environ.get("UNSLOTH_DESKTOP_BACKEND_VERSION", "").strip()
package_name = "unsloth"
unsloth_spec = (
f"{package_name}>={desktop_min_ver}"
if (desktop_min_ver and package_name == "unsloth")
else package_name
)
assert unsloth_spec == "unsloth>=2026.8.15"
def test_spec_bare_when_env_unset(self):
with mock.patch.dict(os.environ, {}, clear = True):
desktop_min_ver = os.environ.get("UNSLOTH_DESKTOP_BACKEND_VERSION", "").strip()
package_name = "unsloth"
unsloth_spec = (
f"{package_name}>={desktop_min_ver}"
if (desktop_min_ver and package_name == "unsloth")
else package_name
)
assert unsloth_spec == "unsloth"