Repository navigation
Studio: fix Windows desktop updates failing integrity checks - #8185
Conversation
|
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". |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2985f116a4
ℹ️ 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".
| if not _exact_distribution_spec_is_installed(_torchao_spec): | ||
| _torchao_args.insert(0, "--force-reinstall") |
There was a problem hiding this comment.
Reinstall torchao after downgrading einx
On Windows installations that already have einx 0.4.3, the preceding extras step downgrades it to <0.4.3; uninstalling 0.4.3 removes the shared test/conftest.py that torchao also records. If the selected torchao pin itself has not changed, this condition suppresses the reinstall that would restore that file, so the verifier embedded in desktop 0.1.901 can still reject the update—now for a missing torchao file. Account for the einx downgrade when deciding whether torchao needs replacement.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not reproducible. I audited the published torchao 0.14.0, 0.16.0, and 0.17.0 wheels: none records test/conftest.py, and none shares a file path with einx 0.4.3. I also reproduced the exact torchao 0.17.0 + einx 0.4.3 -> einx 0.4.2 sequence in a fresh Windows venv; importlib.metadata reported zero missing files for both distributions afterward. The downgrade therefore does not damage torchao, so reinstalling an unchanged torchao pin is unnecessary.
There was a problem hiding this comment.
Confirmed the rejection for every torchao version this installer can currently select, and I checked the wheels directly rather than the metadata alone.
torchao 0.14.0 / 0.16.0 / 0.17.0 do ship a top level test/ tree (0.17.0's py3-none-any wheel records 59 entries under it), but the intersection with einx 0.4.3's file list is empty, so uninstalling or downgrading einx removes nothing torchao's RECORD claims. einx 0.4.2 ships no top level test/ at all, which is what makes the Windows pin a real fix rather than a reordering. So no reinstall is needed after the downgrade at this head.
One caveat worth pinning down in the code: torchao 0.18.0 does record test/conftest.py, which is an exact collision with einx 0.4.3. It is unreachable today because _select_torchao_spec tops out at 0.17.0, but the collision comes back the moment that table is bumped. A short note on _TORCHAO_TORCH_211_PLUS_SPEC saying why 0.17.0 is the ceiling would stop the next bump from walking back into this.
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. 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". |
|
Reviewed and reproduced this independently. The fix is correct on both halves. Packaging`[tool.setuptools.packages.find]` has no `namespaces` key, so setuptools uses namespace discovery and picks up cache directories that have no `init.py`. Built a wheel from `origin/main` and from this head, with a generated cache present at both the top level and under `studio/backend/`:
The `.unsloth_compiled_cache` pattern does catch the nested one, since setuptools matches fnmatch against the full dotted name and `*` spans dots. einxChecked the published wheels rather than the changelog. einx 0.4.3 ships a top level `test/` tree including `test/conftest.py`; einx 0.4.2 ships no top level `test/` at all. So the Windows pin removes the shared tree outright instead of reordering around it. Markers evaluate as intended: `win32` gets `<0.4.3`, everything else stays unpinned. torchao`_installed_distribution_version` reads in process metadata, and both `_build_pip_cmd` and `_build_uv_cmd` install into `sys.executable`, so the version it reads is the venv being written to. The regex only matches bare `name==version`, which every `TORCHAO*_SPEC` is, and anything unparseable falls through to force reinstall, which is the safe direction. Two things worth a follow up, neither blocking:
Tests`test_torchao_select.py` 29 passed, `test_studio_update_verify.py` 48 passed, `test_no_torch_filtering.py` 64 passed, full `tests/studio/install/` 1705 passed. Ruff clean on the changed files. CIThe red checks are not from this PR. Core fails in `unsloth_zoo @ main` on `tests/test_generated_fullgraph_fallback.py`, which is failing on main too, and the Windows Chat UI failure is a Playwright click timeout on the floating monitor Close button, also red on main for the last several runs. Worth knowing that Wheel CI and Backend CI were both cancelled on this head, so the wheel content check that guards this PR never actually ran. My local build covers it and I am running the full matrix on a staging replica as well. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a1c608d6b2
ℹ️ 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".
| if not _exact_distribution_spec_is_installed(_torchao_spec): | ||
| _torchao_args.insert(0, "--force-reinstall") |
There was a problem hiding this comment.
Repair matching torchao installations when files are damaged
When torchao has matching version metadata but missing or truncated package files—for example after an interrupted update—this check suppresses the only reinstall, and the subsequent exact-pin install leaves the damaged distribution untouched. This also defeats the incomplete-install repair path in studio/setup.ps1, which deliberately reruns the dependency pass after verification fails, so both update retries and the Repair action can remain stuck on the same integrity error. The checked local pip install --help defines --force-reinstall as “Reinstall all packages even if they are already up-to-date”; suppress it only after validating the installed wheel's runtime files, not merely its dist-info version.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Checked both halves of this against the code at head and it does not hold up as stated.
The studio/setup.ps1 repair path this cites is the install_manifest.verify_install() gate at setup.ps1:4116. That function checks the manifest (presence, schema, recorded package version, requirement file digests) and missing_requirements(BOOT_REQUIREMENT_FILE). It does not look at any distribution's RECORD, and torchao is not a boot requirement, it is an override installed by install_python_stack.py outside the requirement files. So a damaged torchao never sets $_studioInstallIncomplete in the first place, and this change cannot defeat that loop.
The desktop verifier in unsloth_cli/_studio_deps.py does check torchao's runtime files, so that half is fair. What is missing is a way to get there: nothing in this tree damages torchao/** while leaving its dist-info reporting the exact pinned version. No other distribution claims those paths (the only overlap risk is the top level test/ tree, which _shared_non_runtime exempts), and both pip's --force-reinstall and uv's --reinstall remove the dist-info before writing files, so an interrupted install leaves _installed_distribution_version returning None and the force reinstall still fires. That leaves external damage such as antivirus quarantine, which the previous unconditional force-reinstall only fixed as a side effect of the behavior this PR is removing on purpose.
Validating the installed wheel's runtime files before suppressing the reinstall is a reasonable hardening and would keep the repair lever without reintroducing the every-update replacement that caused the shared file removal. Worth a follow up, but it is not a regression this PR introduces.
|
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". |
|
Codex Review: Didn't find any major issues. Delightful! 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". |
Summary
Fix Windows desktop updates that finish installing packages but then fail integrity verification. Keep the upgrade from desktop 0.1.901 safe while preventing generated compiled-cache files from entering the
Unsloth wheel.
Motivation
The 0.1.901 updater can fail after package replacement with errors such as:
Changes
How to test
Results:
checks passed, and the post-update verifier was clean.
Notes for reviewers
The Windows-only einx<0.4.3 constraint is an upgrade bridge for clients still running the verifier embedded in desktop 0.1.901. Newer verifier handling for shared and non-runtime wheel paths already landed in
#8179 and #8181, so this branch does not duplicate those changes.
Related
Refs #8179
Refs #8181