Skip to content

CI: prove the installer works on a machine with no developer toolchain - #7551

Merged
danielhanchen merged 46 commits into
mainfrom
ci/clean-machine-install
Jul 29, 2026
Merged

danielhanchen merged 46 commits into
mainfrom
ci/clean-machine-install

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Why nothing caught the clean-Mac failure

studio-mac-install-matrix.yml is the only macOS installer job. It runs bash install.sh --local --no-torch on runners that already have the Xcode CLT selected and actions/setup-python preinstalled, so the CLT gate never fires, 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, and no clean-machine simulation of any kind.

What this adds

clean-machine-install-ci.yml runs the installer on a genuinely stripped machine.

  • macOS (macos-14, macos-15, macos-26, plus macos-15-intel informational): moves /var/db/xcode_select_link, /Library/Developer/CommandLineTools, /Applications/Xcode*.app and Homebrew aside so xcode-select -p, git, cc and clang genuinely fail. Restores unconditionally in an if: always() step.

    Removing the select-link alone is not enough: xcode-select falls through to a full Xcode.app and re-arms /usr/bin/git. That took a run to discover.

  • Linux: containers, which are the only genuinely virgin machines available. Root, non-root, arm64, and a non-apt fedora:41 leg.

  • Windows: winget visible and winget masked (the no-winget path was completely untested and is exactly where Ensure-VCRedist silently did nothing), plus windows-11-arm.

  • WSL: covers the 126 lines of WSL-specific install.sh logic that had no runtime test at all.

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 broken" from "pipe delivery broken"), --no-torch, and tauri (stdin closed, no tty, exactly how the desktop app invokes it).

desktop-app-clean-machine-ci.yml installs and launches the shipped desktop app release on a stripped machine: Gatekeeper and quarantine on macOS, NSIS silent install on Windows, Xvfb with WebKit2GTK on Linux.

The part that matters most

One leg records every toolchain invocation and asserts the trace. That is the real deliverable: proof the installer never reached for a compiler, not just proof that it happened to succeed. A green install with an empty trace is a much stronger claim than a green install.

Two details worth flagging for review, both found the hard way:

  • The asserts test that tools do not work, not 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. An assert on command -v would be unfaithful and would fail on a correctly masked runner.
  • Failing "poison shims" on PATH are deliberately not used. A shim would do the opposite of what is wanted: command -v finds it and reports the tool as present.

Results

Against unmodified main, the macOS legs reproduce the reported failure exactly (Xcode Command Line Tools are required followed by curl: (56)). With #7547 they install cleanly and the recorded trace for a full install is a single xcode-select -p.

fedora:41 and windows-11-arm also fail on main. Those are separate real bugs, fixed in #7547 and #7549.

Known limit

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. A nightly ephemeral-VM lane covering notarization and DMG launch is the follow-up, out of scope here.

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c5b4f5ee86

ℹ️ 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".

set -a; [ -f ./clean-machine.env ] && . ./clean-machine.env; set +a
APP="$(ls -d /Applications/*Unsloth*.app | head -1)"
BIN="$APP/Contents/MacOS/$(/usr/libexec/PlistBuddy -c 'Print :CFBundleExecutable' "$APP/Contents/Info.plist")"
"$BIN" > logs/app-stdout.log 2>&1 &

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Exercise the bundled installer before passing

On a fresh profile, preflight handles not_installed by setting that status and returning (studio/frontend/src/hooks/use-tauri-backend.ts:252-254), while startup-screen.tsx:388-389 waits for the user to click Install. This workflow only starts the binary and waits for it to remain alive, so every platform can pass while sitting indefinitely on the not-installed screen without ever executing the bundled installer—the exact path this workflow is intended to validate.

Useful? React with 👍 / 👎.

ls -la dl

- name: Strip the developer toolchain
if: ${{ inputs.strip_toolchain != false }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Strip tools when dispatch inputs are unavailable

For pull_request and schedule events, inputs.strip_toolchain is absent; GitHub expression loose equality coerces that empty value and false to the same numeric value, making inputs.strip_toolchain != false evaluate false. Consequently the macOS strip step, and the identical Windows condition at line 291, run only for explicit dispatches, while the automatic PR and nightly jobs retain the hosted developer toolchain and no longer test the workflow's central clean-machine contract.

Useful? React with 👍 / 👎.

# aliases from PATH. A full Visual Studio uninstall is not realistic in
# CI (registry + vswhere discovery, slow, may need a reboot), so PATH and
# env scrubbing is the honest approximation -- recorded as such.
$drop = @('hostedtoolcache\windows\Python', 'WindowsApps', '\Git\',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep winget in the visible matrix leg

On standard hosted Windows runners, winget.exe is exposed through a path containing WindowsApps, but this unconditional drop list removes every such entry before the matrix-specific masking logic runs. The winget=visible leg therefore commonly exercises the same no-winget fallback as the masked leg, and there is no assertion that winget remains resolvable in the visible case, leaving the normal winget bootstrap path untested.

Useful? React with 👍 / 👎.

Comment on lines +373 to +374
$url = 'https://cloud-images.ubuntu.com/wsl/releases/24.04/current/ubuntu-noble-wsl-amd64-24.04lts.rootfs.tar.gz'
$expected = '2a790896740b14d637dbdc583cce1ba081ac53b9e9cdb46dc09a2f73abbd9934'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Pin the WSL rootfs to an immutable URL

The current Ubuntu image URL is mutable, while the following line pins one specific checksum. As soon as Canonical refreshes the 24.04 WSL image, the download will be valid but its hash will differ, causing the informational WSL leg to stop reaching the installer on every run; use a dated immutable image URL or verify against the checksum published alongside the current image.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked live: wsl/releases/24.04/current/ and 20240423/ serve the same file (identical ETag and Last-Modified) and the pinned digest still matches. The leg is continue-on-error, so a future move would not gate anything.

Comment on lines +61 to +62
REL_REPO: ${{ inputs.release_repo || 'unsloth-test/unsloth-test' }}
REL_TAG: ${{ inputs.release_tag || 'desktop-v0.1.50-beta' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Follow the current desktop release in nightly runs

Scheduled and pull-request runs cannot supply workflow-dispatch inputs, so they always download the fixed desktop-v0.1.50-beta artifact from unsloth-test/unsloth-test. After any subsequent desktop release, the nightly job will continue retesting this old fixture and can remain green while the currently shipped artifacts from the production release workflow are broken, contrary to the stated purpose of catching broken published bundles.

Useful? React with 👍 / 👎.

Comment on lines +413 to +414
wsl -d unsloth-ci -u root -- sh -c 'test -x "$HOME/.unsloth/studio/unsloth_studio/bin/unsloth" && "$HOME/.unsloth/studio/unsloth_studio/bin/unsloth" --version || echo "no CLI installed"' 2>&1 |
Tee-Object -FilePath logs/wsl-verify.log

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Fail the WSL check when the installed CLI is missing

If the installer exits successfully without creating the expected executable, this verification substitutes echo "no CLI installed", making the inner shell and the PowerShell step succeed. The job therefore does not enforce the “did it end up usable?” half of the check and can pass despite producing no usable WSL installation.

Useful? React with 👍 / 👎.

Comment on lines +478 to +479
$newPath = ($kept -join ';')
"PATH=$newPath" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Prevent PATH refreshes from restoring the Windows toolchain

This only strips the process PATH exported to the installer, while install.ps1 necessarily calls Refresh-SessionPath after bootstrapping Python or uv; that function rebuilds PATH from the unmodified Machine and User registry values (install.ps1:315-337). On hosted runners those values still contain the Git, CMake, Visual Studio, and LLVM entries removed here, so the developer toolchain becomes available again partway through both Windows legs and later installer work is no longer occurring in the simulated clean environment.

Useful? React with 👍 / 👎.

Comment on lines +31 to +36
push:
branches: [main]
paths:
- 'install.sh'
- 'install.ps1'
- '.github/workflows/clean-machine-install-ci.yml'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Run post-merge CI for helper and setup changes

The pull-request filter includes the clean-machine helper scripts and the three Studio setup files, but the push filter omits all of them. A direct main push or the merge of a PR that changes only one of those dependencies therefore gets no main-branch clean-machine run, even though the workflow behavior under test changed; this also prevents the trusted post-merge context from validating such changes with the credentials intentionally withheld from PR runs.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every path in the pull_request filter is already gated pre-merge, so the missing post-merge rerun loses no coverage. Symmetry rather than a gap.

Comment on lines +298 to +300
useradd -m tester
# No sudo installed and not root -> exercises the "cannot elevate" branch.
chown -R tester logs install.sh

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Give the unprivileged leg a writable install home

The workflow-wide UNSLOTH_STUDIO_HOME points inside the root-owned mounted workspace, but this setup transfers ownership only for logs and install.sh. su tester preserves that custom environment variable, and install.sh attempts to create and validate the override at _resolve_studio_destinations before checking system dependencies, so this leg fails on an unwritable install directory rather than exercising the intended no-sudo dependency branch; unset the override for this command or create and chown its target first.

Useful? React with 👍 / 👎.

Comment on lines +250 to +255
# Non-apt: today this hard-fails at install.sh:2034. Expected failure;
# forces the decision on whether dnf/pacman/zypper get supported.
- label: fedora41
image: fedora:41
runner: ubuntu-latest
experimental: true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Assert the expected Fedora failure reason

The Fedora row is marked continue-on-error, but unlike the non-root row it runs the generic root install step and never checks that failure came from the intentional unsupported-package-manager branch. A bootstrap outage, malformed installer, or unrelated early exit is therefore tolerated exactly like the expected diagnostic, so this leg can stop exercising the Fedora decision point without the workflow detecting the regression.

Useful? React with 👍 / 👎.

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d2ade8ad1e

ℹ️ 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".

shell: pwsh
run: |
$ErrorActionPreference = 'Continue'
& ./install.ps1 -SkipTorch *>&1 | Tee-Object -FilePath logs/install.log

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Pass the supported no-torch switch

On every Windows matrix row, install.ps1 has no -SkipTorch parameter and its argument parser recognizes only --no-torch (install.ps1:116-122), silently ignoring this token. These jobs therefore perform the default full PyTorch installation instead of exercising the requested no-torch path, and the subsequent torch import succeeds only because the switch had no effect; use the supported flag with an appropriate assertion, or remove this misleading argument if a full install is intended.

Useful? React with 👍 / 👎.

if (-not (Test-Path $py)) { $py = (Get-Command python -ErrorAction SilentlyContinue).Source }
if (-not $py) { Write-Host '::error::no python from the install'; exit 1 }
& $py -c "import ctypes.util, sys; print('VCRUNTIME140:', ctypes.util.find_library('vcruntime140'))"
& $py -c "import torch; print('torch', torch.__version__)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Isolate the VC runtime before asserting torch loads

In the required windows-latest legs, the simulation only removes Visual Studio-related PATH entries and environment variables; it does not remove the VC redistributable DLLs already installed globally on the hosted image. Consequently this import can use the runner's preexisting VCRUNTIME140 and pass even when the masked-winget installer still leaves a genuinely clean machine without the runtime, so this does not validate the stated no-winget VCRedist contract; run the check in an image without the redistributable or otherwise prove the installer supplied it.

Useful? React with 👍 / 👎.

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.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0699e5c72b

ℹ️ 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".

Comment on lines +168 to +170
env -u UNSLOTH_STUDIO_HOME \
bash "$APP/Contents/Resources/install.sh" --tauri --no-torch \
< /dev/null 2>&1 | tee logs/bundled-install.log

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Run the bundled installer with production arguments

On the macOS clean-machine path, this adds --no-torch, while production resolve_install_script in studio/src-tauri/src/install.rs supplies only --tauri. A shipped bundle can therefore pass this job even if its normal first-launch installation fails while resolving or installing PyTorch; invoke the bundled script with the same arguments as the app.

Useful? React with 👍 / 👎.

Comment on lines +288 to +290
xvfb-run -a --server-args="-screen 0 1440x900x24" \
"$BIN" > logs/app-stdout.log 2>&1 &
APP_PID=$!

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Exercise the bundled installer in the Linux and Windows jobs

On a fresh profile, desktop_preflight returns not_installed and use-tauri-backend.ts:252-254 merely displays the install screen until its button is clicked, so keeping the process alive for 90 seconds never invokes the bundled installer. The Linux block here and the analogous Windows launch block can thus pass with a completely broken or missing bundled install script; trigger installation as the macOS job does, or automate the UI and assert the resulting managed environment.

Useful? React with 👍 / 👎.

Comment on lines +260 to +267
- name: Install with NO dev tooling, only runtime libs
run: |
# Deliberately not build-essential/cmake/git: a user installing a .deb has
# none of that. WebKit + Xvfb are runtime requirements of the app itself,
# and apt pulls the .deb's declared deps -- if that list is wrong, this
# step is what catches it.
sudo apt-get update -qq
sudo apt-get install -y -qq --no-install-recommends xvfb

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove the hosted Linux toolchain before testing

These legs run directly on the developer-equipped ubuntu-22.04 hosted runner and only install additional runtime packages; unlike the macOS/Windows legs, nothing masks the runner's existing Git, compilers, CMake, or Python. Consequently the purported no-dev-tooling Linux test cannot detect a desktop startup or installer dependency on those tools; use a clean container or apply and verify an equivalent mask before launching.

Useful? React with 👍 / 👎.

Comment on lines +407 to +408
$url = 'https://cloud-images.ubuntu.com/wsl/releases/24.04/current/ubuntu-noble-wsl-amd64-24.04lts.rootfs.tar.gz'
$expected = '2a790896740b14d637dbdc583cce1ba081ac53b9e9cdb46dc09a2f73abbd9934'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Pin the WSL image URL alongside its checksum

The workflow downloads from the rolling 24.04/current location but compares it with one fixed digest. When Ubuntu publishes the next current rootfs, legitimate content will fail this check before WSL is imported, permanently eliminating this already informational coverage until the hash is manually updated; use a versioned image URL or validate against the signed checksum published for the current image.

Useful? React with 👍 / 👎.

Comment on lines +189 to +191
checks="nobuild"
[ "${{ matrix.mode }}" = "trace" ] && checks="$checks notools"
bash .github/scripts/clean-machine-assert.sh $checks

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Recheck toolchain absence after the installer finishes

The mask legs run absent only before installation, while this post-install assertion includes only nobuild; that does not enforce the script's documented invariant that the toolchain remained absent for the whole run. In particular, install.sh calls xcode-select --install when its probe fails, so a runner that accepts or completes that request could use the newly available CLT and still pass this job; add absent to the successful mask-leg checks.

Useful? React with 👍 / 👎.

Comment on lines +539 to +543
$shim = Join-Path $env:RUNNER_TEMP 'winget-shim'
New-Item -ItemType Directory -Force -Path $shim | Out-Null
Set-Content -LiteralPath (Join-Path $shim 'winget.cmd') -Encoding ascii `
-Value "@`"$($wingetCmd.Source)`" %*"
$kept = @($shim) + $kept

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the winget shim across PATH refreshes

The visible leg adds the shim only to the process PATH written through GITHUB_ENV, but the registry PATHs written below never receive it. After the first Refresh-SessionPath in install.ps1, winget therefore disappears even though $script:WingetAvailable remains true, causing later retry and uv winget commands to fail or fall back rather than testing the normal visible-winget path; persist the shim directory in the registry PATH used by refreshes as well.

Useful? React with 👍 / 👎.

Comment on lines +200 to +206
for f in "$UNSLOTH_STUDIO_HOME/tauri.log" "$HOME/.unsloth/studio/tauri.log"; do
[ -f "$f" ] || continue
echo "=== $f ==="
cp "$f" logs/ 2>/dev/null || true
tail -60 "$f"
# The two fields the bug report turned on.
grep -E "disposition=|can_auto_repair=|Xcode Command Line|ModuleNotFoundError" "$f" || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require a completed preflight record

If the desktop process stays alive but never reaches preflight, this step succeeds both when neither tauri.log exists and when the log lacks a disposition because missing files are skipped and the only grep is followed by || true. That allows a bundle hung before or during the preflight covered by this workflow to pass the 90-second liveness check; require at least one log and a successful disposition= match.

Useful? React with 👍 / 👎.

Comment on lines +364 to +369
$drop = @('hostedtoolcache\windows\Python', 'WindowsApps', '\Git\', 'CMake',
'Microsoft Visual Studio', 'BuildTools', 'LLVM', 'MSYS', 'mingw')
$kept = ($env:PATH -split ';') | Where-Object {
$p = $_; $p -and -not ($drop | Where-Object { $p -like "*$_*" })
}
"PATH=$($kept -join ';')" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Scrub the Windows registry PATH too

This desktop leg removes developer tools only from the process PATH, but the bundled install.ps1 calls Refresh-SessionPath, which reconstructs PATH from the untouched Machine and User registry values. Once the Windows job actually triggers first-launch installation, Git, CMake, Visual Studio, and other hosted tools will reappear mid-run, so the clean-machine claim is not maintained; mirror the registry scrubbing already implemented in clean-machine-install-ci.yml.

Useful? React with 👍 / 👎.

Comment on lines +573 to +575
foreach ($t in 'python','git','cmake','cl') {
$f = Get-Command $t -ErrorAction SilentlyContinue
Write-Host ("{0,-8} {1}" -f $t, $(if ($f) { $f.Source } else { 'ABSENT' }))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Fail when Windows developer tools remain visible

If a hosted-image update places Python, Git, CMake, or cl in a path not covered by the substring scrub, this verification only prints the resolved executable and still runs the installer. The leg can then pass by using precisely the preinstalled developer tooling it is intended to exclude; treat any resolved command in this loop as a simulation failure, as the macOS absent assertion does.

Useful? React with 👍 / 👎.

@danielhanchen

Copy link
Copy Markdown
Member Author

Note on the red macOS legs, since they look like a broken PR and are not.

This branch is CI only. Its install.sh is still main's, so the clean-machine legs
are running against the unfixed installer and reproducing the reported failure
exactly:

  • mac macos-26 / mask / file: ==> Xcode Command Line Tools are required. then
    installer exit code: 1, with the masking asserts all passing first (clang present
    but non-functional, cmake absent, brew absent). That is a virgin Mac.
  • mac macos-15 / mask / pipe: the same gate, reached through a pipe, so the log also
    carries curl: (56). 29 of the 35 exit statements sit before line 2050, so any
    early exit leaves most of the script unread and the pipe reader closes.
  • desktop macOS: the bundled installer inside the published desktop-v0.1.50-beta
    app leaves no venv on a stripped machine. That is the shipped artifact, which no
    branch can fix until a release carrying the installer fix is published.

These legs go green once #7547 (drops the Xcode CLT gate on the consumer path) and
#7548 (wraps install.sh in a function so a piped install drains) land. On a branch
carrying all three, the same matrix passes: macOS mask/file, mask/pipe and mask/tauri
all install, and the trace leg records no compiler, git or brew invocation at all.

win windows-11-arm / winget=visible is the upstream wheel gap (torch, torchvision
and torchaudio publish no win_arm64 wheels) and is marked experimental.

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eea0433f0e

ℹ️ 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".

Comment on lines +445 to +446
Select-String -Path logs/wsl-install.log -Pattern 'platform|\[TAURI:DIAG\]|wsl' -ErrorAction SilentlyContinue |
Select-Object -First 10

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require an exact WSL platform marker

In the WSL job, if platform detection regresses and the installer reports platform linux, this still matches the generic platform pattern and the result is only printed; even no match does not fail the step. The later CLI verification proves only that a generic Linux installation succeeded, so this job can remain green without exercising any WSL-specific installer logic. Require the exact WSL platform marker and fail when it is absent.

Useful? React with 👍 / 👎.

run: |
mkdir -p logs
if [ "${{ matrix.mode }}" = "mask" ]; then
bash .github/scripts/clean-machine-env.sh mask --remove

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Update the installer before requiring CLT-free legs

Every required mode: mask macOS row makes xcode-select -p fail here, but the unchanged install.sh treats that exact condition as fatal at lines 1988-1994, invokes xcode-select --install, and exits 1. Consequently the four non-experimental mask rows cannot reach their installation assertions, so PRs triggering this workflow are reliably red rather than proving a toolchain-free install; update the installer to continue along the prebuilt path before making these legs required.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This red is the deliverable rather than a defect. The branch is CI only, so its install.sh is main's and the macOS legs reproduce the reported failure exactly: masking asserts pass (clang present but non-functional, cmake absent, brew absent), then ==> Xcode Command Line Tools are required. and exit 1. Those legs go green when #7547 lands, which is where the gate removal belongs. Verified on a branch carrying #7547 and #7548: the same matrix installs and the trace leg records no compiler, git or brew invocation at all.

Comment on lines +365 to +366
if [ -f .github/scripts/clean-machine-assert.sh ]; then
INSTALL_LOG=logs/install.log bash .github/scripts/clean-machine-assert.sh nobuild

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Verify the Linux installation is usable

For both required Ubuntu root rows, the only post-install assertion is nobuild, which succeeds when the log contains no build messages even if an installer exits 0 without creating the managed environment or CLI. A no-op or prematurely successful tree/published installer can therefore leave these clean-machine jobs green; add an execution check for the installed CLI or managed Python as the WSL and Windows jobs do.

Useful? React with 👍 / 👎.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 90ec9462a0

ℹ️ 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".

contents: read

env:
REL_REPO: ${{ inputs.release_repo || 'unsloth-test/unsloth-test' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Point nightly smoke tests at production releases

For scheduled and pull-request runs, inputs.release_repo is empty, so this still defaults to unsloth-test/unsloth-test. Fresh evidence after the tag-resolution change is that only REL_TAG now follows the newest release; the repository remains the test fixture, while .github/workflows/release-desktop.yml:760-768 publishes into github.repository and the updater endpoint targets unslothai/unsloth. Consequently the nightly can stay green while the currently shipped production bundles are broken.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already the case on head: line 62 sets REL_REPO to ${{ inputs.release_repo || github.repository }}, so schedule and pull_request runs resolve against the publishing repo. unsloth-test/unsloth-test is only reachable through an explicit dispatch input now.

cp "$f" logs/ 2>/dev/null || true
tail -60 "$f"
# The two fields the bug report turned on.
grep -E "disposition=|can_auto_repair=|Xcode Command Line|ModuleNotFoundError" "$f" || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require a preflight disposition in the app log

When the macOS process creates tauri.log but hangs before desktop_preflight completes, this grep returns nonzero and || true discards it, while the later found check succeeds merely because the file exists. The fresh found check therefore fixes the missing-log case but not the missing-disposition case: a live process stalled before preflight still passes despite the workflow's stated acceptance criterion. Require a disposition= match rather than only the presence of the log.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 232 already gates on it: the step exits 1 unless tauri.log contains "desktop_preflight completed disposition=". The || true grep on line 220 is only the printout, the assertion is separate and a process that hangs before preflight fails the step.

name: desktop windows
runs-on: windows-latest
timeout-minutes: 45
continue-on-error: true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Make the Windows desktop smoke job gating

When a release has a Windows-only packaging or startup regression, failures from the NSIS install and launch checks are tolerated because the entire Windows job has continue-on-error: true. The required macOS and Linux jobs can therefore pass and leave the nightly workflow green even though the shipped setup.exe cannot install or run, defeating this workflow's Windows acceptance coverage; remove this tolerance or restrict it to a separately identified experimental leg.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The windows job at lines 349-352 carries no continue-on-error, it was removed in 6937234. The NSIS silent install (line 402), the installed-exe check (line 406) and the launch check (line 418) are all gating today.

APP="$(ls -d /Applications/*Unsloth*.app | head -1)"
BIN="$APP/Contents/MacOS/$(/usr/libexec/PlistBuddy -c 'Print :CFBundleExecutable' "$APP/Contents/Info.plist")"
file "$BIN"
lipo -archs "$BIN" || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Fail when the macOS bundle lacks an arm64 binary

If an asset named *aarch64.dmg accidentally contains only an x86_64 executable, lipo -archs merely prints that architecture and still exits successfully. On an Apple Silicon hosted runner with Rosetta, the later launch can also remain alive, so the workflow passes even though its stated right-architecture check failed and native Apple Silicon users received the wrong build; make the architecture inspection require arm64.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 144-150 already do this: lipo output falls back to file -b when lipo is masked, and the case statement exits 1 unless the result contains arm64 or aarch64. A thin x86_64 binary in the aarch64 dmg fails the step.

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.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 231fcc3cf0

ℹ️ 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".

Comment on lines +185 to +187
checks="nobuild"
[ "${{ matrix.mode }}" = "trace" ] && checks="$checks notools"
bash .github/scripts/clean-machine-assert.sh $checks

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Recheck the masked toolchain after installation

For every mask row, absent is only run before the installer; this post-install assertion checks only nobuild. If the installer silently enables or installs the CLT or another compiler, subsequent source builds can succeed and the job remains green, even though clean-machine-assert.sh describes absent as guarding the whole run against exactly that behavior. Include absent in the successful post-install checks for masked rows.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, absent ran only in the pre-install step at lines 119-124 and the post-install assertion at 181-187 checked nobuild only. Fixed in 85305a2: masked legs now re-run absent after the install, carrying matrix.allow_working through so the Intel row still tolerates its non-CLT /usr/bin/git.

Comment on lines +294 to +295
xvfb-run -a --server-args="-screen 0 1440x900x24" \
"$BIN" > logs/app-stdout.log 2>&1 &

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Exercise the bundled installer in the Linux desktop jobs

On a fresh home, the app preflight enters not_installed; use-tauri-backend.ts:252-254 only sets the UI status, and startup-screen.tsx:388-389 waits for the user to invoke onInstall. This step merely requires that process to remain alive, so both required Linux rows pass after sitting on the install screen for 90 seconds without ever invoking the shipped bundle's install.sh. A bundle with a missing or broken embedded installer therefore remains green; trigger start_install or invoke the bundled resource and validate the resulting managed environment before accepting the launch.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, the Linux rows only required the process to stay alive for 90s and their log step had no assertion at all, so a broken embedded installer stayed green. Fixed in 85305a2: a new step resolves the bundled install.sh from the deb payload or the extracted AppImage (tauri.conf.json:56-59 ships it as a resource), runs it with --tauri and stdin closed as install.rs does, and requires a managed venv that imports torch.

Comment on lines +205 to +207
# The two fields the bug report turned on.
grep -E "disposition=|can_auto_repair=|Xcode Command Line|ModuleNotFoundError" "$f" || true
found=1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Require the macOS app to report a successful preflight

If the bundled installer leaves Python and torch importable but the CLI capabilities or managed-server startup are broken, the desktop process stays open on its stale/error screen and still writes tauri.log. Because this disposition grep is explicitly non-gating and the later check requires only that some log exists, ManagedStale, NotInstalled, or another unsuccessful disposition passes the required macOS jobs. Assert the expected ready disposition and/or successful managed-backend startup rather than merely printing it.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 232 already fails unless preflight completed, and the disposition VALUE is the field that lied in the reported bug: tauri.log read ManagedReady over an unbootable venv, so asserting a ready value proves nothing. What actually proves the install is lines 181-187, which fail unless the bundled installer left a venv whose python imports torch. The launch also runs with UNSLOTH_STUDIO_HOME pointed at the workspace while --tauri forces the installer into ~/.unsloth, so not_installed is the expected disposition at that point.

contents: read

env:
REL_REPO: ${{ inputs.release_repo || 'unsloth-test/unsloth-test' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Test releases from the production desktop repository

Automatic PR and nightly runs have no release_repo input, so this fallback makes them resolve and execute the newest bundle from unsloth-test/unsloth-test. The actual release workflow publishes into github.repository, and the shipped updater is configured for unslothai/unsloth, so a broken newly published production bundle does not affect this nightly at all. Default automatic runs to the production/current repository and retain the test repository only as an explicit dispatch override.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the other release_repo item: line 62 already defaults REL_REPO to github.repository and leaves the test repo as a dispatch-only override, which is what is asked for here.

foreach ($t in 'python','py','git','cmake','cl') {
$f = Get-Command $t -ErrorAction SilentlyContinue
Write-Host ("{0,-8} {1}" -f $t, $(if ($f) { $f.Source } else { 'ABSENT' }))
if ($f -and $t -ne 'py') { $leaked += "$t -> $($f.Source)" }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Verify that the Windows Python launcher is nonfunctional

When py.exe can still resolve any compatible interpreter registered outside the two renamed toolcache directories, this verification explicitly exempts it from $leaked without executing it. Find-CompatiblePython probes py first (install.ps1:1130-1153), so such a row passes the clean-machine check and then reuses that preinstalled interpreter instead of exercising Python bootstrap. Allow the launcher binary itself to remain, but fail if py -3.11, -3.12, or -3.13 can actually start an interpreter.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, line 609 exempted py from $leaked without ever running it, so a launcher that can still resolve an interpreter outside the two renamed toolcache directories passed the clean check. Fixed in 85305a2: the step now prints py -0p and fails if py -3.11, -3.12 or -3.13 actually starts an interpreter, while still allowing the launcher binary itself to remain.

Comment on lines +440 to +441
wsl -d unsloth-ci -u root -- sh -c 'cd /root && cat install.sh | sh' 2>&1 | Tee-Object -FilePath logs/wsl-install.log
Write-Host "installer exit: $LASTEXITCODE"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Propagate the WSL installer exit code

This step prints $LASTEXITCODE but never fails on it, so a nonzero installer result is discarded. The later CLI check does not compensate: install.sh:4168-4229 creates the unsloth shim before reporting a failing studio/setup.sh, meaning a late setup failure can leave an executable whose --version succeeds and make the WSL job appear successful. Capture the installer status after Tee-Object and exit nonzero when the installer failed.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed against install.sh: the shim is linked at 4174-4182 and the failing studio/setup.sh is only reported at 4219-4230, so unsloth --version can succeed after a late setup failure. Fixed in 85305a2: the step captures $LASTEXITCODE after Tee-Object and exits with it.

shimmyshimmer and others added 2 commits July 28, 2026 19:57
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.
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.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b573f067d1

ℹ️ 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 [ "${{ matrix.kind }}" = "deb" ]; then
SH="$(dpkg -L "$(dpkg-deb -f dl/*.deb Package)" | grep -E '/install\.sh$' | head -1)"
else
(cd dl && "$(ls *.AppImage | head -1)" --appimage-extract >/dev/null)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Prefix the AppImage command with a relative path

In the required appimage matrix row, ls *.AppImage returns a bare filename such as Unsloth.AppImage; invoking that filename without ./ makes Bash search PATH rather than the current dl directory. Because dl is not on PATH, the extraction command exits 127 before the bundled-installer assertion runs, leaving this required job reliably red. Invoke ./$(ls *.AppImage | head -1) or use an explicit path.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed and fixed in 9a8a749. Line 321 ran (cd dl && "$(ls *.AppImage | head -1)" --appimage-extract), and since ls returns a bare filename with no slash, bash resolves it through PATH rather than the cwd; reproduced locally it exits 127 with "command not found". The extraction therefore never happened, so line 322's find returned nothing and line 324 aborted the required appimage row before the bundled-installer assertion could run. Now prefixed with ./. Line 303's BIN was already safe because it keeps the dl/ prefix.

Comment on lines +361 to +364
for f in "$UNSLOTH_STUDIO_HOME/tauri.log" "$HOME/.unsloth/studio/tauri.log"; do
[ -f "$f" ] || continue
echo "=== $f ==="; cp "$f" logs/ 2>/dev/null || true; tail -60 "$f"
grep -E "disposition=|can_auto_repair=|ModuleNotFoundError" "$f" || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require Linux preflight completion

For both required Linux rows, a desktop process that remains alive but hangs before desktop_preflight completes still passes: this loop silently skips missing logs and discards a missing disposition via || true. The preceding Python/torch checks validate the bundled installer, but they do not exercise the app's Rust preflight path, so require a desktop_preflight completed disposition= record here as the macOS job does.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed and fixed in 9a8a749. This is a different ask from the earlier disposition item that was declined: that one wanted a READY disposition asserted, which would go green over exactly the unbootable-venv case being reported, whereas Linux had no completion assertion of any kind. Old lines 361-365 skipped a missing log with continue and discarded the grep with || true, and the launch step at 336-356 only proves the process survived 90 seconds, so a hang before preflight passed both required rows. The step now requires found and a desktop_preflight completed disposition= record, matching macOS lines 228 and 232, without asserting which disposition it is.

shimmyshimmer and others added 2 commits July 28, 2026 21:56
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.
…acOS 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9a8a749d07

ℹ️ 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".

- name: Launch and prove it stays up
shell: pwsh
run: |
$p = Start-Process -FilePath $env:APP_EXE -PassThru `

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Exercise the bundled Windows installer before accepting launch

On a fresh Windows profile, checkInstallAndStart handles not_installed by only displaying the install screen (studio/frontend/src/hooks/use-tauri-backend.ts:252-254); it does not invoke start_install. This launch can therefore remain alive for 90 seconds without ever running the bundled install.ps1, allowing a Windows-only missing or broken installer resource to pass. Fresh evidence since the earlier report is that the final macOS and Linux jobs now invoke their bundled scripts directly, while this Windows block still only starts the executable; invoke the bundled installer or automate start_install and verify the resulting managed environment.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, and fixed. The Windows job stopped at silent install plus a 90 second liveness check, so a bundle shipping no install.ps1 resource passed it. It now resolves install.ps1 out of the NSIS install directory, runs it with --tauri exactly as install.rs:326-341 does, and asserts the venv at %USERPROFILE%.unsloth\studio\unsloth_studio\Scripts\python.exe exists and can import torch, matching the macOS step at 166-188 and the Linux one at 308-337. Unlike those two it should be green today: the Xcode CLT hard stop that keeps the macOS bundled leg red has no equivalent on the Windows path.

Comment on lines +359 to +361
if [ "$rc" != "0" ] && ! grep -qiE "sudo is not available|apt-get install|missing:|permission" logs/install.log; then
echo "::error::unprivileged install failed with no actionable message"
exit 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate successful unprivileged installs

If the unprivileged installer exits 0 prematurely or becomes a no-op, this condition accepts it without checking that anything was installed. The later usability assertion is gated on steps.install_root.outcome, but that step is skipped for this matrix row, so the nonroot job can pass with only an empty or otherwise non-actionable successful log and no managed Python or CLI. When rc is zero, verify the resulting environment just as the root path does; otherwise require the expected actionable failure.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rc=0 path is unasserted, but it neither gates anything nor is reachable. The row is experimental: true (334), so it is continue-on-error and cannot fail the workflow, and the leg dies at the elevation gate (install.sh:840-861) before a venv exists, which is why it carries overlay: false. Run 30404629741 confirms it builds nothing. The check that matters here is the one already present at 445-448, that the failure is actionable rather than a bare curl: (56).

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.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3be21e87cf

ℹ️ 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".

# The two fields the bug report turned on.
grep -E "disposition=|can_auto_repair=|Xcode Command Line|ModuleNotFoundError" "$f" || true
found=1
if grep -qE "desktop_preflight completed disposition=" "$f"; then disposition=1; fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Require a ready preflight disposition

After the bundled installer creates and validates the managed venv, this check accepts every disposition, including NotInstalled. A regression in managed-install discovery would therefore leave the app alive on its install screen (use-tauri-backend.ts maps not_installed to that state) and both the macOS and mirrored Linux rows would still pass. Assert the expected ready disposition, such as ManagedReady, rather than merely the presence of any disposition line.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rejecting again, same reason as the earlier round: ManagedReady over an unbootable venv is precisely the reported bug, so asserting readiness would prove the wrong thing. What 222 and 232 require is that preflight COMPLETED ('desktop_preflight completed disposition=') without constraining the value, and the Linux job now holds the same bar at 368 and 378. A NotInstalled disposition on a leg whose bundled installer step just asserted a working venv is itself the regression signal, and it is visible in the log grep at 220.

Comment on lines +454 to +456
$p = Start-Process -FilePath $env:APP_EXE -PassThru `
-RedirectStandardOutput logs/app-stdout.log `
-RedirectStandardError logs/app-stderr.log

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Exercise the bundled installer in the Windows desktop job

On a fresh Windows runner, preflight returns not_installed and waits for the user to click Install, so merely launching the executable and confirming that it remains alive for 90 seconds never invokes the bundled installer. Unlike the macOS and Linux rows, this job can therefore pass when the shipped install resource is missing or broken—the exact packaged-app failure this workflow is intended to catch. Invoke and validate the bundled installer before the launch assertion.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same finding as 3669521415, fixed in the same commit: a 'Run the bundled installer, the path first launch takes' step now sits before the launch assertion in the Windows job, mirroring macOS 166-188 and Linux 308-337. The job timeout goes 45 to 60 because a full torch install is slowest on Windows.

Comment on lines +64 to +67
paths:
- 'install.sh'
- 'install.ps1'
- '.github/workflows/clean-machine-install-ci.yml'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Run all relevant checks after direct pushes to main

For a direct push to main that changes studio/setup.sh, studio/setup.ps1, studio/install_python_stack.py, or either clean-machine helper, this filter skips the workflow even though the PR filter and source-overlay design explicitly treat those files as part of the clean-install path. Such changes can therefore land without any post-push clean-machine validation; mirror the relevant PR paths in the push.paths list.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, the two filters had drifted. push.paths listed only install.sh, install.ps1 and the workflow while pull_request.paths also covered setup.sh, setup.ps1, install_python_stack.py and the clean-machine helpers, so a direct push to main touching those got no post-merge run at all. The push list now mirrors the PR list.

Comment on lines +584 to +586
$wslPath = (wsl -d unsloth-ci -- wslpath -a "$($env:GITHUB_WORKSPACE -replace '\\','/')/install.sh").Trim()
Write-Host "installer source in WSL: $wslPath"
wsl -d unsloth-ci -u root -- cp "$wslPath" /root/install.sh

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor the published installer selection in every platform job

When a manual run selects installer_source: published, this WSL step still copies and executes the checked-out install.sh, so its result is mislabeled as coverage of the published installer. The Windows install step similarly always executes ./install.ps1; only the macOS and Linux jobs currently honor the input. Select the production download in these jobs as well, or scope and rename the input so the run cannot report mixed sources as a published-installer test.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed and fixed. The gate expressions themselves are fine (inputs.installer_source != 'published' is true on pull_request, where the input is ''), but only macOS 211 and Linux 382 acted on the value: WSL copied the checked-out install.sh and Windows always ran ./install.ps1, so a run labelled published reported on this ref. Both now branch on the input, install.ps1:3 advertises its own unsloth.ai URL so published is meaningful there too, and both branches stay inert on pull_request and push.

Comment on lines +111 to +114
- {os: macos-14, mode: mask, delivery: pipe, flags: '', experimental: false, overlay: false}
- {os: macos-14, mode: mask, delivery: file, flags: '', experimental: false, overlay: true}
# What the desktop app runs: no tty, stdin closed, TAURI markers on.
- {os: macos-14, mode: mask, delivery: tauri, flags: '', experimental: false, overlay: true}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Land the macOS gate fix before requiring masked lanes

Every required mode: mask row makes xcode-select -p fail, but the install.sh in this commit still handles that condition at lines 1988-1994 by invoking xcode-select --install and exiting 1. Consequently these non-experimental rows deterministically fail before installing anything, including on the PR that introduces the workflow. Include the installer gate fix in this change or keep these rows non-blocking until that fix is present.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The facts are right: install.sh in this branch still hard stops at 1988-1994, so the four non-experimental masked macOS rows (114-116 and 121) cannot pass here. The installer fix lives in #7547, which is still open, so it is a merge-order dependency rather than something to paper over: #7547 lands first, then these rows go green. Relaxing them to experimental in the meantime would make this PR green while proving nothing, which is the failure mode the workflow was written to expose, so they stay required and stay red until the fix is in.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 467d02b1dd

ℹ️ 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".

#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.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d6d2408ce6

ℹ️ 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".

Comment thread .github/scripts/clean-machine-assert.sh Outdated
# not a second walk of site-packages through the venv's lib64 link. Depth 4
# covers <root>/unsloth_studio, the .venv_t5_* sidecars and the tauri
# layout's <root>/studio/unsloth_studio.
find -L "$root" -maxdepth 4 -type f -path '*/bin/python' 2>/dev/null

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Replace GNU-only maxdepth in the macOS scan

In the macOS jobs that invoke the macho assertion, /usr/bin/find is the BSD implementation and does not support the GNU -maxdepth primary (see the Apple find(1) synopsis and supported primaries). Because stderr is discarded and this script does not use errexit, this command silently contributes no venv interpreter; the separately found uv still makes nout nonzero, so the assertion can pass and claim the managed CPython was checked even if it is x86_64-only. Use a macOS-compatible depth predicate or enumerate the expected bin/python paths.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disagreeing on the premise: -maxdepth is not GNU-only. macOS find comes from BSD file_cmds and the Apple find(1) page you linked lists -maxdepth/-mindepth among its primaries, so this resolves on every macOS runner in the matrix.

The second half of the reasoning does stand on its own, though, and I took it: the guard could be satisfied by uv alone, so an empty interpreter scan would not have been noticed whatever the cause. 88f8b48 holds the result in $base_py and fails on its own line:

base_py="$(find -L "$root" -maxdepth 4 -type f -path '*/bin/python' 2>/dev/null)"
...
elif [ -z "$base_py" ]; then
fail "no */bin/python found under $root, so the venv's base interpreter went unchecked"

Anti-vacuity, not the maxdepth claim.

runs-on: ${{ matrix.runner }}
container: ${{ matrix.image }}
timeout-minutes: 40
continue-on-error: ${{ matrix.experimental }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Make the Fedora outcome assertion gating

For the fedora41 matrix row, matrix.experimental is true, so this job-level setting prevents the workflow run from failing no matter whether the later “Assert the Fedora outcome is a known one” step rejects an unrelated bootstrap or installer failure. GitHub documents jobs.<job_id>.continue-on-error as preventing a workflow run from failing when that job fails (workflow syntax reference); therefore the exact-outcome pin does not provide the protection its comments describe. Limit tolerance to the expected install step, or otherwise keep the assertion in a job that is not continued on error.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, and fixed in 88f8b48. fedora41 had experimental: true, so job-level continue-on-error swallowed the outcome pin along with the install and the assertion could not fail the run.

Tolerance now sits on the step, which is what the no-transport row already does:

  • label: fedora41
    experimental: false
    tolerate_install_failure: true

  • name: Install (root)
    continue-on-error: ${{ matrix.tolerate_install_failure == true }}

outcome is the pre-tolerance result, so every 'steps.install_root.outcome == success' gate downstream is unchanged, and the Fedora assertion is now gating.

Comment on lines +50 to +52
- 'studio/setup.sh'
- 'studio/setup.ps1'
- 'studio/install_python_stack.py'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Trigger clean-machine CI for every overlay input

A PR that changes only pyproject.toml or unsloth_cli/commands/studio.py skips this workflow even though every overlay row builds the former and invokes the latter to locate and launch studio/setup.sh or setup.ps1. For example, changing the editable build backend to one requiring a compiler, or breaking _PACKAGE_ROOT/setup-script resolution, would therefore receive no clean-machine run; the existing toolchain-equipped workflows do not exercise the invariant added here. Add these inputs to both the pull-request and push path filters.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, and fixed in 88f8b48 on both the pull_request and push filters. The overlay is an editable build of pyproject.toml, and install.sh:4254 / install.ps1:2801 reach setup.sh and setup.ps1 through unsloth_cli/commands/studio.py, whose _PACKAGE_ROOT the overlay re-points, so both files decide whether these legs install at all and neither triggered the workflow.

shimmyshimmer and others added 2 commits July 29, 2026 06:33
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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c6219fa4d3

ℹ️ 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".

# overlay: the editable build calls git itself (setuptools-scm), planting the
# very evidence `notools` looks for.
- {os: macos-14, mode: trace, delivery: file, flags: '', experimental: false, overlay: false}
# --no-torch is the one macOS path that can still want a compiler

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Trace this ref's setup instead of the released wheel

When a PR changes studio/setup.sh, install_python_stack.py, or a prebuilt helper to opportunistically invoke Git or a compiler and then fall back successfully, every overlay: true macOS row runs in mask mode, so those rows cannot distinguish that invocation from never reaching for the tool. The only row that runs the notools assertion is this trace row, but overlay: false makes it execute the released wheel's setup code instead of the changed code; such a regression therefore passes despite the workflow's stated no-toolchain-use contract. Isolate or allowlist the editable-build trace noise while tracing the overlaid setup itself.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The observation is right and the header already records it, but I am keeping the trace row on overlay: false.

What escapes is narrower than the comment suggests. On a mask leg the toolchain is genuinely unusable, so this ref's setup.sh reaching for git either fails, which is gating, or falls back successfully, which is not a broken clean machine. The only case notools adds over the mask legs is 'reached for a tool and recovered', and that costs the row its ability to answer its own question: the editable overlay build makes setuptools-scm run git rev-parse and git ls-files itself, planting exactly the evidence notools looks for.

The suggested allowlist cannot separate the two. setuptools-scm's calls are ordinary git subcommands a regression would issue too, so an argv allowlist would either be so narrow it still trips or so wide it excuses the thing under test. Real isolation would need phase tagging: install.sh exporting a marker around the editable install so the wrapper could attribute each call. That is product-code surgery for a CI attribution problem, and I would rather not add it to install.sh for this.

So: documented trade-off, the mask legs gate every case that actually breaks a clean machine, and the trace row keeps its assertion able to fail.

VENV="$UNSLOTH_STUDIO_HOME/unsloth_studio"
[ -x "$VENV/bin/python" ] || { echo "::error::installer exited 0 but left no managed Python at $VENV/bin/python"; ls -la "$UNSLOTH_STUDIO_HOME" || true; exit 1; }
"$VENV/bin/python" -V
[ -x "$VENV/bin/unsloth" ] || { echo "::error::installer exited 0 but left no unsloth CLI at $VENV/bin/unsloth"; exit 1; }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Execute the Linux CLI before calling the install usable

When a dependency or constraints change leaves the generated console script present but unable to import its command tree, this assertion still passes because it checks only the executable bit. The Unix installer invokes setup.sh directly rather than exercising this console entry point, so an install can exit successfully while unsloth --version immediately fails for users; the Windows and WSL lanes already execute that command. Run the managed $VENV/bin/unsloth --version here and require a zero exit code.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, and fixed in 88f8b48. The Linux rows only tested the executable bit while the Windows row runs the CLI and the WSL row runs it inside the distro:

"$VENV/bin/unsloth" --version || {
echo "::error::the unsloth CLI is on disk but does not run"
exit 1
}

The console script imports the whole command tree, so a constraints change that leaves it unimportable now fails here rather than shipping.

danielhanchen and others added 3 commits July 29, 2026 10:25
…he 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.
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.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8039dab603

ℹ️ 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".

# the current bundle ships a postrm and no install-time script.
if: ${{ github.event_name != 'workflow_dispatch' || inputs.strip_toolchain }}
run: |
bash .github/scripts/clean-machine-env.sh mask --remove

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Purge masked packages before validating the .deb dependencies

On ubuntu-22.04, clean-machine-env.sh mask --remove only renames the resolved git/cmake/compiler binaries; it leaves their packages marked installed in dpkg. Consequently, the later apt-get install ./dl/*.deb considers those dependencies already satisfied and does not restore the renamed binaries if a release adds git, cmake, or build-essential to its dependency list, after which the path-based absent assertion still passes. (apt-get --help also distinguishes normal install from the separate reinstall operation.) Purge the relevant packages or run this check in a package-clean container so the claimed dependency regression check is effective.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. mask --remove renames the resolved binaries and leaves dpkg's state alone, so apt sees git or cmake as already satisfied and never restores the file, and the comment claiming 'only a new dependency can turn this red' was wrong.

Rather than purge on the runner (removing build-essential from ubuntu-22.04 cascades well beyond this job), fbeb132 asserts the thing a release would actually change:

deps="$(dpkg-deb -f dl/*.deb Depends)"
if printf '%s' "$deps" | grep -qE '(^|[ ,])(git|cmake|build-essential|gcc|g++|clang|llvm)([ ,(]|$)'; then
echo "::error::the bundle now declares a developer toolchain dependency..."

Direct, and it fails on the declaration rather than on whether apt happened to act on it. The comment now says what absent can and cannot see.

Comment thread .github/scripts/clean-machine-assert.sh Outdated
Comment on lines +175 to +176
desc="$(file -b "$f" 2>/dev/null || true)"
case "$desc" in *Mach-O*) ;; *) continue ;; esac

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Dereference the venv interpreter before classifying Mach-O files

When uv creates <venv>/bin/python as a symlink to its managed base interpreter, find -L makes the path satisfy -type f but still emits the symlink path; the subsequent file -b "$f" does not dereference that path unless -L is passed, so it reports a symbolic link and this case silently skips it. The later guards only check that $base_py is nonempty, while the separately scanned uv binary makes $nout nonzero, allowing the assertion to pass without ever checking the architecture or signature of the Python executable that ran the install. Use file -Lb (and preferably track that a base interpreter was actually classified) so an x86_64-only managed Python cannot pass the arm64 lane under Rosetta.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, and the sharpest catch on this PR so far. Confirmed locally: find -L satisfies -type f through the link but still PRINTS the symlink path, and plain file does not dereference:

$ file -b /bin/python -> symbolic link to .../base/python3
$ file -Lb /bin/python -> ELF 64-bit LSB pie executable, x86-64

so the Mach-O case dropped the one interpreter the Rosetta scan exists to check, and my earlier -z $base_py guard only proved the path existed.

Fixed in fbeb132: file -Lb, plus a $nbase counter so the guard is 'a base interpreter was CLASSIFIED', not 'a path was found'. Smoke-tested with a stub file on PATH that speaks Mach-O:

  1. symlinked venv python, file honours -L -> OK, 3 Mach-O files ... are x86_64
  2. same tree, file ignores -L (old behaviour) -> ::error::no */bin/python ... was classified as Mach-O
  3. no venv python at all -> same error, (found: none)

Case 2 is the regression test for exactly this bug.

Comment on lines +705 to +706
if (Select-String -Path $f -Pattern 'desktop_preflight completed disposition=' `
-SimpleMatch -Quiet) { $disposition = $true }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require a ready preflight disposition after the Windows install

In the Windows lane the bundled installer has already been required to exit successfully, create the managed venv, and import torch, but this check accepts every preflight result merely because the log prefix exists. DesktopPreflightDisposition also includes NotInstalled, ManagedStale, and ExternalConflict, so the app can fail to recognize or boot the environment that was just installed, remain alive on its setup/error screen for 90 seconds, and still pass the job. Match a ready disposition such as ManagedReady/OwnedReady/AttachedReady (as appropriate for this fresh runner), rather than accepting any disposition value.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, and scoped exactly right at Windows. Checked the real logs before agreeing: the green macOS lane records

desktop_preflight completed disposition=NotInstalled port=None in 34ms

from /Users/runner/.unsloth/studio/tauri.log, so the app ignores UNSLOTH_STUDIO_HOME and reads the default root, and macOS/Linux legitimately land on NotInstalled because their bundled installer stops at the pinned pre-#7547 exit before a venv exists. Windows is the only lane where the installer is required to exit 0, create the venv and import torch, so a non-ready disposition there is the reported failure itself.

fbeb132 collects the disposition values instead of just their prefix and requires one of Managed/Owned/AttachedReady on Windows only, printing what it saw when it fails. Left as-is on macOS and Linux until their pins retire, with the reason recorded in the step.

…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.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fbeb1320c4

ℹ️ 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".

# of site-packages through the venv's lib64 link -- depth 4 covers
# <root>/unsloth_studio, the .venv_t5_* sidecars and <root>/studio/unsloth_studio.
# In a variable so it can be counted separately: uv alone would satisfy $nout.
base_py="$(find -L "$root" -maxdepth 4 -type f -path '*/bin/python' 2>/dev/null)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid GNU-only find -maxdepth in the macOS assertion

All macOS rows invoke this assertion after a successful install, but the PATH scrub leaves Apple’s BSD /usr/bin/find, which does not support the GNU -maxdepth predicate. Because stderr is discarded and the assignment is allowed to fail, base_py becomes empty; the later nbase == 0 check then fails every otherwise-successful macOS clean-machine job. Limit the traversal using predicates supported by macOS find instead.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second time on this one, so here is the decisive evidence rather than another argument. macOS find DOES support -maxdepth, and the run that proves it is the code you are describing.

The -z $base_py guard (the predecessor of $nbase, same premise: empty means fail) shipped in 88f8b48 and ran on real macOS runners. Every macOS row passed, and the macho step printed:

[assert] OK 686 Mach-O files under .../.studio-home, plus uv and the venv's base interpreter, are arm64; all 12 main executable(s) signed

on macos-14 / mask / file, plus macos-15, macos-15-intel and macos-26 in the same run. If Apple's /usr/bin/find rejected -maxdepth, base_py would have been empty and every one of those rows would have failed at exactly the guard you predict fails. They did not.

The prediction is testable and it was tested. Keeping -maxdepth.

Comment thread .github/scripts/clean-machine-assert.sh Outdated
else
ok "xcode-select -p fails (the gate a virgin Mac hits)"
fi
for tool in git cc clang cmake; do

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Verify every tool that the clean-machine helper masks

The mask --remove helper treats failures as best-effort warnings and attempts to remove gcc, g++, make, ninja, cargo, and rustc, but this postcondition checks none of them. For example, if moving cc succeeds but moving gcc fails, absent still passes while install.sh explicitly probes gcc to decide that build-essential is available, so the desktop clean-machine jobs can exercise a source-capable path while reporting that no toolchain survived. Run the same functional check for the full relevant TOOLS set (with only explicit platform exceptions allow-listed).

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, and a real hole. mask_aside and the Linux binary loop both fall through to note WARN could not move ... and carry on, so a partial mask was indistinguishable from a clean one for six of the ten tools the helper moves -- gcc included, which install.sh probes to decide build-essential is there.

5998791 checks the whole set:

for tool in git cc clang cmake gcc g++ make ninja cargo rustc; do

Same three-way verdict per tool (absent from PATH / present but non-functional / still usable = fail), and the existing UNSLOTH_CLEAN_ALLOW_WORKING escape still covers the one documented exception, Intel's non-CLT /usr/bin/git.

Comment thread .github/scripts/clean-machine-env.sh Outdated
Comment on lines +103 to +106
if [ -e /var/db/xcode_select_link ]; then
if sudo rm -f /var/db/xcode_select_link 2>/dev/null; then
note "removed /var/db/xcode_select_link"
echo "sudo xcode-select --switch /Library/Developer/CommandLineTools 2>/dev/null || true" >> "$RESTORE"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore the selected developer directory after its target

On hosted macOS runners where both the selection link and Command Line Tools exist, this writes the xcode-select --switch command to restore.sh before the subsequent command that restores /Library/Developer/CommandLineTools. The restore script therefore tries to select a directory that is still named .masked, suppresses the resulting failure with || true, and only then moves the directory back, leaving /var/db/xcode_select_link unrestored while the workflow reports a successful cleanup. Record the original selection and apply it after restoring the CLT/Xcode directories.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. restore.sh is executed top to bottom, and the --switch line was appended in the xcode_select_link block, i.e. before the lines that move CommandLineTools and Xcode*.app back, so it named a .masked path, failed, and was swallowed.

5998791 records the real selection before removing the link and emits the --switch after both directory restores:

_orig_dev="$(xcode-select -p 2>/dev/null || true)"
... (CLT restore line, then the Xcode*.app restore lines)
if [ -n "$_orig_dev" ]; then
echo "sudo xcode-select --switch '$_orig_dev' 2>/dev/null || true" >> "$RESTORE"
fi

It also restores whatever was selected rather than assuming CommandLineTools, which on these images is often an Xcode bundle. The || true stays deliberately: the runner is ephemeral and a re-selection failure must not redden an otherwise green job. It just can no longer fail for the trivial reason of running too early.

…er 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.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 5998791f9a

ℹ️ 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".

@danielhanchen
danielhanchen merged commit b6781a8 into main Jul 29, 2026
84 of 89 checks passed
@danielhanchen
danielhanchen deleted the ci/clean-machine-install branch July 29, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants