Fix P1 review issues: race condition, fast-path bypass, git revert, timestamp guard

1. Fix cold-start race in /api/update-check: if the background thread has
   not finished fetching the manifest when the endpoint is hit, do an
   inline fetch so the UI never permanently caches empty defaults.

2. Fix PyPI fast-path blocking manifest git-main installs: evaluate the
   manifest unsloth_source directive BEFORE the PyPI version check so
   users already on latest PyPI still switch to git main when directed.

3. Fix base.txt reverting git install: filter out "unsloth" from base.txt
   requirements when the git-main path is active, preventing pip/uv from
   replacing the git checkout with the PyPI wheel.

4. Guard install timestamp write: only write UNSLOTH_STUDIO_INFO.json
   when python deps were actually updated, preventing users from clearing
   a critical-update warning by re-running setup in llama-only or
   skip-python-deps mode.
This commit is contained in:
Daniel Han 2026-04-03 13:44:58 +00:00
commit a681c778bd
3 changed files with 36 additions and 14 deletions

View file

@ -534,13 +534,21 @@ def install_python_stack() -> int:
f"git+https://github.com/unslothai/unsloth.git@{_git_ref}",
constrain = False,
)
pip_install(
"Updating remaining base packages",
"--no-cache-dir",
"--upgrade-package",
"unsloth-zoo",
req = REQ_ROOT / "base.txt",
# Filter out "unsloth" from base.txt so pip does not
# revert the git install back to the PyPI wheel.
_base_no_unsloth = _filter_requirements(
REQ_ROOT / "base.txt", {"unsloth"}
)
try:
pip_install(
"Updating remaining base packages",
"--no-cache-dir",
"--upgrade-package",
"unsloth-zoo",
req = _base_no_unsloth,
)
finally:
_base_no_unsloth.unlink(missing_ok = True)
else:
# Update path: upgrade only unsloth + unsloth-zoo while preserving
# existing torch/CUDA installations. Torch is pre-installed by