Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio update: stop size-checking the managed Windows launcher (#16901)
Debojyoti Banerjee6c89d20c9749
diff --git a/studio/install_manifest.py b/studio/install_manifest.pyindex 6dad642e354..c3ac7207d68 100644--- a/studio/install_manifest.py+++ b/studio/install_manifest.py@@ -1155,6 +1155,17 @@ _STAGED_LAUNCHER_SUFFIXES = (".update-stale", ".update-backup", ".deleteme")_INSTALLER_REWRITTEN_NAMES = frozenset(("package-lock.json",))++def _restored_launcher(parts: Sequence[str]) -> bool:+ """The managed Windows launcher: an update may restore an older, smaller uv trampoline (#16897)."""+ return (+ len(parts) >= 2+ and ".." in parts+ and parts[-2].lower() == "scripts"+ and parts[-1].lower() == _STAGED_LAUNCHER_NAME+ )++# `npm run build` rehashes every asset, so RECORD names files our setup deleted._INSTALLER_REGENERATED_TREES = (("studio", "frontend", "dist"),)@@ -1339,6 +1350,7 @@ def _scan_payload_files(and row[2]and row[2].isdigit()and parts[-1] not in _INSTALLER_REWRITTEN_NAMES+ and not _restored_launcher(parts)and info.st_size < int(row[2])):found.append(f"{rel} is {info.st_size} bytes, expected {row[2]}")diff --git a/tests/studio/install/test_install_manifest_damage.py b/tests/studio/install/test_install_manifest_damage.pyindex 660104b822f..cd88d8da396 100644--- a/tests/studio/install/test_install_manifest_damage.py+++ b/tests/studio/install/test_install_manifest_damage.py@@ -600,6 +600,26 @@ def test_a_launcher_with_nothing_staged_beside_it_is_still_damage(site_packages)assert install_manifest.damaged_payload_files(PKG) == ["../Scripts/unsloth.exe is missing"]+def test_a_launcher_restored_from_an_older_copy_is_not_damage(site_packages):+ """#16897: an update restored an older uv trampoline, shorter than RECORD says."""+ launcher = _launcher_case(site_packages)+ launcher.write_bytes(b"MZ")+ assert install_manifest.damaged_payload_files(PKG) == []+++def test_another_shortened_console_script_is_still_damage(site_packages):+ """Only the launcher the update restores loses its size check."""+ venv = site_packages.parent+ (venv / "pyvenv.cfg").write_text("home = /usr\n", encoding = "utf-8")+ dist_info = _dist(site_packages)+ size = _write(venv / "Scripts" / "demo.exe", "MZ binary\n")+ _record(dist_info, [["../Scripts/demo.exe", "sha256=b", size]])+ (venv / "Scripts" / "demo.exe").write_bytes(b"MZ")+ assert install_manifest.damaged_payload_files(PKG) == [+ f"../Scripts/demo.exe is 2 bytes, expected {size}"+ ]++def test_an_unrelated_sibling_does_not_excuse_a_missing_file(site_packages):"""Only the three names `_recover_missing_launcher` reads count."""launcher = _launcher_case(site_packages)diff --git a/unsloth_cli/_studio_deps.py b/unsloth_cli/_studio_deps.pyindex ce491977449..9a1c9ce0d1f 100644--- a/unsloth_cli/_studio_deps.py+++ b/unsloth_cli/_studio_deps.py@@ -450,6 +450,8 @@ _SHARED_NON_RUNTIME_ROOTS = frozenset(# setup.ps1/setup.sh run `npm install` inside the installed tree, shrinking the lockfile._INSTALLER_REWRITTEN_NAMES = frozenset(("package-lock.json",))+_MANAGED_LAUNCHER_NAME = "unsloth.exe"+def _shared_non_runtime(rel: str) -> bool:"""A row under a top-level dir several wheels write into.@@ -475,8 +477,22 @@ def _installer_rewritten(rel: str) -> bool:Only the size is unreliable. The file disappearing is still damage, so therow is kept and only its size dropped.++ So does the managed Scripts/unsloth.exe: when setup publishes none, the update+ restores a staged copy an older uv may have written with a smaller trampoline+ than RECORD records (#16897). validate_launcher() already runs it."""- return rel.replace("\\", "/").rsplit("/", 1)[-1] in _INSTALLER_REWRITTEN_NAMES+ parts = [p for p in rel.replace("\\", "/").split("/") if p and p != "."]+ if not parts:+ return False+ if parts[-1] in _INSTALLER_REWRITTEN_NAMES:+ return True+ return (+ len(parts) >= 2+ and ".." in parts+ and parts[-2].lower() == "scripts"+ and parts[-1].lower() == _MANAGED_LAUNCHER_NAME+ )def _installed_distribution_groups():diff --git a/unsloth_cli/tests/test_studio_update_verify.py b/unsloth_cli/tests/test_studio_update_verify.pyindex 5c92ba673c2..4028670988c 100644--- a/unsloth_cli/tests/test_studio_update_verify.py+++ b/unsloth_cli/tests/test_studio_update_verify.py@@ -738,3 +738,35 @@ def test_our_own_runtime_trees_are_still_checked(site):(site / "unsloth_zoo" / "tests" / "helper.py").unlink()found = _deps().damaged_installed_files()assert len(found) == 1 and "unsloth_zoo/tests/helper.py is missing" in found[0]+++def test_a_launcher_restored_from_an_older_copy_is_not_damage(site):+ # #16897: the update put back an older uv trampoline, shorter than the RECORD the newest uv wrote.+ launcher = "../Scripts/unsloth.exe"+ _make_dist(+ site,+ "unsloth",+ {"unsloth/__init__.py": b"u\n", launcher: b"MZ" + b"\0" * 40979},+ record_sizes = {launcher: 47104},+ )+ assert _deps().damaged_installed_files() == []+++def test_a_missing_launcher_is_still_damage(site):+ launcher = "../Scripts/unsloth.exe"+ _make_dist(site, "unsloth", {"unsloth/__init__.py": b"u\n", launcher: b"MZ" * 10})+ (site / launcher).unlink()+ found = _deps().damaged_installed_files()+ assert len(found) == 1 and "Scripts/unsloth.exe is missing" in found[0]+++def test_only_the_managed_launcher_loses_its_size_check(site):+ other = "../Scripts/hf.exe"+ _make_dist(+ site,+ "huggingface_hub",+ {"huggingface_hub/__init__.py": b"h\n", other: b"MZ" * 10},+ record_sizes = {other: 47104},+ )+ found = _deps().damaged_installed_files()+ assert len(found) == 1 and "Scripts/hf.exe is 20 bytes, expected 47104" in found[0]