Repository navigation
Resolve compatible Unsloth and Zoo pairs for all no-torch installs - #16157
Conversation
…path The pair probe resolves unsloth with its zoo floor, but the success branch returned the unsloth>= floor. The no-torch install is --no-deps, so it then picked the newest unsloth even when the index lacked that release's unsloth-zoo. Pin the resolved unsloth there; the with-deps path keeps the floor.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
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". |
…o pair (#16532) ## Summary Since #16157 (`95aae40bb4`), three installer tests fail on main. On staging CI, `Repo tests (CPU, studio-install)` failed on #16423, #16182 and #16523 in the last hour: ``` tests/studio/install/test_ca_trust_floor.py::test_the_full_pass_raises_the_floor_in_both_modes[no-torch-update] tests/python/test_no_torch_filtering.py::TestInstallPythonStackSubprocessMock::test_update_path_intel_macos_still_skips_overrides tests/python/test_no_torch_filtering.py::TestInstallPythonStackSubprocessMock::test_update_path_intel_macos_still_skips_triton studio/install_python_stack.py:10044: in _desktop_unsloth_spec E RuntimeError: Could not resolve a compatible unsloth / unsloth-zoo pair for no-torch mode ``` #16157 makes every no-torch install pin a compatible Unsloth / Zoo pair, read from wheel metadata by `_no_torch_pair`, and refuse when none resolves. That is deliberate, and its own tests cover it with real offline wheels. The refusal can only trigger when the feed cannot serve Unsloth's metadata, and then the no-deps install would fail anyway, so I left the product as it is. All three failing tests run `install_python_stack()` through `TestInstallPythonStackSubprocessMock._capture_install`, which mocks every `subprocess.run` to return 0 and write nothing. The pair probe then finds no installed metadata and returns `None`, so every no-torch update path through this harness now stops before reaching what the test checks: the CA trust floor, and the Intel macOS override and triton skips. ## Change `tests/python/test_no_torch_filtering.py`: `_capture_install` also patches `ips._no_torch_pair` to return a resolved pair, modelling a feed that serves one, as a real index does. No assertion changes. The pair logic itself stays covered by `tests/python/test_desktop_unsloth_spec_no_deps_pair.py`, which runs the real probe against real wheels. ## Testing - `tests/python/test_no_torch_filtering.py`, `tests/studio/install/test_ca_trust_floor.py`, `tests/python/test_install_python_stack.py` and `tests/python/test_desktop_unsloth_spec_no_deps_pair.py`: - main: 3 failed, with the error above; - this branch: 423 passed, 3 skipped.
## Summary Since #16157 (`95aae40bb4`), `Repo tests (CPU, studio)` fails on unrelated PRs. It reproduces on current main, and on staging CI it hit #15159 at 07:09Z, after the other studio guard fixes landed: ``` tests/studio/test_pwsh_calls_use_the_shared_runner.py::TestEveryPwshCallUsesTheSharedRunner::test_no_test_file_spawns_powershell_directly E AssertionError: these test files start PowerShell through subprocess instead of run_pwsh from tests/_shared/unsloth_pwsh_runner.py ... E tests/python/test_desktop_unsloth_spec_no_deps_pair.py:175: subprocess.run(...) ``` #16157 added `test_desktop_unsloth_spec_no_deps_pair.py`. Its `installer_pair` fixture runs the real `install.sh` and `install.ps1` pair resolvers, and the PowerShell leg called `subprocess.run` directly. The guard is right. Under `-n 4`, a direct spawn shares one PowerShell startup cache with every other xdist worker and can die at startup with `Stack overflow.`. The installer change in #16157 is fine and nothing in it changes here. ## Change `tests/python/test_desktop_unsloth_spec_no_deps_pair.py` only. The PowerShell leg now goes through `run_pwsh`, which gives it a per-worker startup cache and retries an interpreter crash. The `sh` leg still uses `subprocess.run`. Arguments, timeout and env (including the empty `PATH` for the selected-uv case) are unchanged. ## Testing - `tests/studio/test_pwsh_calls_use_the_shared_runner.py`: - main: 1 failed, 5 passed (the error above); - this branch: 6 passed. - `tests/python/test_desktop_unsloth_spec_no_deps_pair.py` with `pwsh` installed: 22 passed, 2 skipped (the two skips are the non-PowerShell params of the selected-uv test). All six PowerShell cases run and pass through `run_pwsh`.
) ## Summary `Repo tests (CPU, studio-install)` is still red on main after #16532. That PR fixed the shared no-torch harness in `test_no_torch_filtering.py`. A second test class has the same problem: it runs `install_python_stack()` in no-torch mode with `subprocess.run` mocked. It failed on #16534 and #16527, both of which ran on top of #16532: ``` tests/studio/install/test_rocm_support.py::TestProgressStepCountMatchesTotal::test_progress_reaches_total_without_torch[linux-False] tests/studio/install/test_rocm_support.py::TestProgressStepCountMatchesTotal::test_progress_reaches_total_without_torch[windows-False] tests/studio/install/test_rocm_support.py::TestProgressStepCountMatchesTotal::test_progress_reaches_total_without_torch[macos_arm-False] E RuntimeError: Could not resolve a compatible unsloth / unsloth-zoo pair for no-torch mode ``` The cause is the same as in #16532. Since #16157, a no-torch install resolves a compatible Unsloth / Zoo pair from wheel metadata, and it refuses only when the feed has no such pair. That is right for users, since such an install would fail anyway. `_run_stack` mocks `subprocess.run` to return nothing, so the probe finds no metadata and the full-pass (`SKIP_STUDIO_BASE=0`) cases stop before they reach the progress count they check. ## Change `tests/studio/install/test_rocm_support.py`, `TestProgressStepCountMatchesTotal._run_stack` only: `_no_torch_pair` returns a compatible pair, which models a feed that serves one. This is the same model as #16532. `NO_TORCH` and the new patch share one `patch.multiple`. That `with` statement already holds 20 context managers, which is Python's limit on nested blocks: a 21st `patch.object` makes the whole file fail to import with `SyntaxError: too many statically nested blocks`. The patched values are otherwise unchanged. ## Testing `tests/studio/install/test_rocm_support.py`: - main: 3 failed, 686 passed (the three cases above); - this branch: 689 passed, 2 skipped. I also ran `tests/studio/install` plus `tests/python` on this branch. "Could not resolve a compatible" no longer appears anywhere. 22 other tests fail locally, in `test_dependency_pass_skips.py` and `test_e2e_no_torch_sandbox.py`, and they fail the same way on main here. CI passes them in the same shard, so the cause is this host's environment.
## Summary `tests/studio/install/test_mlx_install.py::test_mlx_install_respects_platform_mode_and_pins` fails its 8 `*-gguf_only-update-*` cases whenever the runner cannot reach the package index: ``` RuntimeError: Could not resolve a compatible unsloth / unsloth-zoo pair for no-torch mode ``` This has shown up on the cross-platform staging runs (Ubuntu and macOS legs). ## Cause Since #16157, `_desktop_unsloth_spec` in no-torch mode calls `_no_torch_pair`, which resolves the unsloth / unsloth-zoo pair against the live index. The `_run_to_extras` helper stubs every other installer side effect (`run`, `pip_install`, `_bootstrap_uv`, the torch ensure steps), but not this one. The no-torch update cases therefore make a real resolver call, and a `None` from it aborts the install before the step ordering being tested is reached. The installer behaviour is correct. The test was missing a stub. ## Fix Stub `_no_torch_pair` in the helper with the same fixed pair the other suites use (`("2026.11.1", "2026.11.1", 0)`, as in `tests/python/test_no_torch_filtering.py` and `tests/studio/install/test_rocm_support.py`). The resolver keeps its own coverage in `tests/python/test_desktop_unsloth_spec_no_deps_pair.py`. ## Verification With the index made unreachable (`PIP_INDEX_URL`/`UV_INDEX_URL`/`UV_DEFAULT_INDEX` pointed at `127.0.0.1:9`, `UV_OFFLINE=1`, `PIP_NO_INDEX=1`): | Tree | Result | |---|---| | main | 8 failed, 66 passed | | this branch | 74 passed | With network access, this branch also passes 74 out of 74. `ruff` is clean.
No-torch installs could choose Unsloth and Unsloth Zoo independently, leaving a newer backend beside a Zoo version that does not satisfy its requirement. This affected the Python updater without a Desktop version variable and the fresh/migrated POSIX and PowerShell installers as well as Desktop updates.
Resolve and pin the compatible pair from package metadata before the no-deps installation. The resolver inspects only Unsloth and Zoo in disposable target directories, follows Unsloth's Zoo requirement, and backtracks when the feed lacks the required Zoo. It does not resolve or download training dependencies, so a feed without Torch wheels still works. The Python updater also supports its pip fallback and reuses the installer hash policy. PowerShell passes its selected uv executable to the probe, including when it is outside PATH. With-dependencies installation retains its existing behavior.
The bootstrap installers embed the same resolver because their core packages have not been installed yet; an AST parity check keeps those copies synchronized. Existing Desktop feed-ceiling marker fields and recovery behavior are preserved.
Validation:
5d2de26d0: native macOS 15 passes 332 tests (3 explicit skips); native Windows passes 327 tests (8 explicit skips); Linux passes its scoped suite.