Repository navigation
Windows: unblock the consumer install on clean and no-winget machines - #7549
Conversation
Four independent things stop a clean Windows box today. git was a hard Exit-SetupFailure in setup.ps1, justified as required by pip for git+https:// deps and by npm. Neither holds on the consumer path: the unsloth-zoo git+https URL is only used under STUDIO_LOCAL_INSTALL, node is a pinned nodejs.org prebuilt that never touches system npm, and the frontend lockfile has no VCS dependencies. It stays fatal for --local, where it really is needed. Ensure-VCRedist was winget-only, so on hosts without winget (LTSC, Server, managed corporate images) it silently did nothing while the install reported success, and torch then failed to import on a missing VCRUNTIME140.dll. Adds a direct aka.ms/vs/17/release/vc_redist.<arch>.exe download with /quiet /norestart, accepting exit codes 0 and 3010. The redistributable stays required: it is the runtime the prebuilt llama-server and torch link against, not the MSVC compiler, which is already detection-only. Windows on ARM has no PyTorch at all. Measured with uv against download.pytorch.org/whl/cpu and PyPI for aarch64-pc-windows-msvc / cp313: torch, torchvision and torchaudio all resolve to nothing, wheels exist only for win_amd64 and the manylinux targets. The installer burned three uv retries on an unsatisfiable resolution and reported a bare 'Failed to install PyTorch (exit code 1)'. Now it says what is actually wrong and points at --no-torch, which works because llama.cpp does publish windows-arm64-cpu. install_node_prebuilt.py hit '[WinError 5] Access is denied' on os.replace of the freshly extracted directory during a FRESH install, which is a scanner or indexer holding handles for a moment. Retries only winerror 5, 32 and 145 with capped exponential backoff; any other OSError still raises immediately.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 97ae6c573f
ℹ️ 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".
| Refresh-Environment | ||
| } catch { substep "VCRedist install failed: $($_.Exception.Message)" "Yellow" } | ||
| } | ||
| if (-not (Test-VCRedistInstalled)) { |
There was a problem hiding this comment.
Install the ARM64 redistributable before accepting x64
On a native Windows ARM64 host where winget is available, the preceding command installs Microsoft.VCRedist.2015+.x64, and Test-VCRedistInstalled accepts the resulting x64 registry entry. This condition therefore skips the new vc_redist.arm64.exe path, leaving the recommended ARM64 --no-torch installation without the runtime required by its native llama.cpp binary. Select the winget package and validate the runtime using the target architecture rather than treating an x64 installation as sufficient.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not taking this one. The x64 redistributable ships both ARM64 and x64 binaries and installs them on an ARM64 device, so the x64 package is the correct one here. The primary probe is System32\vcruntime140_1.dll, which is arch-agnostic.
| } catch { | ||
| substep "Direct VC++ runtime download failed: $($_.Exception.Message)" "Yellow" |
There was a problem hiding this comment.
Fail setup when the required redistributable remains absent
When winget is unavailable and the direct download or installer fails—for example because of a proxy, UAC rejection, or an unavailable URL—this catch only prints a warning, and the final failed Test-VCRedistInstalled check also returns normally. The setup can consequently report success while the required runtime is still missing, so the ARM64/no-torch llama.cpp path can fail only when it is launched later. Propagate the failure after the final check instead of continuing with an unusable installation.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Leaving as a warning. Test-VCRedistInstalled is a heuristic, so making a false negative fatal would block machines that are actually fine. The llama path already exits non-zero through $script:LlamaCppDegraded, so a genuine failure is still reported.
| substep "windows-arm64 prebuilt). Re-run with --no-torch to install" | ||
| substep "that path:" | ||
| substep " .\install.ps1 --no-torch" |
There was a problem hiding this comment.
Provide a usable rerun command for streamed installs
When the documented consumer invocation irm https://unsloth.ai/install.ps1 | iex reaches this ARM64 error, no install.ps1 file is written to the current directory, so the suggested .\install.ps1 --no-torch command immediately fails with a missing-script error. Show the environment-variable form already supported by this script (for example, setting UNSLOTH_NO_TORCH before repeating the streamed command), or provide both forms so web-install users can actually follow the recovery instructions.
Useful? React with 👍 / 👎.
| $HasGit = $null -ne (Get-Command git -ErrorAction SilentlyContinue) | ||
| if (-not $HasGit) { | ||
| Write-Host "Git not found -- installing via winget..." -ForegroundColor Yellow | ||
| $gitNeeded = ($env:STUDIO_LOCAL_INSTALL -eq '1') |
There was a problem hiding this comment.
Require Git when a source fallback is selected
When a custom/forced llama.cpp source build is requested, or when the prebuilt download or validation falls back to a source build, STUDIO_LOCAL_INSTALL remains 0, so this condition permits setup to continue without Git. Phase 4 then unconditionally invokes git clone/git fetch, making those supported source paths fail after potentially installing the other build tools. Defer the Git installation and fatal check until $NeedLlamaSourceBuild is known, or include every source-build mode in this requirement.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
These do fail, just later. $cloneExit is $null on command-not-found, which sets $FailedStep to 'git clone' and exits non-zero under SKIP_STUDIO_BASE=1. That is fail-later ordering rather than a silent success, so I would rather not add a second gate.
The only remedy printed was .\install.ps1 --no-torch, but the documented path is irm | iex, where no file exists and flags cannot be forwarded. Name the env var the script already honours at line 145.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 89f6d90554
ℹ️ 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".
| $HasGit = $null -ne (Get-Command git -ErrorAction SilentlyContinue) | ||
| if (-not $HasGit) { | ||
| Write-Host "Git not found -- installing via winget..." -ForegroundColor Yellow | ||
| $gitNeeded = ($env:STUDIO_LOCAL_INSTALL -eq '1') |
There was a problem hiding this comment.
Require Git before entering the source-build fallback
When STUDIO_LOCAL_INSTALL is 0 but a custom/forced source build is requested, or the prebuilt llama.cpp installation fails and sets $NeedLlamaSourceBuild, this gate permits setup to continue without Git. Phase 4 then unconditionally invokes git clone; moreover, Invoke-SetupCommand initializes LASTEXITCODE to zero, so a command-not-found error may be treated as a successful clone until CMake fails, after which setup continues without a usable llama-server. Recheck Git when a source build is selected rather than treating only --local as requiring it.
Useful? React with 👍 / 👎.
| # Without this we burn three uv retries on an unsatisfiable resolution | ||
| # and report a bare "Failed to install PyTorch", reading as a network | ||
| # fault rather than a platform upstream does not build for. | ||
| if ((Get-TauriDiagArch) -eq "arm64") { |
There was a problem hiding this comment.
Check the target Python architecture instead of PowerShell
On Windows ARM64, Get-TauriDiagArch reads PROCESSOR_ARCHITECTURE, which describes the current PowerShell process, while Find-CompatiblePython can select an interpreter of a different architecture. Thus an x64 PowerShell process targeting native ARM64 Python bypasses this guard and still reaches the unsatisfiable wheel resolution, while native PowerShell targeting an emulated x64 Python is incorrectly rejected even though win_amd64 wheels match that interpreter. Determine the wheel platform from $VenvPython (for example via sysconfig.get_platform()) rather than from the installer process.
Useful? React with 👍 / 👎.
| if (-not $HasGit) { | ||
| Write-Host "Git not found -- installing via winget..." -ForegroundColor Yellow | ||
| $gitNeeded = ($env:STUDIO_LOCAL_INSTALL -eq '1') | ||
| Write-Host "Git not found -- attempting install via winget..." -ForegroundColor Yellow |
There was a problem hiding this comment.
Skip Git installation on the consumer path
When Git is absent but winget is available, a normal consumer install still executes winget install Git.Git even though $gitNeeded is false; that variable only controls whether failure is fatal afterward. Consequently the change still installs an unused system-wide package, potentially prompting for elevation and delaying setup, despite the new consumer path explicitly declaring Git unnecessary. Gate the winget installation on $gitNeeded, or defer it until a source-build fallback is actually selected.
Useful? React with 👍 / 👎.
The fail-fast was based on a wrong premise. Counted against download.pytorch.org/whl/cpu: torch has 42 win_arm64 wheels and torchvision 60; only torchaudio has none. PyTorch has shipped Arm-native Windows builds since April 2025, so aborting blocked a platform that mostly works. Drop the one unsatisfiable pin instead. Decide from the interpreter uv will resolve for, not the PowerShell host: an x64 CPython under emulation gets working win_amd64 wheels on an ARM64 box, and powershell.exe inherits PROCESSOR_ARCHITECTURE from its parent.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 65ebcb77ca
ℹ️ 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 ($VenvPlatform -eq "win-arm64") { | ||
| substep "windows on arm: skipping torchaudio (upstream publishes no" | ||
| substep "win_arm64 wheel); torch and torchvision install normally." | ||
| $_torchSpecs = @("torch>=2.4,<2.11.0", $_pinVisionSpec) |
There was a problem hiding this comment.
Carry the ARM64 omission into studio setup
On native Windows ARM64, this only removes torchaudio from the first PyTorch command. The same installation later sets SKIP_STUDIO_BASE=1 and launches studio setup (install.ps1 lines 2664-2694); that leaves $SkipPythonDeps false, and studio/setup.ps1 lines 3284-3316 unconditionally runs Fast-Install with torchaudio from the CPU index and aborts when resolution fails. Consequently the normal ARM64 path still cannot complete; the downstream setup dependency pass must preserve the ARM64 torchaudio omission as well.
Useful? React with 👍 / 👎.
Dropping it from the first PyTorch command was not enough: install.ps1 then runs studio setup with SKIP_STUDIO_BASE=1 and setup.ps1 reinstalls the bare trio from the CPU index, so the ARM64 path still aborted. Apply the same interpreter-based test there. An unreadable platform keeps the full trio.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e6769e8fac
ℹ️ 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".
| try { | ||
| $_setupPlatform = (& python -c "import sysconfig; print(sysconfig.get_platform())" 2>$null | Out-String).Trim().ToLowerInvariant() | ||
| } catch { $_setupPlatform = "" } | ||
| $_torchTrio = @($cpuTorchSpec, $cpuVisionSpec, $cpuAudioSpec) |
There was a problem hiding this comment.
Initialize the package list before branching on verbosity
When UNSLOTH_VERBOSE is unset—the default—the initialization of $_torchTrio is skipped because it is inside the verbose branch, but the else branch still splats that undefined variable. On every CPU dependency pass, Fast-Install therefore invokes uv pip install with only --index-url; uv's usage requires a package, requirements, editable, or group operand, so setup exits nonzero instead of installing PyTorch. Move the platform detection and package-list construction before the verbosity condition.
Useful? React with 👍 / 👎.
|
Evidence for the git removal in this PR, from the clean-machine Windows leg. Until now that leg could not test anything: it scrubbed PATH only, and the install The Python bootstrap works. With no toolcache present, install.ps1 took the path it Then it stopped on exactly what this PR removes: That is a clean no-winget Windows machine, with Python and uv bootstrapped |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e6769e8fac
ℹ️ 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".
| $_setupPlatform = "" | ||
| try { | ||
| $_setupPlatform = (& python -c "import sysconfig; print(sysconfig.get_platform())" 2>$null | Out-String).Trim().ToLowerInvariant() | ||
| } catch { $_setupPlatform = "" } | ||
| $_torchTrio = @($cpuTorchSpec, $cpuVisionSpec, $cpuAudioSpec) |
There was a problem hiding this comment.
Initialize the torch package list before the verbosity branch
On the default non-verbose CPU path (including a ROCm-to-CPU fallback), this branch is skipped, so $_torchTrio is never initialized before the else invokes Fast-Install @_torchTrio. The installer consequently passes only --index-url and optional force flags to uv/pip, causing PyTorch installation and Studio setup to fail; move the platform detection and package-list construction before if ($script:UnslothVerbose).
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Genuine, and already fixed in 4080271: $_torchTrio is assigned at studio/setup.ps1:3313 and the verbosity branch starts at 3318, so the default path no longer splats an unassigned variable.
| $HasGit = $null -ne (Get-Command git -ErrorAction SilentlyContinue) | ||
| if (-not $HasGit) { | ||
| Write-Host "Git not found -- installing via winget..." -ForegroundColor Yellow | ||
| $gitNeeded = ($env:STUDIO_LOCAL_INSTALL -eq '1') |
There was a problem hiding this comment.
Require Git when selecting the llama.cpp source fallback
On a machine where Git cannot be installed, this treats it as required only for STUDIO_LOCAL_INSTALL, but the same normal consumer run can later select a source build when UNSLOTH_LLAMA_FORCE_COMPILE=1 or the prebuilt installation fails. That path reaches the git clone commands around lines 4328–4407 with no Git executable and cannot perform its advertised fallback; retain the nonfatal consumer prebuilt path, but add a fatal/lazy Git check when $WillBuildLlamaFromSource becomes true.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Already answered in 3666048998.
| $arch = if ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64') { 'arm64' } else { 'x64' } | ||
| $url = "https://aka.ms/vs/17/release/vc_redist.$arch.exe" |
There was a problem hiding this comment.
Select the VC runtime for the venv architecture
When native ARM64 Python is used from an x64 PowerShell process under emulation, PROCESSOR_ARCHITECTURE is AMD64, so this downloads the x64 redistributable even though the newly supported win-arm64 torch wheels require the ARM64 runtime. The same change already avoids using this environment variable for wheel selection for precisely this reason; derive the redistributable architecture from the target interpreter as well, otherwise a clean ARM machine can finish the runtime step and still fail to import torch with a missing ARM64 VCRUNTIME DLL.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Answered in 3666046911. The premise is right that PROCESSOR_ARCHITECTURE reflects the process rather than the machine, but the pairing is not producible here: Install-PythonFromPythonOrg picks its interpreter from the same Get-TauriDiagArch (install.ps1:44-56, 1183-1189), so shell and interpreter architecture agree.
The ARM64 guard landed inside `if ($script:UnslothVerbose)`, so on the default path $_torchTrio was never assigned and the splat expanded to nothing: uv ran as `uv pip install --index-url ...` with no package, exit 2, straight to Exit-SetupFailure. That broke the ordinary Windows install. Hoist it above the branch and use substep, which prints on both paths. Realign the two parity guards to the splat form; they asserted the pre-refactor literal command and were the actual cause of the red parity legs. Both halves are still checked: the bounded list is built, and it reaches the install.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cb2fe25e45
ℹ️ 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".
| $HasGit = $null -ne (Get-Command git -ErrorAction SilentlyContinue) | ||
| if (-not $HasGit) { | ||
| Write-Host "Git not found -- installing via winget..." -ForegroundColor Yellow | ||
| $gitNeeded = ($env:STUDIO_LOCAL_INSTALL -eq '1') |
There was a problem hiding this comment.
Require Git when selecting a llama.cpp source build
When Git is absent, this gate treats only STUDIO_LOCAL_INSTALL=1 as requiring it, but UNSLOTH_LLAMA_FORCE_COMPILE, a custom llama source/PR, or a failed prebuilt installation also set $NeedLlamaSourceBuild and later execute git clone in Phase 4. On those source-build paths the script now continues after reporting Git as unnecessary, then cannot obtain the llama.cpp source (and Invoke-SetupCommand may even return the reset $LASTEXITCODE of 0 for a command-not-found error), leaving GGUF inference/export degraded instead of failing with the actionable Git prerequisite. Recheck $HasGit when $WillBuildLlamaFromSource becomes true, rather than limiting the requirement to local package installs.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Answered in 3666048998, and the new mechanism does not hold: on command-not-found Invoke-SetupCommand (setup.ps1:1004-1032) does not return 0. The CommandNotFoundException unwinds the function, $cloneExit is $null, $null -ne 0 is true, so FailedStep becomes 'git clone' and it exits non-zero under SKIP_STUDIO_BASE=1. Reproduced in pwsh 7.6.
| if ($_setupPlatform -eq "win-arm64") { | ||
| substep "windows on arm: skipping torchaudio (no win_arm64 wheel upstream)" | ||
| $_torchTrio = @($cpuTorchSpec, $cpuVisionSpec) |
There was a problem hiding this comment.
Apply the ARM64 omission to the custom-index branch
On a native ARM64 venv with an explicit CPU mirror whose final URL leaf is not literally cpu (for example, a private /simple or /current index), $CuTag is that leaf, so this CPU-only block is skipped and execution enters the custom-index/CUDA branch below, which still installs $cudaAudioSpec. Since that branch requests torchaudio despite there being no win_arm64 wheel, setup.ps1 aborts the dependency pass even though install.ps1 successfully omitted torchaudio from the same custom index. Build the ARM64 torch spec list for every non-ROCm index path, not only the $CuTag -eq "cpu" branch.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
That else branch is reachable only with TorchIndexPinned and a leaf that is neither cpu nor a CUDA family, i.e. a hand-supplied private mirror. Windows on ARM has no CUDA and the default install resolves CuTag to cpu, so it would need a private mirror on an ARM box that also serves win_arm64 wheels. The parity ask accepted in 3666772603 is already carried in the reachable branch.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cb2fe25e45
ℹ️ 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 ($_setupPlatform -eq "win-arm64") { | ||
| substep "windows on arm: skipping torchaudio (no win_arm64 wheel upstream)" | ||
| $_torchTrio = @($cpuTorchSpec, $cpuVisionSpec) |
There was a problem hiding this comment.
Skip torchaudio in every ARM64 torch branch
On native Windows ARM64 with an explicit custom index whose leaf is not cpu (for example, a corporate mirror ending in /simple), this condition is never reached: the pinned leaf becomes $CuTag, so execution falls through to the CUDA/custom branch at line 3331, which still passes $cudaAudioSpec to Fast-Install. Since no win_arm64 torchaudio wheel exists, setup fails after install.ps1 successfully omitted it. Apply the ARM64 filtering to the spec list used by the custom-index branch as well.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, the skip only covered the CPU branch. A custom pin whose leaf is not cpu (or an nvidia-smi hit) falls through to the CUDA/custom branch, which still passed torchaudio. Fixed by hoisting the platform probe to setup.ps1:3272-3278 and filtering every torch spec list from it: ROCm at 3287-3288, CPU at 3331-3332, CUDA/custom at 3368-3369. Each list is built above the verbose branch so the splat is always assigned.
There was a problem hiding this comment.
Line numbers after the comment pass: probe at setup.ps1:3264-3272, ROCm 3282-3283, CPU 3325-3326, CUDA/custom 3361-3362. Pushed in 401f051.
| $HasGit = $null -ne (Get-Command git -ErrorAction SilentlyContinue) | ||
| if (-not $HasGit) { | ||
| Write-Host "Git not found -- installing via winget..." -ForegroundColor Yellow | ||
| $gitNeeded = ($env:STUDIO_LOCAL_INSTALL -eq '1') |
There was a problem hiding this comment.
Keep Git required for source-build paths
On a machine without Git or winget, $gitNeeded is false for supported source-build paths other than --local, including UNSLOTH_LLAMA_FORCE_COMPILE, a custom llama source/PR, and the automatic source fallback after a prebuilt download failure. Setup therefore reports Git as unnecessary, may install the source toolchain, and then reaches the unconditional git clone calls around line 4333, producing a degraded/nonzero install instead of failing at the prerequisite check. Defer this decision until $NeedLlamaSourceBuild is known or include every source-build trigger here.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Right for the explicit opt-ins. With UNSLOTH_LLAMA_FORCE_COMPILE=1, UNSLOTH_LLAMA_PR or a non-ggml-org source, setup printed git not found (not required), installed CMake plus VS Build Tools, then hit the git clone at setup.ps1:4348 and ended at build failed at: git clone (4612) with LlamaCppDegraded. Those triggers are now folded into $gitNeeded at setup.ps1:1690-1702, skipped when UNSLOTH_LOCAL_LLAMA_CPP_DIR overrides the build. The automatic fallback after a failed prebuilt download stays non-fatal on purpose: it is not knowable at the prerequisite check, and hard-failing every git-less consumer for a path that rarely runs is exactly what this PR removes.
There was a problem hiding this comment.
Line numbers after the comment pass: the gate is setup.ps1:1684-1696, the clone it protects is 4346 and the degraded exit is 4610. Pushed in 401f051.
… git for source builds Hoist the venv-interpreter platform probe above every torch branch in studio/setup.ps1 so the win_arm64 torchaudio omission applies to the ROCm, CPU and CUDA/custom paths. A pinned index whose leaf is not cpu routed an ARM64 host into the CUDA/custom branch, which still asked for torchaudio. Require git again when a llama.cpp source build is opted into up front (UNSLOTH_LLAMA_FORCE_COMPILE, UNSLOTH_LLAMA_PR / PR_FORCE, a non-upstream source). Those paths git clone in phase 4, so setup used to report git as not required, install the build toolchain, then fail at the clone. A local llama.cpp dir overrides them, and the automatic source fallback after a failed prebuilt download stays non-fatal. Also tighten the comments across the changed install paths.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 401f051d07
ℹ️ 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".
| $arch = if ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64') { 'arm64' } else { 'x64' } | ||
| $url = "https://aka.ms/vs/17/release/vc_redist.$arch.exe" |
There was a problem hiding this comment.
Select the redistributable for the chosen Python
On native ARM64 PowerShell with only an x64 Python available and no working winget, this downloads the ARM64-only redistributable even though Find-CompatiblePython accepts launchers and executables solely by version/non-Conda status, without checking their architecture (install.ps1 lines 1138–1169). The resulting venv resolves win_amd64 PyTorch and llama.cpp binaries but may lack the x64 VC runtime. Fresh evidence against the earlier “architecture pairing is not producible” rebuttal is that the current interpreter-selection code has no architecture predicate; derive this choice from the selected venv platform, or use the x64 package that supplies both x64 and ARM64 runtimes on ARM64 Windows.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and fixed in 8767660. Find-CompatiblePython (install.ps1:1130-1175) selects on version and non-Conda status only, with no architecture predicate, so a native ARM64 shell can settle on an emulated x64 Python whose win_amd64 torch and llama-server need the x64 runtime. setup.ps1:906 now drops the PROCESSOR_ARCHITECTURE branch and always fetches vc_redist.x64.exe: Microsoft documents that package as the Arm64X superset containing both ARM64 and x64 binaries, so it is right on both machines, it matches the winget branch at :899 which already installs Microsoft.VCRedist.2015+.x64, and it matches the manual instruction at :928. Probing the venv was not an option here, since Ensure-VCRedist runs at :1727, long before the venv exists.
…allback The winget branch always installs Microsoft.VCRedist.2015+.x64, but the direct-download fallback picked the package from PROCESSOR_ARCHITECTURE, which reports the architecture of the running PowerShell process rather than the interpreter that will load the DLLs. Find-CompatiblePython in install.ps1 selects an interpreter on version and non-Conda status alone, with no architecture predicate, so a native ARM64 shell can settle on an emulated x64 Python whose win_amd64 torch and prebuilt llama-server need the x64 runtime, while the fallback had just installed the ARM64-only package. Ensure-VCRedist also runs well before the venv exists, so the interpreter cannot be probed at that point. Microsoft ships the x64 redistributable as an Arm64X superset that carries both ARM64 and x64 binaries, so it is correct on both machines and the manual instruction printed on failure already pointed at it.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8767660131
ℹ️ 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 ($VenvPlatform -eq "win-arm64") { | ||
| substep "windows on arm: skipping torchaudio (upstream publishes no" | ||
| substep "win_arm64 wheel); torch and torchvision install normally." | ||
| $_torchSpecs = @("torch>=2.4,<2.11.0", $_pinVisionSpec) |
There was a problem hiding this comment.
Gate audio workflows when omitting torchaudio
When the selected interpreter reports win-arm64, this leaves torchaudio unavailable, but Studio still exposes workflows that import it unconditionally: _decode_audio_base64() in studio/backend/routes/inference.py and the SNAC/BiCodec preprocessors in studio/backend/core/training/trainer.py. Consequently, an otherwise successful native ARM64 installation returns an internal error for chat audio inputs and fails audio-training jobs with ModuleNotFoundError; these workflows should be disabled or return an explicit unsupported-platform response when the installer takes this path.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Both imports are function-local: inference.py:7516 sits inside _decode_audio_base64 (defined at 7514) and trainer.py:1486/1680 inside the preprocessors, so a missing torchaudio does not break startup or any non-audio workflow, only the audio calls themselves. Gating those backend routes is a Studio feature change rather than part of this installer PR. The branch at install.ps1:2564 is also only reached when no x64 interpreter could be obtained, since install.ps1:1401-1419 now swaps a native ARM64 Python for x64 first; on that residual host the pre-PR behaviour was aborting the install outright, so an install without audio is a strict improvement, not a new regression.
| step "git" "not found (not required)" "Yellow" | ||
| substep "Unsloth installs prebuilt binaries and wheels, so git is not needed." | ||
| substep "Install it only for --local/source installs: https://git-scm.com/download/win" |
There was a problem hiding this comment.
Recheck Git before entering the source fallback
On a clean machine without Git or winget, this continues because $gitNeeded is false during Phase 1, but a later prebuilt llama.cpp download or validation failure sets $NeedLlamaSourceBuild = $true at studio/setup.ps1:3917-3923. Phase 4 then invokes git clone at studio/setup.ps1:4435 without rechecking Git; moreover, Invoke-SetupCommand resets $LASTEXITCODE to zero, so a PowerShell command-not-found error can be misreported later as a CMake failure. Revalidate Git when $WillBuildLlamaFromSource becomes true so the advertised automatic source fallback either installs the prerequisite or exits with the correct guidance.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct on both halves. Phase 1 leaves $gitNeeded false for consumers, Ensure-BuildToolsForLlamaSourceBuild (called at setup.ps1:4094) installs CMake and VS but never git, and the 3923 fallback reaches git clone at setup.ps1:4366/4407/4434. I reproduced the exit-code half under pwsh: Invoke-SetupCommand sets $LASTEXITCODE = 0 and a command-not-found error leaves it untouched, so it returns 0, $BuildOk stays true, and the run dies later reporting cmake configure. Fixed by resolving git where $WillBuildLlamaFromSource is computed and degrading the same way the missing-cmake branch at 4114 does, rather than hard-failing, since this path is the automatic fallback and not an opt-in.
An ARM64 host cannot complete the install with a native ARM64 interpreter. pyarrow, pulled in by unsloth -> datasets, has never published a win_arm64 wheel on any version, and neither has hf-transfer, a direct dependency. Both therefore fall back to a source build: pyarrow dies in scikit-build-core CMake configuration and hf-transfer dies in openssl-sys for want of perl, several minutes into a run that looked healthy. torch and torchvision are not the problem, they have win_arm64 wheels and install fine. Windows 11 on ARM runs x64 binaries under emulation and both packages ship win_amd64 wheels, so an x64 interpreter installs cleanly. Find-CompatiblePython accepted an interpreter on version and non-Conda status alone. It now ranks candidates by architecture on ARM64 hosts and returns an x64 one when present, asking each interpreter for its own sysconfig.get_platform() rather than guessing from its path. Host architecture comes from PROCESSOR_ARCHITEW6432 and OSArchitecture as well as PROCESSOR_ARCHITECTURE, which describes only the current process and reads AMD64 in an emulated shell. This is a preference, not a requirement. If only ARM64 is found, x64 is bootstrapped through winget --architecture x64 or the python.org fallback, and if neither works the installer names pyarrow and hf-transfer up front instead of failing later on a CMake or Rust error. The ARM64 torchaudio skip stays live for that path. Non-ARM hosts return on the first match exactly as before, with no extra interpreter probing.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 475b75c590
ℹ️ 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".
| # before the venv exists, so the interpreter cannot be probed here at all. | ||
| # The x64 package covers both outcomes, and the winget branch above already | ||
| # installs Microsoft.VCRedist.2015+.x64 unconditionally. | ||
| $url = "https://aka.ms/vs/17/release/vc_redist.x64.exe" |
There was a problem hiding this comment.
Ensure the x64 runtime when only ARM64 runtime is present
On an ARM64 machine that already has only the native ARM64 redistributable, Test-VCRedistInstalled returns true as soon as it sees the ARM64 System32\vcruntime140_1.dll, so Ensure-VCRedist exits before reaching this x64 download. Since this change now prefers an emulated x64 Python, its win_amd64 PyTorch and llama-server binaries still lack the x64 runtime and can fail to load; detection must distinguish the x64 runtime (for example via the x64 registry entry) rather than treating any architecture's System32 DLL as sufficient.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Right. Test-VCRedistInstalled (setup.ps1:875) returns true on the architecture-blind System32\vcruntime140_1.dll probe, so Ensure-VCRedist returns at line 895 before ever reaching the x64 download. On an ARM64 host the arm64 package installs a pure ARM64 image, and an ARM64 PE cannot be loaded into an emulated x64 process (learn.microsoft.com/windows/arm/arm64x-pe), so the x64 Python this PR now prefers would get no usable runtime. Fixed by requiring the x64-specific registry entry on ARM64 hosts, keeping the DLL probe for x64 hosts. Microsoft documents ...VC\Runtimes\{x86|x64|arm64} as per-architecture subkeys, so the x64 package still registers Runtimes\x64 on an ARM64 box and the new check cannot loop.
| $_llamaSrc = $DefaultLlamaSource -replace '\.git$', '' | ||
| if ($env:UNSLOTH_LLAMA_FORCE_COMPILE -eq '1') { $gitNeeded = $true } | ||
| if (-not [string]::IsNullOrWhiteSpace($env:UNSLOTH_LLAMA_PR)) { $gitNeeded = $true } | ||
| if (-not [string]::IsNullOrWhiteSpace($_prForce)) { $gitNeeded = $true } |
There was a problem hiding this comment.
Gate Git on an effective forced PR
On a no-Git/no-winget machine, setting UNSLOTH_LLAMA_PR_FORCE=0 (or any other nonblank non-positive/invalid value) now makes $gitNeeded true and aborts setup here, although the later source-selection logic only activates this setting when it is a positive integer and otherwise takes the normal prebuilt path. This also conflicts with the repository's existing tests that treat 0 and abc as non-forcing values; apply the same positive-integer predicate before requiring Git.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct. Line 1709 used a bare non-blank test while the promotion at setup.ps1:3680 requires ^\d+$ and -gt 0, so UNSLOTH_LLAMA_PR_FORCE=0 or abc aborted a git-less consumer for a source build that never runs. Line 1709 now applies the same positive-integer predicate. UNSLOTH_LLAMA_PR at 1708 stays a bare non-blank check deliberately: any non-blank value either builds from source or hard-errors at 3687, so git is genuinely needed there.
Ensure-VCRedist never reached its x64 download on an ARM64 machine that already
had the arm64 redistributable: Test-VCRedistInstalled accepted System32\vcruntime140_1.dll
regardless of architecture, and there that file can be the pure-ARM64 package. An
ARM64 PE cannot load into an emulated x64 process, so the x64 Python this branch now
prefers would have been left without a usable runtime. The x64 registry entry is the
only x64-specific proof, and Microsoft registers Runtimes\{x86|x64|arm64} per
architecture, so vc_redist.x64.exe still writes Runtimes\x64 on an ARM64 host and the
check cannot loop. The DLL probe stays for x64 hosts.
Phase 1 demanded git for any non-blank UNSLOTH_LLAMA_PR_FORCE, but the promotion that
actually turns it into a source build requires a positive integer, so PR_FORCE=0 or a
non-numeric value aborted a git-less consumer install for a build that never runs. Both
sites now use the same predicate.
The automatic fallback after a failed prebuilt llama.cpp download reached git clone with
no git check anywhere in between, and Invoke-SetupCommand returns 0 for a command-not-found,
so a git-less host did not stop there: it continued into an empty directory and reported a
cmake configure failure instead. Git is now resolved where the source build is decided,
with a last winget attempt, and a missing git degrades exactly like a missing cmake rather
than aborting, since the opt-in source triggers already required git in Phase 1.
Also tightened the comments across the changed Windows install code, keeping the reasons
on the guards that prevent a specific failure.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f597235e6a
ℹ️ 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 ($env:UNSLOTH_LLAMA_FORCE_COMPILE -eq '1') { $gitNeeded = $true } | ||
| if (-not [string]::IsNullOrWhiteSpace($env:UNSLOTH_LLAMA_PR)) { $gitNeeded = $true } |
There was a problem hiding this comment.
Require Git when the master tag forces a source build
When UNSLOTH_LLAMA_TAG=master is selected on a host without Git and winget, this gate leaves $gitNeeded false even though the later llama.cpp logic always rebuilds master from source. Phase 4 consequently treats the missing Git as an automatic prebuilt fallback and reports a successful degraded install without the explicitly requested build; include the master tag in the source-build predicates so this configuration fails with the actionable Git prerequisite error.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, fixed in fe419ea. Neither unslothai/llama.cpp nor ggml-org/llama.cpp publishes a release tagged master (both 404 on /releases/tags/master), so the prebuilt lookup always misses and Phase 4 falls back to a source build - and Phase 4 already special-cases the tag twice as always-rebuild. Phase 1b now resolves the tag the same way Phase 4 does and sets $gitNeeded when it is master, so the no-git host gets the actionable prerequisite error instead of a silently degraded install. Covered in tests/python/test_windows_git_gate.py (master -> True, latest/b8635 -> False); the master case fails against the pre-fix gate.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f67a3c0b06
ℹ️ 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 ($X64Python) { | ||
| $DetectedPython = $X64Python |
There was a problem hiding this comment.
Preserve native ARM64 selection after switching Python
On an ARM64 host where this branch successfully selects x64 Python, the resulting venv is also used to run install_node_prebuilt.py and install_llama_prebuilt.py from studio/setup.ps1. Both helpers determine architecture solely from platform.machine(), which reports AMD64 inside an emulated x64 process, so the normal successful ARM64 path downloads x64 Node and windows-cpu llama.cpp rather than the available native ARM64 bundles. This leaves GGUF inference running under emulation and can make validation fail on ARM systems whose x64 emulation cannot execute the prebuilt's ISA; pass the host-machine architecture separately to these executable installers while retaining x64 Python for Python wheels.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The premise does not hold: platform.machine() on Windows is a host-machine query, not a process query. CPython's _get_machine_win32 reads PROCESSOR_ARCHITEW6432 before PROCESSOR_ARCHITECTURE (3.11 platform.py:722-732), and on 3.12/3.13 queries the physical CPU via WMI first, mapping index 12 to ARM64 before falling back to that same env pair (3.13 platform.py:837-862). Those are the same signals in the same order as Get-HostMachineArch at install.ps1:65, and install.ps1 defaults to Python 3.13. So under the x64 swap both helpers still resolve ARM64 and still pick arm64 Node and the windows-arm64 bundle, exactly as before this PR; tests/studio/install/test_install_node_prebuilt_logic.py already pins (Windows, ARM64) -> arm64. Nothing loads those artifacts in-process either: the only ctypes.CDLL of a ggml library is _vulkan_probe.py:122-123, gated on ggml-vulkan.dll being present, and Windows arm64 ships no Vulkan bundle (install_llama_prebuilt.py _has_no_vulkan_prebuilt). Passing the host arch explicitly would be a no-op; passing the interpreter arch would create the regression this describes.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f67a3c0b06
ℹ️ 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".
| } elseif (-not $HasGitForBuild) { | ||
| # Before cmake: the toolchain install is skipped without git, so cmake may be missing | ||
| # purely as a consequence. Degrade rather than abort; the opt-in source triggers already | ||
| # required git in Phase 1, so only the automatic fallback lands here. | ||
| Write-Host "" | ||
| step "llama.cpp" "build skipped (git not available)" "Yellow" |
There was a problem hiding this comment.
Keep explicit source-tag fallbacks fatal without Git
When a Git-less host sets UNSLOTH_LLAMA_TAG to a valid upstream tag or branch that lacks a published prebuilt (anything other than the specially handled master), the prebuilt helper sets $NeedLlamaSourceBuild, but this branch treats the situation as an automatic download failure and completes with a degraded install. Those explicit refs are normally fetched and checked out by the source-build path, so the requested llama.cpp backend is silently omitted; distinguish an explicit-ref fallback here and fail when Git cannot be installed.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
This one does not hold, on both halves. It is not silent: the footer prints "(limited: llama.cpp unavailable)" (setup.ps1:4755-4768) after the four-line explanation at the degraded branch. And it is already fatal on the path that matters -- setup.ps1:4779 exits non-zero via Exit-SetupFailure whenever LlamaCppDegraded is set and SKIP_STUDIO_BASE=1, which is exactly how install.ps1 invokes setup. Only a direct 'unsloth studio update' keeps a degraded install successful, deliberately, to match studio/setup.sh. So an explicit tag with no published prebuilt and no Git does not complete quietly; it fails the install. master is a different case and got its own gate because it is statically knowable: it is a branch name, never a release tag, so no network call is needed to predict the source build. An arbitrary tag is not knowable in Phase 1b without hitting the API, which is why that comment defers it to Phase 4, and turning the automatic fallback fatal there would undo the point of this PR.
| $dst = Join-Path ([System.IO.Path]::GetTempPath()) "vc_redist.x64.exe" | ||
| substep "winget unavailable or failed; downloading the runtime directly..." | ||
| try { | ||
| Invoke-WebRequest -Uri $url -OutFile $dst -UseBasicParsing -TimeoutSec 300 |
There was a problem hiding this comment.
Enable TLS 1.2 before the direct runtime download
On older LTSC/Windows Server installations running Windows PowerShell 5.1 with the legacy .NET security-protocol default, this HTTPS request does not negotiate TLS 1.2 and aka.ms rejects the connection. That is specifically a relevant no-winget environment for this fallback; the exception is caught and setup continues without the VC++ runtime, recreating the missing-VCRUNTIME140.dll failure this path is intended to prevent. Set or temporarily add Tls12 to ServicePointManager.SecurityProtocol before invoking the download.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed, fixed in 1a8a991. setup.ps1 is launched with powershell.exe (unsloth_cli/commands/studio.py:2495), so this fallback really does run on Windows PowerShell 5.1, and it is the no-winget LTSC/Server image that reaches it. The guard only upgrades an explicit legacy set: SystemDefault (0) means let the OS choose and already covers TLS 1.2+, so pinning it to Tls12 there would strip TLS 1.3 from every later request in the process. It ORs Tls12 in, restores the previous value in the finally, and is wrapped in try/catch because assigning an unsupported protocol throws. Covered by tests/python/test_windows_vcredist_download_tls.py, which slices the real download block out of setup.ps1, starts from a non-zero set lacking Tls12 and asserts the protocol seen at download time plus the restore. One caveat stated plainly: I have no Windows host here, so the .NET Framework default per OS build is not something I could verify directly. The change is a no-op wherever the default is already SystemDefault.
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! 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". |
#7549 is in main, so the three known-outcome pins that were waiting on it are stale and would now hard-error by design. Each is replaced by the assertion it was standing in for rather than deleted: win windows-11-arm now gates. The x64-on-ARM64 resolver is asserted as an outcome: the venv interpreter reports win-amd64 from its own sysconfig, and torchaudio (no win_arm64 wheel at any version) is installed. Measured on the integration branch before #7549 merged: "only a native ARM64 Python 3.13 was found" -> "installing x64 Python" -> torchaudio 2.10.0+cpu, install green. win windows-latest / winget=masked now gates. The relaxed git gate is asserted from both sides: the old unconditional message must be absent, the no-git branch must have been reached (so the row cannot pass because git leaked back onto PATH), and setup.ps1 must report git as absent-but-not-required. Both Windows rows, and the visible one, gained the usability check the Linux legs have had and Windows never did: a managed interpreter, an unsloth CLI on disk, and that CLI actually running. nobuild and the toolchain check only read the log, so an installer that exited 0 having produced nothing satisfied them. The torch assert also loses its fallback to whatever `python` resolves to. The virgin container overlay row gates, and asserts what only that lane can: it is the one environment whose System32 does not already ship the VC++ 2015-2022 runtime, so it is the only place Ensure-VCRedist's direct aka.ms download can be proved to run rather than be short-circuited. The overlay=false row keeps a pin, with a new reason: it installs unsloth from PyPI on purpose, and setup.ps1 inside 2026.7.5 (uploaded the 23rd) predates #7549, so it still stops at the old gate. That is release lag, it flips on the next release, and the pinned signature is now the old wording rather than "#7549 has not landed". Also adds linux ubuntu2404-nonroot-wget. install.sh's download() takes curl or wget and _transport_missing is true only when both are gone, so a wget-only box is supported on paper, but the gating nonroot leg provisions ca-certificates AND curl, so curl won every probe and the wget branch had never run. Same image, same no-sudo user, same asserts, wget instead of curl, and curl proved absent on disk for root and for tester before AND after the install, so the claim is that every download went through wget rather than that curl happened to be unused.
#7549 taught Test-VCRedistInstalled to consult the host architecture before trusting the System32 DLL, but the round-trip job dot-sources a fixed list of functions out of setup.ps1 and that list did not gain the helper. Part A returns early on the registry hit, so only the clean-box half reaches the call and the job fails there with "Get-HostMachineArch is not recognized". Reproduced by dot-sourcing the old list and calling Test-VCRedistInstalled, which throws; with the helper added the same call returns.
#7551) * CI: prove the installer works on a machine with no developer toolchain No job has ever run the installer on a machine without one. studio-mac-install-matrix.yml is the only macOS installer job and it runs 'bash install.sh --local --no-torch' on runners that already have the Xcode CLT selected and setup-python preinstalled, so the CLT gate never fires there, and --local is precisely the mode that legitimately needs git. Repo-wide there was zero coverage of xcode-select or CommandLineTools outside install.sh itself. clean-machine-install-ci.yml runs the installer on a genuinely stripped machine. macOS legs move /var/db/xcode_select_link, /Library/Developer/CommandLineTools, /Applications/Xcode*.app and Homebrew aside, so xcode-select -p, git, cc and clang really do fail, and restore unconditionally afterwards. Removing the select-link alone is not enough: xcode-select falls through to a full Xcode.app and re-arms /usr/bin/git. Linux legs use containers, which are genuinely clean. Windows legs cover winget visible and masked, plus windows-11-arm. A WSL leg covers the 126 lines of WSL-specific install.sh logic that had no runtime test. Each macOS leg runs four deliveries: pipe (the advertised command, and the shape that turns an early exit into curl (56)), file (separates installer logic from pipe delivery), no-torch, and tauri (stdin closed, no tty, as the desktop app invokes it). One leg records every toolchain invocation and asserts the trace, which is the real deliverable: proof the installer never reached for a compiler rather than proof it happened to succeed. The asserts test that tools do NOT WORK rather than that they are absent from PATH. On a real virgin Mac /usr/bin/git and /usr/bin/cc exist as CLT stubs, so 'command -v git' succeeds and only running it tells the truth. desktop-app-clean-machine-ci.yml installs and launches the SHIPPED desktop app release on a stripped machine, covering Gatekeeper and quarantine on macOS, NSIS silent install on Windows, and Xvfb with WebKit2GTK on Linux. Known limit, stated plainly: hosted macOS runners are developer machines. Masking reproduces this bug and proves the installer does not invoke a toolchain, but it cannot prove no hidden dependency exists on a truly virgin Mac. An ephemeral-VM lane is the follow-up. * Point the llama assert at the right root, and name the Intel limitation The tauri leg installs to the legacy root because --tauri refuses a custom UNSLOTH_STUDIO_HOME. Its install succeeds end to end, but llama.cpp lives at <root>/llama.cpp while the venv is at <root>/studio, so the assert was pointed one level too deep. On macos-15-intel /usr/bin/git keeps working once the CLT are gone, so it is not CLT-provided there and no masking can remove it, while cc and clang do become stubs. Calling that 'masking failed' was wrong. That leg allowlists git explicitly and says why, so the assert stays strict everywhere else. * Make the clean-machine legs able to fail The toolchain strip never ran on the automatic triggers: inputs exists only for workflow_dispatch, and GitHub coerces '' and false alike to 0, so `inputs.strip_toolchain != false` was false. Confirmed on a pull_request run where the strip step reports skipped. Gate on the event instead. Also: scrub the Machine and User registry PATH, since install.ps1 rebuilds $env:Path from them mid-install and the toolchain came back; stop dropping WindowsApps unconditionally, which removed winget on the winget=visible leg too; fail rather than annotate when a bundle ships no installer or no CLI; run the bundled installer, which a headless launch never reaches; resolve the newest desktop-v* release instead of a pinned immutable tag; and give the two macOS matrix rows distinct artifact names. * Make the Windows and Linux clean-machine legs honest The Windows scrub only touched PATH, so the legs were green while not clean: run 30365014702 logged "python ABSENT" and then "Python 3.13 already installed" with uv resolving C:\hostedtoolcache\windows\Python\3.13.14\arm64\python.exe. py.exe lives in C:\Windows and uv discovers interpreters itself, so take the toolcache off disk and fail when tooling survives, instead of only printing it. The Linux desktop legs never stripped anything, and the tauri.log step was all || true so it could not fail. Run the bundled installer the way install.rs does, with --tauri alone, and assert torch: passing --no-torch skipped the slowest half of first launch and let the venv check pass over it. Pin the WSL rootfs to a dated build; current/ is a rolling alias and the digest next to it is fixed. * Give the Linux and WSL legs an assertion that can fail The Linux rows' only post-install gate was nobuild, a log grep, so an installer exiting 0 having produced nothing kept a required leg green. The WSL job and the Windows job both already check the install runs; the Linux job now does too. The WSL detection half only printed its Select-String, and the alternation also matches "platform linux", so a regression that skipped every WSL-specific branch would still pass as a plain-Linux install. Assert the exact marker, stripping ANSI first since step writes the label in reverse video. Probed against three fixtures: real wsl log passes, platform linux fails, missing log fails. * Tighten the clean-machine comments Compress the comment blocks across the clean-machine workflows and scripts. The explanations of why each check is written the way it is stay; the padding, restatement and duplication go. No code or workflow logic changes. * Point the nightly at the repo that publishes, and let its checks fail REL_REPO defaulted to unsloth-test/unsloth-test, which holds one release frozen at 2026-07-27, while release-desktop.yml publishes into github.repository. The schedule was re-testing the same fixture forever and could never see a broken production bundle. The windows job carried a blanket continue-on-error, so its NSIS assertions could not gate. lipo -archs prints and exits 0 for a thin binary and `|| true` swallowed even that, so the architecture was never checked; fall back to file, which survives the CLT mask. And require the preflight disposition line rather than the mere existence of tauri.log, which setup_logging creates at process start regardless. * Stop four clean-machine checks from passing over a real failure Re-run `absent` after the install on the masked macOS legs. It only ran before, so an installer that quietly selected the Xcode CLT or installed a compiler left the leg green while every later source build could succeed, which is the one thing clean-machine-assert.sh says `absent` guards the whole run against. Fail the Windows simulation when py.exe can still start an interpreter. The launcher binary itself may stay, but Find-CompatiblePython probes `py` first (install.ps1:1130-1153), so an interpreter registered outside the two renamed toolcache directories gets reused and Python bootstrap is never exercised. Exempting `py` without ever running it left that unchecked. Propagate the WSL installer exit code. It was printed and discarded, and the CLI check does not compensate: install.sh links the `unsloth` shim (4174-4182) before it reports a failing studio/setup.sh (4219-4230), so a late setup failure leaves a shim whose --version succeeds. Run the bundled installer in the Linux desktop jobs. The launch step only proves the process stayed alive, and on a fresh home preflight reports not_installed and the app waits on the install screen, so both required rows passed after 90 seconds without ever touching the shipped install.sh. Locate the resource in the deb payload or the extracted AppImage, run it the way install.rs does, and require a managed venv that can import torch. * Prove the trace wrapper records before trusting an empty trace The `notools` check reads an absence: it passes when the trace file contains no compiler, git or brew invocation. A shim directory that never reached PATH produces exactly the same empty file as an installer that touched nothing, so the single leg carrying that assertion would stay green no matter what the installer did. "Verify the simulation actually took effect" only ran for mask mode, which left the trace leg with nothing checking its own instrumentation. Call git explicitly after sourcing the environment and require it to appear in the trace, then truncate the file so the self-test entry does not count against the install. The call has to be explicit because macOS reaches _has_working_git only under STUDIO_LOCAL_INSTALL (install.sh:2026), so no consumer leg on that platform probes git on its own. * Stop the Windows clean-machine check failing on its own probe exit code All three Windows legs failed "Verify the simulation took effect" with no ::error:: printed at all. The check itself was right: the mask step logged "masked toolcache python: C:\hostedtoolcache\windows\Python", python/git/cmake/cl were ABSENT, no `py -3.x` probe started an interpreter, and the winget assertions were satisfied. The step still exited 1. The cause is $LASTEXITCODE leaking out of the step. The last external command is the `py -3.13` probe, which is SUPPOSED to fail; Get-Command and Write-Host are cmdlets and never reset $LASTEXITCODE, and the runner appends `if ((Test-Path -LiteralPath variable:\LASTEXITCODE)) { exit $LASTEXITCODE }` to every pwsh step (actions/runner#351). So a clean machine reported failure, and because this step runs before Install, no Windows leg has ever reached the installer. Clear $LASTEXITCODE after the probe loop and end with an explicit exit 0. The leak detection is untouched: a surviving python/git/cmake/cl, or a `py -3.x` that actually starts, still exits 1. Also print each probe's exit code and output, so the next failure here explains itself instead of being silent, and label `py -0p` as what it is. The launcher reads the registry, which the on-disk toolcache rename cannot rewrite, so -0p keeps naming paths that no longer exist. Unlabelled it reads like a leak. Accept the Fedora leg's real outcome instead of a message that can be absent The fedora assertion only accepted the unsupported-package-manager hard exit. That is still what this ref's install.sh does, but the pending installer change replaces it with a warning that lets the install continue, at which point the old grep matches nothing and the step fails for the wrong reason. Handle both, strictly. If the log shows the newer "using prebuilt llama.cpp (missing:" warning, the Linux gate demonstrably did not hard-stop, and the only tolerated failure past that point is release lag: install.sh comes from this ref while unsloth comes from PyPI, and the released studio/install_python_stack.py has no "skip triton kernels when git is missing" guard, so it still fetches the git+https triton_kernels requirement on a machine with no git. Anything else after that warning fails the step. Otherwise the old hard-exit message is still required. A missing log, a bootstrap outage or any unrecognised failure all remain errors, and the step retires to a plain success assertion once a release ships the no-git skip. * Make the AppImage Linux row actually extract, and hold Linux to the macOS preflight bar The appimage row invoked the extractor by bare filename, and a command word with no slash is resolved through PATH rather than the working directory, so the extraction exited 127 and the bundled-installer assertion below it never ran. Prefix it with ./ so the row exercises what it claims to. The Linux log step also asserted nothing: it skipped a missing log with continue and discarded the grep with || true. The launch step only proves the process stayed alive for 90 seconds, and the bundled-installer checks do not exercise the Rust preflight path, so an app that hung before preflight completed passed both required Linux rows. Require the same desktop_preflight completed disposition= record the macOS rows already do. * Put the branch's own Python under test on the clean-machine legs install.sh and install.ps1 come from the ref under test, but they install unsloth from PyPI, which is the consumer path and has to stay that way. That left everything Python-side coming out of the released wheel: studio/setup.sh, studio/setup.ps1, studio/install_python_stack.py, and every requirements and constraints file those resolve through Path(__file__). A branch that changes constraints.txt or setup.ps1 therefore got a green run that proved nothing about the change, and some legs proved less than they looked. The Fedora assertion was already carrying a hand-written workaround for exactly this, tolerating a triton/git failure on the grounds that the released package lags the ref. Legs marked overlay: true now re-point the venv at the ref just before studio setup runs, through UNSLOTH_CI_SOURCE_OVERLAY: a --no-deps editable install of the checkout. That makes import studio resolve to the working tree, so the existing setup-script lookup finds the ref's setup.sh / setup.ps1 and install_python_stack reads the ref's constraints, with no other change to either installer. Not --local: --local additionally installs unsloth-zoo from a git+https URL, which genuinely needs git, and git absence is the whole point of the masked legs. The overlay resolves no dependencies and clones nothing, so it holds up with git, cmake and the compilers all gone. It is not a consumer knob either: no flag, no usage entry, ignored unless the variable names a directory with a pyproject.toml in it. Four legs stay on the released package deliberately, each for its own reason, recorded in the header: the mac pipe legs keep an end-to-end signal on what a user actually runs; the trace leg would otherwise answer its own question, since the editable build calls git through setuptools-scm's file finder; the non-root Linux leg dies before a venv exists; and WSL only ever receives install.sh, not a source tree. Two supporting fixes the overlay depends on or exposes: install_python_stack.py discarded uv's output whenever a step succeeded, so the nobuild assertion, which reads the install log, could not see a source build in the dependency phase at all. That is the phase that installs studio.txt, where an sdist-only dependency actually turns up, and it reported "built: none" regardless. It now echoes successful output under UNSLOTH_VERBOSE, matching what install.sh's run_install_cmd already does. nobuild now ignores "Building <name> @ file://" lines. A local-path build is something the caller pointed at, never a dependency resolution chose, and index dependencies always print <name>==<version>, so a real sdist from PyPI is still caught, including one named unsloth. Each overlaid leg also asserts it really was overlaid, so an unset variable cannot quietly put the whole matrix back on the released wheel. * Allowlist the triton-kernels pure-Python sdist, and record why Windows on ARM is red The two ubuntu2404 root legs went red at "Assert no source build" reporting triton-kernels. That is not a regression in what the installer does. Those builds have always happened; they only became visible now that pip_install stopped discarding uv's output on success, which is what finally let the nobuild check read the dependency phase at all. So the question was whether each build actually needs a compiler. Checked against the real artifacts rather than assumed: openai-whisper 20250625, randomname 0.2.1, argbind 0.3.9 -- no version of any of the three has ever published a wheel; antlr4-python3-runtime is pinned at 4.9.3, below the first release that ships one. All four sdists use setuptools.build_meta, declare no ext_modules, and contain no .c/.cpp/.pyx/.rs file. Already allowlisted, correctly. triton-kernels is the same category and was the only name failing. It is pinned to the triton repo's python/triton_kernels subdirectory; that tree is 75 files of Python, a four-line pyproject.toml, no setup.py and no native source at all. The kernels are Triton DSL compiled at runtime, not at install time. It is also a direct URL the installer names itself rather than something resolution picked, and only Linux reaches it. It belongs in the allowlist, so add it with that reasoning written down. The allowlist match is now lowercased and underscore-folded on both sides. The requirement spells the package triton_kernels while uv prints triton-kernels, and an allowlist that matched only one spelling would pass by luck rather than by intent. A plain pyarrow sdist is still caught. The two data-designer @ file:// plugin builds needed nothing: they are in-tree local paths, already dropped by the same rule that exempts the source overlay's own build. Separately, the windows-11-arm leg fails for a real reason and should keep failing. The ARM handling itself works, the log shows torchaudio being skipped and torch plus torchvision installing from wheels. What stops it is that pyarrow and hf-transfer publish no win_arm64 wheel at all, so uv falls back to their sdists and they fail on CMake configure and on openssl-sys wanting perl. That is a product gap on the platform, not a gap in the simulation, so the leg stays experimental and keeps reporting it. Record that above the matrix entry so the next reader does not re-diagnose it. * Exercise the bundled Windows installer, and stop mislabelling installer sources Four things that let a leg go green while proving nothing. The desktop Windows job installed the bundle and launched it, and that was all. On a fresh profile preflight reports not_installed and the app sits on the install screen waiting for a click, so the process happily stays alive for 90 seconds without the bundled install.ps1 ever running. A bundle that shipped no install.ps1 resource, or a broken one, passed this job -- which is the packaged app failure the workflow exists to catch. macOS and Linux already invoke their bundled script directly; Windows now does the same, via the resource NSIS laid down next to the exe, invoked the way install.rs invokes it, then asserts the managed venv exists and can import torch. Its timeout goes to 60 minutes because a full torch install on a Windows runner is the slowest of the three. A manual run that selects installer_source: published only redirected the macOS and Linux jobs. WSL kept copying the checked-out install.sh and Windows kept running the checked-out install.ps1, so a run asking whether the script on unsloth.ai works reported on this ref under the published label. Both now honor the selection; install.ps1 advertises its own unsloth.ai URL, so published has a meaning on Windows too. Both branches stay empty on pull_request and push, so automatic runs are unchanged. The push-to-main filter listed only install.sh, install.ps1 and this workflow, while the PR filter also covers setup.sh, setup.ps1, install_python_stack.py and the clean-machine helpers. A direct push touching those skipped the workflow entirely, so the post-merge backstop never ran for the files the source overlay was added to cover. The two lists now match. Neither filter covered studio/backend/requirements, even though the overlay exists precisely so a constraints change is resolved on a machine with no compiler and no cached wheels. The update-smoke workflows cannot stand in: they start from a preinstalled Python and full developer tooling. * Make the Linux and Windows desktop legs clean, and honour published on every macOS delivery The desktop workflow claims all three platforms are stripped, but only macOS and Windows had a strip step and the Windows one scrubbed the process PATH only. Both gaps let a bundle that needs a developer toolchain pass the one workflow whose premise is that it must not. Linux: the job ignored strip_toolchain entirely and ran the bundled install.sh with the runner's git, gcc, cmake and make in /usr/bin. clean-machine-env.sh now has a Linux --remove branch that moves the resolved tool binaries aside, recorded in restore.sh, and the job calls it plus `assert absent` after the apt step (the .deb install needs dpkg) and before the bundled installer, with a restore step to match macOS. The loop repeats per tool so a name present in both /usr/bin and /usr/local/bin is fully masked rather than half masked. Windows: rewriting $env:PATH does not survive the bundled install.ps1, which calls Refresh-SessionPath (318-337) and rebuilds $env:Path from the Machine and User registry values, and py.exe in C:\Windows reaches the toolcache whatever PATH says. Ported the on-disk toolcache rename, the Machine/User registry scrub and the py -3.11/-3.12/-3.13 start probe from clean-machine-install-ci.yml, so the strip is proven rather than assumed. Windows preflight: the log step was Test-Path, Get-Content and Select-String, none of which can fail, so an app that hangs before preflight passed on the 90 second liveness check alone. It now asserts a tauri.log exists and carries a `desktop_preflight completed disposition=` line, the same unconstrained check macOS and Linux already make. The disposition VALUE is deliberately not constrained: ManagedReady over an unbootable venv is the reported bug. installer_source on macOS: only the pipe delivery branched on it, so a `published` dispatch ran the checked-out script on six of the eight macOS rows while the run was labelled published. The script is now resolved once at the top of the Install step and used by the file and tauri deliveries; pipe still re-fetches through the live transport, because that is half of what it tests. Linux, WSL and Windows already honoured the input. Also shortened the comments across the changed files, keeping the reasoning that says why each check exists. * Run the Windows installer under PowerShell 5.1, the only shell a clean machine has The Windows Install step ran `& $script` inside a `shell: pwsh` step, so install.ps1 was executing under PowerShell 7. A genuinely clean Windows box does not have PowerShell 7: Windows ships powershell.exe (Windows PowerShell 5.1) and pwsh is a separate install that the hosted runner image happens to preinstall. So the one workflow whose premise is a machine that has never seen a developer toolchain was testing the installer under a shell that machine would not have, and no other Windows job anywhere in .github exercises install.ps1 under 5.1. Invoke it the way the desktop does (install.rs:325-339, and the bundled installer step in desktop-app-clean-machine-ci.yml): powershell.exe with -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File. The pwsh step wrapper stays, since it is only the installer that has to be under 5.1. Calling powershell.exe with `&` keeps the output in the pipeline, so Tee-Object still fills logs/install.log, and $LASTEXITCODE after the pipeline is the child's real exit code, so $rc and `exit $rc` are unchanged. install.ps1 and studio/setup.ps1 hold no PowerShell 7-only constructs: no `#Requires` above 5.1, no `&&`/`||` chain operators, no ternary, no null-coalescing, no ForEach-Object -Parallel, no $IsWindows/$PSStyle, and no 6+ cmdlets or parameters. setup.ps1 declares `#Requires -Version 5.1`, and its three $PSVersionTable branches gate a 7-only preference on the 7 side with a 5.1 fallback. Every Invoke-WebRequest already passes -UseBasicParsing, which 5.1 needs because it otherwise reaches for the IE engine. * Assert the Windows desktop strip actually took effect The desktop job's Windows masking renamed the toolcache Python, scrubbed the Machine and User registry PATH, and probed `py`, but nothing checked that `python`, `git`, `cmake` or `cl` were gone. The drop list is heuristic path fragment matching, so a runner image that moves any of those outside those fragments leaves the bundled install.ps1 reusing hosted developer tooling while the job still reports a clean machine. PATH written to $GITHUB_ENV only applies to later steps, so the check has to live in a step of its own; it carries the same event gate as the strip, exempts `py` (it lives in C:\Windows and stays, which is why the start probe is the real evidence), and resets $LASTEXITCODE before exiting 0 so an intentionally failing probe cannot fail a clean machine. Also correct the no-winget matrix note: that leg is not failing for an unfixed product reason. It stops at the unconditional git gate in setup.ps1 only on this ref, and with that gate relaxed it passes along with every other leg, so the row is a merge order dependency and stays required. * Resolve the desktop release including drafts, the convention this repo ships All three desktop legs died at the download step with an empty REL_TAG. The resolver passed --exclude-drafts while REL_REPO now defaults to github.repository, and every desktop-v* release in unslothai/unsloth is a draft: desktop-v0.1.50-beta and desktop-v0.1.471-beta are both drafts carrying the .dmg, .deb, .AppImage and setup.exe, while only the non-desktop tags like v0.1.501-beta are published. Excluding drafts therefore matched nothing and no leg could ever run against a production bundle. Drop --exclude-drafts so the newest desktop-v* release is found. A draft has no tag ref, so releases/tags/<tag> 404s for one, but gh resolves drafts over GraphQL and gh release download <tag> fetches their assets normally, so the download call is unchanged. Listing drafts requires push access, which for GITHUB_TOKEN means contents: write, so the workflow permission is raised from read and annotated. When nothing resolves the leg still fails hard rather than skipping: with no bundle to install there is nothing to prove, so a green run would be a lie. The error now names both causes, no release cut yet or a token that cannot see drafts. Also stop the restore step swallowing its own failure. `bash .clean-machine/restore.sh || true` printed "No such file or directory" whenever an earlier step failed before the toolchain was stripped, and hid a genuinely broken restore just the same. Skip explicitly when the file is absent and let a real restore failure surface. Same fix in clean-machine-install-ci.yml, which had the identical line. * Skip the desktop jobs on fork PRs instead of failing them Every desktop-v* release in this repo is a draft, and GitHub lists drafts only to a token with push access, which is why resolving one needs contents: write. A pull request from a fork receives a read-only token no matter what the workflow declares, so on those runs the resolver cannot see any release and the job died on "no desktop-v* release visible", accusing the repo of having no bundle when the real cause is the trigger. This workflow runs on pull_request for changes to itself and the stripping scripts, so an outside contributor editing either would have hit that. Guard the three jobs on the head repo not being a fork. A skipped job is honest here: it does not claim to have tested a bundle it was never able to download, and it is not reported as a pass. * Close the free headroom in the clean-machine simulation Assert arch and signature on every downloaded Mach-O. This is the one genuine gap the simulation had: Rosetta 2 is preinstalled on hosted runners and absent from a factory-fresh Mac, so an x86_64-only llama.cpp, whisper.cpp, Node or uv payload runs green here and dies with "bad CPU type in executable" for the user. llama-server launching under `assert-llama-loads.sh` does not rule that out, because Rosetta makes it launch. The new `macho` check reads `file -b` (`lipo` is an xcrun shim and is gone after masking, as the desktop lane already notes) and keys the expected arch off `uname -m`, so macos-15-intel expects x86_64. It also requires at least an ad-hoc signature on arm64, which closes the AMFI "Killed: 9" class that uv has already been bitten by; the check is skipped on x86_64, where unsigned code loads fine and so is not the same defect. It fails when the scan finds nothing, since an empty scan reads exactly like a clean one. Make absence real rather than PATH-hidden. uv probes well-known interpreter locations and the framework loader ignores PATH entirely, so hiding the toolcache only hid it from `command -v`. Empty /usr/local (it EXISTS on a factory-fresh Mac as a SIP-exempt firmlink, and is empty; it is /usr/local/bin that is absent, so the directory itself stays), move the hosted toolcache and /Library/Frameworks/Python.framework aside, and clear the developer dotdirs and caches. A populated uv or pip cache can also satisfy a resolution that would fail on a user's machine. Every removal goes through --remove and is recorded in the generated restore.sh, guarded so a path the install recreated is not buried inside its own restore. Unset CI, GITHUB_* and RUNNER_* for the installer process only. An installer branching on CI=true is a hidden dependency no consumer exercises. Scoped to the child so the step's own $GITHUB_OUTPUT still resolves. Record spctl --status and csrutil status. Neither is documented for these images and both change what a binary is allowed to do. * Pin the two failures no change here can fix, and add the virgin Windows container lane Three red checks, two of which test something this branch does not own. desktop linux deb / appimage run the SHIPPED bundle's own install.sh, and desktop-v0.1.50-beta was cut on 2026-07-21, before #7547 merged on 07-29. That bundle still carries the old optional-dependency gate, so on a stripped runner it exits 2 at [TAURI:NEED_SUDO] cmake git build-essential libcurl4-openssl-dev and never creates a venv. Current main's _check_linux_deps runs the same set through _SMART_APT_OPTIONAL, which suppresses every escalation path, so only a new release can change this. The step now pins that exact outcome: the exit code must be 2 and the log must carry exactly that package list, anything else still fails, and finding _SMART_APT_OPTIONAL in the extracted install.sh (the guard #7547 added) turns into a hard error saying to delete the pin. The venv and torch assertions stay and still run whenever the installer succeeds. win windows-11-arm gets a native ARM64 CPython, and torchaudio publishes no win_arm64 wheel at any version, so the PyTorch step cannot resolve. The fix is in install.ps1 on #7549, still open. Same treatment: the Install step is continue-on-error and a new step requires all three of the PyTorch step, the torchaudio resolution error and the missing win_arm64 platform tag, so any other failure is red. The row leaves experimental so the job is required, and the pin errors out as soon as the venv interpreter reports anything but win-arm64, which is what #7549 landing looks like. Adds the virgin Windows container lane as two jobs here rather than a sibling workflow: same premise as the win legs, same path filters, and masked-versus-real reads better side by side. The hosted Windows legs cannot test the VC++ 2015-2022 runtime (it ships in the runner image's System32) or a Windows with no Microsoft Store, and a servercore:ltsc2022 container on windows-2022 answers both. The probe asserts no python, py, git, cmake, cl, winget or uv on PATH, on disk or in the registry, and now also asserts vcruntime140.dll, vcruntime140_1.dll and msvcp140.dll are absent, which is the one thing the hosted runner cannot un-ship. Both container install rows stop at studio/setup.ps1's winget-only git gate on this branch, since #7549 is what relaxes it, so both are pinned the same way. The overlay row additionally requires the UNSLOTH_CI_SOURCE_OVERLAY hook to have fired, unconditionally: without that it would be indistinguishable from the released-wheel row, and the hook is this branch's own feature. Container notes carried over from the spike: never docker pull when the image is cached, since MCR has shipped an image ahead of the runner host before; wait for the Docker daemon, because one leg died in 21s on npipe:////./pipe/docker_engine and that flake misreads as "Windows containers unavailable"; drive docker from a run: step, because the job-level container: key is Linux-only. The root CA store is seeded after the virginity assertion, restoring what a real Windows already has, because studio/install_node_prebuilt.py downloads Node with bare urllib.request.urlopen and hits CERTIFICATE_VERIFY_FAILED against the empty container ROOT store. That product bug is left alone here. * Check signatures on Mach-O main executables only The macho check asserted a valid signature for every Mach-O under the studio home, and failed the macos-15 mask/pipe leg on 29 files: lxml, charset_normalizer, cygrpc, _upb, fontTools, caio, brotli and a bundled libportaudio.dylib. Those are MH_BUNDLE and MH_DYLIB images dlopen'd into a process without library validation, they ship unsigned in the wheels, and the same run had already installed and imported them with the installer exiting 0. Key the signature half off the Mach-O filetype and run it only on main executables. Report an absent seal separately from one that fails to verify, and capture codesign output instead of piping it into grep, which returned the unsigned exit status through pipefail and called every unsigned binary broken. The architecture half is unchanged and still a hard failure: it is what closes the Rosetta 2 gap. The zero-Mach-O guard is unchanged. The .venv_t5_* sidecars stay in scope; setup.sh creates them during a normal install and transformers_version.py puts them on sys.path, so they are payload. * Make the WSL job gate, assert Windows installed no toolchain, strip before the .deb * Assert the root Linux legs did not compile llama.cpp with the apt-installed toolchain * Pin the macOS desktop legs on the same pre-7547 release lag The Linux rows already pin the shipped bundle's own install.sh exiting 2 at the NEED_SUDO handshake. macos-15 and macos-26 fail the same way for the same reason: desktop-v0.1.50-beta predates #7547, so the bundled installer still hard-exits on the Xcode CLT gate that #7547 turned into a warning. Accept exit 1 plus that exact gate line, and nothing else. _check_macos_deps is the function #7547 added, so its presence in the bundle means the release caught up and the block errors out asking for the pin to be deleted. * Pin the WSL pipe truncation and the masked-winget git gate The WSL leg dies at install.sh:2082 with an unterminated quoted string. Nothing is wrong with that line: piping the script into sh is not atomic. dash reads it from the pipe in 8192-byte blocks and runs each command as it parses, and install.sh:2007 calls _maybe_reroute_strixhalo_to_2404, which on WSL alone shells out to Windows interop; interop relays the stdin it inherited and drains the pipe. dash has 11 blocks buffered at that point, ending at byte 90112, which falls inside "$STUDIO_LOCAL_INSTALL" on line 2082. Truncating install.sh at 90112 and parsing it reproduces the message verbatim, and running the whole file under a stdin-draining interop stub reproduces the exit code too. #7548 wraps the body in _unsloth_main so sh parses everything before running anything, and the same reproduction against its head is clean. The eight green staging runs cited when this job's continue-on-error came off were all on trees that already carried #7548, so that evidence never covered this branch. Pin the exact signature instead: exit 2 plus the shell's own unterminated-quoted-string error, with the _unsloth_main marker read back out of the distro as the flip condition. Pin winget=masked the same way. studio/setup.ps1:1655-1669 gates on git unconditionally and can only fetch it through winget, so masking winget leaves no way to satisfy it. #7549 relaxes the gate, and its wording appearing in the tree retires the pin. * Retire the WSL pipe pin now that #7548 is in main The pin flipped exactly as designed: it looks for _unsloth_main in the installer it actually ran, and #7548 put it there. Delete the pin and the CLI waiver, and assert the opposite instead. WSL is the only platform whose install shells out to Windows interop mid-script, and interop relays the stdin it inherited, so this job is the one that can catch the pipe being drained again. A truncation here is now a hard failure. * Gate the no-elevation Linux install and split off the no-transport case * Assert no source build on the hosted Windows legs and keep winget for the desktop lane * Retry the container root CA seeding instead of failing on one Windows Update timeout * Run the clean-machine workflow for the prebuilt installer helpers it overlays * Narrow the container pin to its own gates and scan uv and the venv interpreter for arch * Tighten the clean-machine comments * Re-assert toolchain absence after the desktop .deb pulls its dependencies * Retire the #7549 pins and add a wget-only Linux leg #7549 is in main, so the three known-outcome pins that were waiting on it are stale and would now hard-error by design. Each is replaced by the assertion it was standing in for rather than deleted: win windows-11-arm now gates. The x64-on-ARM64 resolver is asserted as an outcome: the venv interpreter reports win-amd64 from its own sysconfig, and torchaudio (no win_arm64 wheel at any version) is installed. Measured on the integration branch before #7549 merged: "only a native ARM64 Python 3.13 was found" -> "installing x64 Python" -> torchaudio 2.10.0+cpu, install green. win windows-latest / winget=masked now gates. The relaxed git gate is asserted from both sides: the old unconditional message must be absent, the no-git branch must have been reached (so the row cannot pass because git leaked back onto PATH), and setup.ps1 must report git as absent-but-not-required. Both Windows rows, and the visible one, gained the usability check the Linux legs have had and Windows never did: a managed interpreter, an unsloth CLI on disk, and that CLI actually running. nobuild and the toolchain check only read the log, so an installer that exited 0 having produced nothing satisfied them. The torch assert also loses its fallback to whatever `python` resolves to. The virgin container overlay row gates, and asserts what only that lane can: it is the one environment whose System32 does not already ship the VC++ 2015-2022 runtime, so it is the only place Ensure-VCRedist's direct aka.ms download can be proved to run rather than be short-circuited. The overlay=false row keeps a pin, with a new reason: it installs unsloth from PyPI on purpose, and setup.ps1 inside 2026.7.5 (uploaded the 23rd) predates #7549, so it still stops at the old gate. That is release lag, it flips on the next release, and the pinned signature is now the old wording rather than "#7549 has not landed". Also adds linux ubuntu2404-nonroot-wget. install.sh's download() takes curl or wget and _transport_missing is true only when both are gone, so a wget-only box is supported on paper, but the gating nonroot leg provisions ca-certificates AND curl, so curl won every probe and the wget branch had never run. Same image, same no-sudo user, same asserts, wget instead of curl, and curl proved absent on disk for root and for tester before AND after the install, so the claim is that every download went through wget rather than that curl happened to be unused. * Tighten the clean-machine CI comments Comments only, no assertion logic, pins or leg definitions touched. Reflowed every rationale block to denser wording and removed the duplication that had built up across repeated steps: the desktop workflow repeated the fork-PR skip, the desktop-v* tag resolution and the restore-runner note once per platform, and the installer workflow repeated its path-filter rationale in both the pull_request and push blocks. Those now point at the first copy. Every WHY is kept: why the masked legs avoid install.sh --local, what UNSLOTH_CI_SOURCE_OVERLAY is for, why `absent` tests "must not work" rather than command -v, why the .venv_t5_* sidecars are in the macho scan scope, why the signature check is main-executables-only, why each nobuild allowlist entry is a pure-Python sdist, why the WSL job gates and what the pipe truncation was, and why the virgin container's overlay=false row is still pinned. Proved comments-only three ways: both workflow revisions parsed with yaml.safe_load_all and every leaf walked (only `run:` scalars differ); every changed bash body and .sh compared byte-for-byte after `bash --pretty-print -n`; every changed pwsh body and .ps1 compared as a token stream with Comment and NewLine tokens dropped. A negative control injecting one non-comment line into each layer makes all of them fail. * Clean machine CI: strip Strawberry, make the Fedora pin gating, run the Linux CLI desktop windows failed the strip verification because windows-latest ships a MinGW toolchain under C:\Strawberry\c\bin, which matches none of the drop fragments; the installer workflow already scrubs it. Fedora sat behind job-level continue-on-error, so its outcome pin could not fail the run. Tolerate the install step instead, as the no-transport row does. The Linux usable-install check only tested the executable bit; Windows and WSL already execute the CLI. The macho scan now fails when no venv interpreter was scanned, rather than letting uv alone satisfy the outside-root guard. * Clean machine CI: tighten the comments Round 12 comment reduction: compress wording, keep every reason. Comments only, verified with a YAML leaf walk (differences only inside run: scalars, only on # lines), bash --pretty-print -n byte comparison, a PowerShell token-stream diff and a Python AST comparison. * Clean machine CI: dereference the venv interpreter, pin the deb deps and the Windows disposition file did not follow the <venv>/bin/python symlink find -L printed, so it answered 'symbolic link to ...' and the Mach-O test dropped the one interpreter the Rosetta scan exists to check. Read with file -Lb and count what was classified, not what was found. apt treats a toolchain package the strip only renamed as already installed, so a .deb that started declaring git or cmake would never restore it and the absent re-check would still pass. Assert the declared Depends instead. The Windows lane accepted any preflight disposition although the bundled installer was already required to build a working venv; NotInstalled or ManagedStale there means the app cannot boot what it just installed. * Clean machine CI: assert every masked tool, and re-select the developer dir last clean-machine-env.sh moves ten tools aside and only warns when a move fails, but absent checked four of them, so a surviving gcc -- which install.sh probes for build-essential -- went unnoticed. restore.sh ran xcode-select --switch before the line that moved CommandLineTools back, so it named a still-masked directory, failed into || true and left the selection link unrestored. Capture the original selection and re-apply it after both directory restores. --------- Co-authored-by: danielhanchen <[email protected]>
…#7188) * feat(studio): GGUF host-residency memory mode + Vulkan gpu_ids pinning Narrowed to complement #6414 (merged), which already provides the GGUF GPU device picker, gpu_memory_mode (auto/manual), gpu_layers, n_cpu_moe, and tensor_split. This adds only what #6414 lacks: 1. Host-residency `gguf_memory_mode` (auto/pinned/resident) mapping to llama.cpp --mlock / --no-mmap. Distinct from #6414's gpu_memory_mode (that controls VRAM/layer offload; this controls host-RAM residency). Default auto is a no-op: an omitted value launches identical argv/env to main. First-class field shadows and scrubs inherited --mmap/--no-mmap/--mlock and LLAMA_ARG_MLOCK/NO_MMAP/MMAP so a stale value can't leak. Backend/API-driven (mirrored from /status), no new UI control. 2. Vulkan-ordinal gpu_ids hardening. #6414 rejects gpu_ids on a Vulkan build with HTTP 400; this replaces that with real pinning: gpu_ids are treated as ggml Vulkan ordinals (matched against the probe directly, never remapped through CUDA_VISIBLE_DEVICES), pinned via --device Vulkan<i>, with conflicting user --device / inherited LLAMA_ARG_DEVICE stripped under a pin, and the training coexistence guard budgeting conservatively against the least-free card (ordinals can't map to physical free-VRAM). Backend: gguf_memory_mode field + validator (LoadRequest / ValidateModelRequest, echoed on responses); _memory_mode_flags / _canonical_memory_mode; strip_memory_mode + strip_device in llama_server_args; is_vulkan_build / assert_requested_gpu_ids_resolvable; memory-mode reload-dedup in _already_in_target_state and the route matcher (device-stripped under a pin, mirroring the launch); gpu_ids_are_vulkan_ordinals budgeting in training_vram. Frontend: a read-only activeMemoryMode mirror wired into the existing reload flow (no dropdown). #6414's gpu_ids picker is untouched. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Preserve inherited memory flags and reject GPU pins on CPU-only llama.cpp builds - strip_shadowing_flags: default strip_memory_mode to False (opt-in, matching strip_offload / strip_tensor_split / strip_device). The inherit resolver now strips an inherited --mlock/--mmap/--no-mmap only when the request supplies gguf_memory_mode, so a same-model Apply that omits the field keeps a user's pass-through memory flag instead of silently dropping it. - /load and /validate: on the CUDA path, reject explicit gpu_ids when the llama.cpp build ships no cuda/hip/vulkan ggml lib (CPU-only). Such a build ignores CUDA_VISIBLE_DEVICES, so the pin would run on CPU while the API reports it active. Mirrors the non-CUDA resolvable check. - Document that gpu_ids are ggml Vulkan ordinals on a Vulkan build (enumerated independently of CUDA_VISIBLE_DEVICES), not CUDA physical indices. - Add regression tests: CPU-only route reject, inherit preserve/strip of memory flags, and the flipped strip_memory_mode default. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Detect versioned Vulkan libs and sync memory mode across all load paths - _is_vulkan_backend now matches versioned Vulkan sonames (libggml-vulkan.so.0) via a shared _lib_dir_has_ggml_backend matcher, unified with _backend_lacks_gpu_lib so Vulkan detection and the CPU-only-build check agree. A distro/split-lib Vulkan install without the dev-only unversioned symlink is now detected as Vulkan and gets the --device Vulkan<i> pin instead of being misread as CUDA. This also keeps the Chat Settings picker reliably disabled on Vulkan builds (main.py gates gguf_gpu_ids_supported on this detection), so the UI never emits physical indices into the Vulkan-ordinal route. - Frontend: fold activeMemoryMode into loadedGpuMemoryFields so every successful load path (primary, rollback, compare-load, GGUF/non-GGUF/MTP auto-load) resets it from the LoadResponse, not just the primary path. Prevents a stale pinned mode from an earlier model being re-sent by an immediate same-model Apply. - Add test_is_vulkan_backend_matches_versioned_soname. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Pin get_device in gpu_ids GGUF route test for GPU-less CI test_inference_route_validates_gpu_ids_for_gguf patches resolve_requested_gpu_ids to exercise the CUDA physical-ID resolver, but did not pin the device. On a GPU-less CI runner get_device() returns non-CUDA, so the route took the non-CUDA/Vulkan deferral branch whose 'no GPU backend detected' 400 contains the substring 'not supported', tripping the test's assertNotIn. Pin get_device to CUDA so the test deterministically covers the path it intends. * fix(tests): simplify ordering assertions and tighten GPU validation error message * fix(studio): add GGUF variant check before reusing draft extras; apply aggregate headroom to Vulkan multi-GPU pins - inference.py /load path: check extra_args_source and gguf_variant before reusing a loaded server's extra_args for draft-device validation, so a different quant of the same repo no longer inherits stale --spec-draft-device. - inference.py /validate path: same variant-aware check before inspecting stored backend extras for draft-device rejection. - training_vram.py: Vulkan multi-GPU pin now also enforces the aggregate _MULTI_GPU_OVERHEAD (0.85) check instead of returning early on per-GPU min_free alone, preventing a chat load from starting with too little protected headroom and OOMing an active training run. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix(studio): harden Vulkan probe/budget and diffusion classification for GGUF placement - Use the versioned-soname matcher in the Vulkan free-memory probe too, matching _is_vulkan_backend: a split-library install that ships only libggml-vulkan.so.0 is now sized correctly instead of returning no devices and rejecting gpu_ids. - Budget the Vulkan multi-GPU aggregate over the least-free N pinned cards, not all visible GPUs: with the ordinal to physical mapping unknown, summing every visible card could approve a pin that no N-card placement can actually hold. - Classify a GGUF from its local header before the name heuristic: a normal llama-server GGUF whose path or repo merely contains "diffusion" is no longer rejected for gguf_memory_mode, since the loader routes on the decoded header. - Compute the Vulkan-ordinal flag before diffusion_gpu and gate diffusion_gpu off when it fires, so an unclassified GGUF pinned on a Vulkan build is budgeted as ordinals instead of the single-device CUDA path sizing the wrong physical card. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix(studio): gate XPU gpu_ids rejection to non-Vulkan; skip GGUF memory-mode reject for non-GGUF - /load and /validate paths now detect the Vulkan build before the XPU rejection so Vulkan-backed Intel GPUs can use gpu_ids via --device Vulkan<i> ordinals instead of being blocked by the torch-xpu device check. - _reject_diffusion_memory_mode now returns early for non-GGUF configs so a stale or shared payload with gguf_memory_mode cannot block unrelated non-GGUF loads. * fix(studio): skip llama.cpp GPU-lib check for diffusion; resolve versioned Vulkan libs in probe - /load and /validate paths now skip _backend_lacks_gpu_lib for confirmed DiffusionGemma GGUFs, since the diffusion runner bypasses llama-server and handles gpu_ids via --gpu/DG_GPU independently of the llama.cpp build. - _vulkan_probe.py now resolves versioned sonames (libggml-vulkan.so.0 etc.) via a directory scan so split-lib installs that lack the unversioned symlink are no longer rejected with no visible devices. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * test(studio): cover diffusion gpu_ids skip + versioned Vulkan soname; mirror is_vulkan_build on draft-device stubs - Add is_vulkan_build to three draft-device test stubs so they mirror the real backend: the gpu_ids validation now reads it before the draft-device reject. - test_cpu_only_llama_build_skips_reject_for_diffusion_gguf: a diffusion GGUF is served by the visual-server runner, so a CPU-only llama.cpp build does not reject its gpu_ids (the flow reaches the id resolver past the skipped reject). - test_versioned_only_vulkan_soname_is_probed: a split-library install shipping only libggml-vulkan.so.0 is still classified Vulkan and probed, not rejected. * fix(studio): route confirmed diffusion gpu_ids through the CUDA path on a Vulkan build A confirmed diffusion GGUF is served by the visual-server runner, which takes a CUDA physical id via --gpu/DG_GPU (it remasks CUDA_VISIBLE_DEVICES), never a Vulkan ordinal. The gpu_ids preflight previously sent it to the Vulkan-ordinal branch whenever the installed llama-server was a Vulkan build, so a valid physical pick could be rejected (no matching Vulkan ordinal) or an ordinal validated that the runner then applies to the wrong CUDA GPU. Route a confirmed diffusion GGUF through the CUDA resolver at both /load and /validate even on a Vulkan build, matching the training guard's existing diffusion_gpu handling. * Keep llama.cpp fit headroom * Adapt host memory modes to llama.cpp load mode * feat(studio): expose GGUF host memory controls * Clarify GGUF host memory semantics * Expose Vulkan ordinals in the GGUF GPU picker * Show Vulkan hardware names in the GPU picker * Clarify the llama.cpp Vulkan backend selector * Keep explicit Vulkan choices authoritative * Preserve requested and effective GGUF GPU pins * Align GGUF dedupe fixture with requested GPU pins * Restore Vulkan diffusion pin guard * Close GPU backend integration gaps * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Simplify GGUF placement state and validation * Trim GGUF placement comments * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Address GGUF placement review findings * Address GGUF placement review follow-ups * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Reject invalid remote diffusion placement before teardown * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Correct Vulkan GGUF placement boundaries * Simplify Vulkan metadata handling * Preserve deferred GPU index namespaces * Preserve deferred GPU and memory settings * Preserve host memory in compare loads * Handle DiffusionGemma memory settings * Use semantic preset summary font size * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Enforce host memory environment overrides * Keep host memory default implicit * Clarify host memory settings * Clarify host memory choices * Clarify Host RAM choices * Explain Host RAM behavior * Limit Host RAM wording change * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Guard GPU selections by backend namespace * Correct Host RAM placement semantics * Restore the GGUF fit target * Remove GGUF Host RAM controls * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Correct GPU placement comments * Fix DiffusionGemma GPU selection capabilities * Make GPU selections own main device placement * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Trim GGUF placement regression coverage * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Remove orphaned memory policy and close Vulkan gaps * Correct draft-device recovery guidance * Fix Vulkan source and training device handling * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Align automatic Vulkan device pools * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fail closed on explicit Vulkan no-space, refresh the GPU picker on probe recovery setup.sh and setup.ps1 both dispatch the prebuilt installer's exit status before checking whether Vulkan was explicitly requested, so status 4 (no disk space) took the no-space branch and never reached the strict-backend check in the else. With an older CUDA, ROCm or CPU llama-server already installed, _has_local_llama_server kept _LLAMA_CPP_DEGRADED false, so setup exited 0 and Studio carried on using the backend the user asked to replace. Driving the real dispatch block with a stubbed installer shows the same explicit request exiting 1 on a generic failure and 0 on a no-space failure. Apply the same check to the no-space path in both scripts. useGpuDevices fetched /api/system once from an effect with no dependencies and subscribed to nothing. When the Vulkan probe is unavailable, main.py answers gguf_devices as an empty list rather than omitting it, so the "?? devices" fallback does not apply and the picker starts hidden. useInferenceGpuInfo then retries every 3 seconds and refreshes the shared cache, but nothing told the mounted device hook, so the picker stayed hidden until it was remounted. Notify subscribers when a refetch replaces the cache and have useGpuDevices subscribe, comparing by value since each refresh builds a fresh array and an unconditional set would re-render on every retry tick. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix Vulkan placement state and installation * Use published Vulkan bundles * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Consolidate llama.cpp backend selector * Specify UTF-8 for file operations * fix(studio): harden GGUF GPU placement * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix(studio): align backend selection contracts * fix(studio): align MTP draft device placement * fix(studio): address Codex P2s on legacy Vulkan env var and cold-cache GPU pins - llama_backend_from_env() (and setup.sh/setup.ps1's shell-level mirror) falls back to the legacy UNSLOTH_LLAMA_BACKEND when UNSLOTH_LLAMA_CPP_BACKEND is unset, so an existing UNSLOTH_LLAMA_BACKEND=vulkan environment keeps forcing Vulkan across the setup.sh/setup.ps1 consolidation instead of silently reinstalling CUDA/ROCm/CPU. - loadedGpuMemoryFields() no longer drops a just-applied gpu_ids pin to null when cachedPinnableGpuIndexKind() returns undefined (cache cold / Vulkan probe not ready yet). That state is deferred, not rejected: the pin is kept so a reload/rollback during that window still sends gpu_ids instead of letting llama.cpp fall back to every device. The third P2 (force-compile skipping the Vulkan-source-build rejection) was already fixed by an earlier commit on this branch -- verified _NEED_LLAMA_SOURCE_BUILD is set before the guard runs in both setup.sh and setup.ps1, and added a regression test locking in the ordering. Co-Authored-By: Claude Sonnet 5 <[email protected]> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: fix Vulkan backend env fallback and GGUF preflight token Three narrow correctness fixes on the Vulkan GPU selection path. setup.sh / setup.ps1 consulted the legacy UNSLOTH_LLAMA_BACKEND only when UNSLOTH_LLAMA_CPP_BACKEND was empty, while install_llama_prebuilt.py's llama_backend_from_env() consults it whenever the new var is not an explicit backend name. With UNSLOTH_LLAMA_CPP_BACKEND=auto beside a legacy UNSLOTH_LLAMA_BACKEND=vulkan the shell dropped the request, leaving _explicit_vulkan_backend and _explicit_vulkan_source_build false while the installer it launches still planned Vulkan, so a Vulkan install that could not be satisfied silently degraded to a CUDA/ROCm/CPU build instead of failing closed. Mirror the Python rule in both scripts; an unrecognized value with no legacy backend is still preserved so the warning can name it. The new GGUF diffusion preflight in the chat load path sent the raw stored HF token to /validate before validateModel/loadModel could run prepareHfTokenForUse. The Hub rejects an invalid Authorization header with 401 even on a public repo, so a stale saved token aborted the whole load instead of offering the existing continue-anonymously/replace-token recovery. Prepare the token the same way the compare path already does. The training guard handed can_load_chat_during_training an empty Vulkan free-VRAM map for an unclassified GGUF on a Vulkan build. That reads as no free VRAM anywhere, so every uncached remote GGUF was refused with 409 while training ran. Only an explicit pin is unbudgetable (the ordinal belongs to one namespace and neither can stand in for the other); automatic placement has no ordinal to mis-map, so it keeps the torch view. Each fix has a regression test that fails without it. * Let the diffusion runner take physical ROCm indices device_backend is a display label: _backend_label swaps CUDA for "rocm" when IS_ROCM is set, but ROCm reuses torch.cuda.* and the DiffusionGemma runner selects by the same physical index either way. Gating on "cuda" alone marked every physical ROCm device unpinnable, so the picker vanished on multi-GPU ROCm hosts and status hydration could discard a valid selection. * fix(studio): keep unavailable Vulkan inventory out of CUDA fallback, prepare autoload HF token, restore legacy hip/rocm opt-out Three P2s from the latest Codex review round on PR #7188: - toGpuDevices(): a confirmed-Vulkan inference backend with a still-cold or transiently-empty device probe no longer falls through to the torch/CUDA inventory. That fallthrough was marking physical CUDA/ROCm devices diffusionPinnable, exposing a GPU picker for DiffusionGemma that sent IDs the backend rejects outright whenever is_vulkan_build is true. Now returns no devices until the Vulkan probe actually succeeds. - loadAutoLoadCandidate(): the startup auto-load path's diffusion-classifying fetchGgufStagedMetadata probe (fired when a cached GGUF has saved gpu_ids) sent the raw stored HF token, bypassing prepareHfTokenForUse. Unlike validateModel/loadModel (which prepare internally), fetchGgufStagedMetadata does not, so an expired token could 401 even a public repo and abort the candidate before the anonymous/replace-token recovery flow got a chance to run. Now prepares the token first, mirroring performLoad's identical guard. - _normalized_llama_backend(): dropped hip/rocm entirely during the backend- selector consolidation, despite force_vulkan_requested()'s own comment ("so =hip is a real opt-out a stale UNSLOTH_FORCE_VULKAN cannot overrule") and _route_to_vulkan_prebuilt()'s ("an explicit hip/cpu is the opt-out") describing behavior it no longer delivered. An existing UNSLOTH_LLAMA_BACKEND=hip/rocm environment on an unsupported HIP arch read as "no backend named" and silently routed to Vulkan (auto-fallback, or a stale UNSLOTH_FORCE_VULKAN=1). Restored hip/rocm recognition (canonicalized to "hip"), matching the pre-consolidation mapping. Regression tests added for all three. * Cover the auto-load HF token preflight behaviourally The contract test added alongside the fix asserts on the source text. This runs the real classification block out of chat-adapter.ts under node with a stubbed Hub that 401s any non-null Authorization value, so it fails on the token value that actually reaches /api/inference/validate rather than on a symbol being present. Reverting only the source (leaving the import in place) reddens it with the simulated 401, not an ImportError. * Converge Vulkan backend selection and review fixes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Stop the structlog stub shadowing the real package for PR #7188 The bare setdefault parked an empty placeholder before anything imported the real structlog, so every later module calling structlog.get_logger at import time raised AttributeError. It only bit when this file was collected first, which is why the 8 hardware-dispatch cases passed alone and failed under pytest tests/studio. Only stub when the package is genuinely absent. * Prepare model settings GGUF token preflight * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Keep the established llama.cpp backend selector * Preserve GPU namespace while Vulkan inventory recovers * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix final PR 7188 review findings * Normalize llama.cpp device flag aliases * Converge PR 7188 review findings * Honor backend opt-outs for Intel Vulkan routing * Retry cold system discovery for GPU selection * Probe structlog with find_spec instead of a bare import The availability check imported the module purely for its side effect, so the import-hoist verifier flagged it as an added-but-unused import and failed Source lint. find_spec answers the same question without binding a name. * Brace the PowerShell variable in the setup.ps1 backend-choice probe * Leave an existing structlog entry alone in the availability probe find_spec raises ValueError on a module already in sys.modules whose __spec__ is None, which is what a bare types.ModuleType stub is. Check sys.modules first so anything already present, real or stubbed, is left untouched and only a genuinely absent package gets stubbed. * Consolidate duplicated Vulkan selector tests without changing behaviour Three of the tests added for the llama.cpp backend selector asserted on the same two helpers with the same inputs, and two more differed only in whether the backend arrived from the environment or from --llama-backend. Fold them into the parametrized cases that already covered those helpers: - test_llama_cpp_backend_env_requests_vulkan, test_llama_cpp_backend_auto_does_not_trigger_vulkan and test_hip_backend_env_opts_out_of_vulkan become rows on test_force_vulkan_requested_accepts_public_selector_and_legacy_alias, which now also asserts llama_backend_from_env() alongside force_vulkan_requested(). The unset case and the whitespace-padded HIP/ROCM values keep their coverage as new rows. - test_explicit_non_vulkan_backend_suppresses_intel_auto_route and test_non_vulkan_backend_argument_suppresses_intel_auto_route become one test parametrized over the env and argument paths. - test_unclassified_gguf_without_pin_keeps_the_torch_budget and test_unclassified_gguf_with_pin_refuses_to_budget shared the same four patches and differed only in the pin, so they become subtests of one case. No source changes and no assertion is dropped. Each behaviour was re-checked by reverting the source hunk it guards and confirming the surviving test fails on a value. * Keep the standing GPU mode on diffusion loads and the ARM64 Vulkan fallback for PR #7188 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Make the Intel auto-route guard test able to fail and stop the ps1 harness doubling --force-cpu test_non_vulkan_backend_suppresses_intel_auto_route ran on Linux x86_64, where dropping the explicit_backend guard changes only a log line, so the test passed either way. Move it to Linux ARM64 + Intel GPU, the host where the guard decides the routed repo, and assert that value. _run_ps1 composed the --force-cpu snippet twice: it is already inside the normalized block the helper extracts. The substring assertion hid the duplicate. Compose it once and compare the whole argv. setup.ps1 appends the flag once and is unchanged. * Dot-source Get-HostMachineArch in the setup.ps1 Pester suite #7549 taught Test-VCRedistInstalled to consult the host architecture before trusting the System32 DLL. The Pester suite dot-sources a fixed list of functions out of setup.ps1 one at a time, and that list did not gain the helper, so the two clean-box cases (registry miss, and an old sub-14.20 redist) throw "Get-HostMachineArch is not recognized" instead of returning false. The registry hit returns early, which is why the other cases pass. #7597 made exactly this fix to the sibling list in the VC++ round-trip job but left the Pester suite alone. Verified with pwsh 7.6 + Pester: 3 failed before, 31 passed 0 failed after. * Drop the branch's Pester Get-HostMachineArch fix now that #7606 landed This branch carried a local fix for the same Pester dot-source gap that #7606 has since merged to main (f21b280). Keeping both leaves the PR diff with an unrelated, now-duplicated change, so drop the branch copy and take main's. --------- Co-authored-by: danielhanchen <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: oobabooga <[email protected]> Co-authored-by: alkinun <[email protected]> Co-authored-by: Daniel Han <[email protected]> Co-authored-by: Lee Jackson <[email protected]> Co-authored-by: Claude Sonnet 5 <[email protected]> Co-authored-by: danielhanchen <[email protected]>
The virgin Windows container row that installs from PyPI on purpose was tolerated with continue-on-error, because a Server Core container has no Microsoft Store and so no winget, and the released studio/setup.ps1 hard-stopped on a winget-only git gate and reached for winget again for the VC++ runtime. #7549 relaxed both, but it landed on 2026-07-28 and the newest wheel was 2026.7.5 from the 23rd, so the row could not get past it. The pin carried its own tripwire for exactly this moment, and it has fired: unsloth 2026.7.6 shipped 2026-07-29 and the released wheel now installs end to end, so the step reported success and the assertion errored with "delete this pin and drop continue-on-error from the Install step so this row gates". Doing that. Both rows now gate unconditionally, and the assertion that enumerated the accepted failure signatures goes with the pin it protected, since there is no longer an accepted failure for it to describe. The other three release-lag mentions in this file are descriptive rather than tolerated-failure pins: they explain why the fedora and ubuntu-nonroot legs run with overlay: true, and both already refuse a triton failure as a regression rather than accepting it as lag. Left alone.
* Build the packing test collator from TRL's live signature TRL 1.7.0 removed completion_only_loss from trl.trainer.sft_trainer.DataCollatorForLanguageModeling when label construction moved from collation into dataset preparation (huggingface/trl#6037). tests/utils/test_packing.py passed that kwarg on every construction attempt, so on TRL 1.x every attempt raised TypeError, _DummyTrainer.data_collator was never assigned, and test_enable_sample_packing failed with AttributeError on the HF=latest + TRL=latest matrix leg. Filter the collator kwargs against the installed dataclass signature so the dummy tracks whatever fields TRL currently exposes, and add a regression test pinning the production contract that enable_sample_packing only requires torch_call on the collator. (cherry picked from commit 5d8513b) * Retire the virgin container release-lag pin now that the released wheel carries #7549 The "virgin win container / overlay=false" row installs unsloth from PyPI on purpose, so its studio/setup.ps1 comes out of the released wheel. A Server Core container has no Microsoft Store and so no winget, and the released setup.ps1 hard-stopped on a winget-only git gate and reached for winget again for the VC++ runtime, so that row could not install end to end. #7549 relaxed both gates but merged on 2026-07-29, after the then newest wheel 2026.7.5 (2026-07-23), so the row was held under continue-on-error and a step that asserted it failed only on that known signature. unsloth 2026.7.6 shipped later the same day and is the first wheel to carry the relaxed gates: unpacking it shows the old "Git is required but could not be installed automatically" wording gone and both "so git is not needed" and "downloading the runtime directly" present. The row now installs end to end and the pin's own tripwire fired to say so. Drop continue-on-error from the Install step and delete the release-lag assertion, so the released-wheel row gates like the overlay row. The Install step is already passing on this row in recent runs, so nothing else is being tolerated by the escape hatch being removed. (cherry picked from commit cf0b25e) * Check the harness verdict on both container rows Removing the released row's tripwire made a green released row reachable for the first time, and the only log-based verdict check sat behind `if: matrix.overlay`. Every later step is `if: always()` and exits 0, so that row was gated on `docker exec`'s exit code alone -- which the file already notes can be 0 for an exec that lost its container. Hoisted the marker check out of the overlay step so both rows read the harness's own verdict; the overlay-specific assertions stay gated. (cherry picked from commit 7613460) * Wait for the floating monitor's system payload before baselining its geometry The geometry check baselines the panel with a single bounding_box() taken as soon as the caller observes an /api/system request go out. The response has not been applied yet at that point, so the panel is still painting use-system.ts's zero-filled DEFAULT_SYSTEM, which reports no GPU. On a host that does report one the VRAM row then lands and adds a row permanently, so the panel never returns to the sampled baseline and "content shrink" waits out its whole 5s deadline before failing. That is why this looked flaky but is not: macos-14 reports a single MLX device and failed on every PR, while ubuntu-latest and windows-latest have no GPU row to add and passed. Three jobs share the name "Chat UI Tests", so the one consistent platform failure read as one of three parallel runs failing at random. Wait for the payload to be rendered and for the panel to have finished resizing to it before sampling the baseline. The gate requires a non-zero RAM total, the scroll region to exactly fit the content it was reconciled against, and that geometry to hold for two consecutive animation frames, which is how Playwright defines a stable element and is what wait_for_function's default polling="raf" provides. (cherry picked from commit 7d5cc8c)
…ce-only tier pyarrow ships no win_arm64 wheel at any version and datasets requires it, so a native ARM64 Python cannot install the Studio stack. install.ps1 has swapped a freshly selected interpreter for x64 since unslothai#7549, but every path that REUSES one checked version and conda-ness only, so a migrated venv or an UNSLOTH_SETUP_PYTHON handoff still died in a pyarrow source build. - install.ps1: bootstrap x64 by default on an ARM64 host, re-probe a migrated venv and rebuild it through the existing rollback when it is not win-amd64. - setup.ps1: one Test-CompatibleSetupPythonArch gate on all five interpreter paths, a clear failure for an ARM64 environment, and --architecture x64 for winget. - install_python_stack.py: preflight before the venv is touched. - install.sh: range-check --python / UNSLOTH_PYTHON instead of surfacing an unsupported minor as a bare pyarrow resolver error. When no x64 interpreter can be obtained, install the ARM64 inference-only tier (UNSLOTH_NO_DATASETS + .unsloth-no-datasets marker) rather than fail: it drops the packages with no win_arm64 wheel, gates the dataset routes to 503 and reports chat_only datasets_unavailable so the UI explains the greyed-out Train. Fixes unslothai#8495
Four independent Windows blockers, each small and each found by running the installer on a stripped machine.
1. git was a hard failure on the consumer path
studio/setup.ps1calledExit-SetupFailurewhen git was missing, justified in a comment as "required by pip forgit+https://deps and by npm". Neither holds for a normal install:git+https://URL for unsloth-zoo is only used underSTUDIO_LOCAL_INSTALLThis is the same over-requirement macOS had with the Xcode CLT. git stays fatal for
--local, where it genuinely is needed.2. VCRedist was winget-only
Ensure-VCRedistonly ever tried winget. On hosts without it (LTSC, Server, managed corporate images) it silently did nothing, the install still reported success, andimport torchlater failed on a missingVCRUNTIME140.dll, which reads as a broken install rather than a missing system package.Adds a direct
aka.ms/vs/17/release/vc_redist.<arch>.exedownload with/quiet /norestart, accepting exit codes 0 and 3010 (success, reboot required).To be explicit, since it sits next to changes going the other way: the redistributable stays required. It is the runtime that the prebuilt
llama-serverand PyTorch link against, not the MSVC compiler. CMake and VS Build Tools are already detection-only and stay that way.3. Windows on ARM fails unintelligibly
Measured with uv against both
download.pytorch.org/whl/cpuand PyPI, foraarch64-pc-windows-msvc/ cp313:Wheels exist only for
win_amd64and the manylinux targets. So the installer burned three uv retries on an unsatisfiable resolution and then reported:That reads like a network fault. It now fails immediately, names the real cause, and points at
--no-torch, which is a working path there becauseunslothai/llama.cppdoes publishwindows-arm64-cpu.This is an upstream gap, not something the installer can fix. Worth stating plainly rather than retrying into it.
4. Node install raced a file lock on fresh installs
install_node_prebuilt.pyhit[WinError 5] Access is deniedonos.replaceof the freshly extracted directory, on a fresh install with nothing to overwrite. That is a scanner or indexer holding handles for a moment._replace_with_retryretries onlywinerror5, 32 and 145 with capped exponential backoff. Any otherOSErrorstill raises immediately, so a genuine permissions problem is not papered over. 5 new tests, 84 pass intests/studio/install/test_install_node_prebuilt_logic.py; they fail without the fix.Verification
install.ps1andstudio/setup.ps1both parse clean under the PowerShell AST parser. The Node change is covered by unit tests. The winget-visible and winget-masked legs, pluswindows-11-arm, run in the clean-machine CI in a separate PR.