Skip to content

Studio: install from a package index that lags PyPI - #14133

Merged
danielhanchen merged 10 commits into
mainfrom
studio-installer-lagging-index
Oct 18, 2026
Merged

danielhanchen merged 10 commits into
mainfrom
studio-installer-lagging-index

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Fixes #14031

Problem

Every release raises the installer floors to itself (unsloth>=2026.10.6, unsloth-zoo>=2026.10.6), and Desktop asks for its own shipped backend (UNSLOTH_DESKTOP_BACKEND_VERSION). A package index that lags PyPI (a delayed corporate feed, a mirror, an upload cutoff) never has that release yet, so with releases every two or three days and a 7 day feed delay the install is unsatisfiable on every run:

  × No solution found when resolving dependencies:
  ╰─▶ Because only unsloth<=2026.10.3 is available and you require
      unsloth>=2026.10.6, we can conclude that your requirements are
      unsatisfiable.

Desktop then cannot launch either: even when the backend is installed by hand, preflight sees it below the shipped version (desktop_backend_version_outdated) and starts a repair, which hits the same wall.

Change

  • install.sh / install.ps1: one dependency-free uv pip compile (about 0.05 s warm) checks the floors against whatever index configuration uv reads (env, uv.toml, cutoffs). On PyPI it passes and nothing else changes. When the index cannot satisfy them, the installer takes that index's newest unsloth-zoo, then the newest unsloth not above it, pins that pair (==) and prints a warning naming both versions. The probes force --resolution highest and write to their own scratch file, so neither UV_RESOLUTION=lowest nor a configured output-file changes the result or touches user files.
  • studio/install_python_stack.py: the same fallback on the studio update path Desktop runs, for Desktop's backend floor.
  • When Desktop asked for the backend, the installer writes unsloth_feed_ceiling.json ({"requested": ..., "available": ...}) next to pyvenv.cfg, and removes it on every run where it is not needed.
  • Desktop preflight: an outdated backend counts as ready only when that marker names this build's expected version and the installed backend is at or above the marker's version. A newer Desktop, or any other stale reason, is graded as before.
  • The zoo floor literal moves into one variable per installer; tests/test_installer_zoo_floor_parity.py reads it from there.

Tests

  • tests/sh/test_relax_unsloth_floors_to_index.sh, tests/studio/test_relax_unsloth_floors_to_index.ps1 and TestDesktopBackendVersionConstraint (uv stubbed): floors kept when the index has the release or is unreachable, lowered and pinned when it lags (env index, uv.toml index, cutoff), zoo lagging unsloth, hashed resolver output, the marker written only for Desktop and cleared once the feed catches up, the probe scratch file removed.
  • Rust: a_feed_ceiling_marker_covers_only_the_release_it_names; the full cargo test suite passes.
  • Base vs head installer on a local mirror that serves only unsloth / unsloth-zoo 2026.10.3 ahead of PyPI, --no-torch, Desktop floor set: on ubuntu-latest, windows-latest and macos-15, main fails with the error above, this branch installs 2026.10.3, warns, writes the marker and the backend reports itself ready.
  • Same comparison with the full CUDA install on a Colab A100 and T4: main fails, this branch installs 2026.10.3 with a working CUDA torch; a plain PyPI install on this branch still gets 2026.10.6 and writes no marker.

@danielhanchen danielhanchen self-assigned this Oct 18, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T16:14:36.243563Z 687d774 Manual request
🔒 Security Review ✅ Completed 2026-10-18T12:57:07.443640Z 153a016 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 153a0165ad

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@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: 153a0165ad

ℹ️ 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 install.sh Outdated
Comment on lines +8209 to +8210
_rfi_have=$(printf 'unsloth\nunsloth-zoo\n' \
| uv pip compile --python "$_VENV_PY" --no-deps --no-header --no-annotate --quiet - 2>/dev/null) || return 0

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 Resolve a mutually compatible Unsloth/Zoo pair

When a mirror has the newest unsloth and unsloth-zoo from different releases, this fallback selects both versions independently. uv pip compile --help explicitly defines --no-deps as ignoring package dependencies, so the probe does not verify the selected Zoo version satisfies Unsloth's metadata requirement. The normal with-dependencies paths can consequently remain unsatisfiable because Unsloth still requires a newer Zoo, while the no-torch paths force-install the incompatible pair with --no-deps. The PowerShell twin has the same issue; resolve a dependency-compatible pair before lowering either floor.

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.

Not reachable on a time-delayed index: every release uploads unsloth-zoo before unsloth (2026.10.1 to 2026.10.6 all do), so a cutoff never keeps an unsloth whose zoo is missing. The newest unsloth on such an index always has its zoo.

Comment thread install.sh Outdated
Comment on lines +8207 to +8208
printf '%s\n%s\n' "$_unsloth_release_install_spec" "$_unsloth_zoo_install_spec" \
| uv pip compile --python "$_VENV_PY" --no-deps --no-header --no-annotate --quiet - > /dev/null 2>&1 && return 0

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 Distinguish resolver constraints from a lagging index

When a custom index is configured and UV_CONSTRAINT pins unsloth or unsloth-zoo below these floors, the first compile fails because of that constraint—not because the index lacks the release—and the second compile returns the constrained old version. Since uv pip compile --help confirms that UV_CONSTRAINT applies to compilation, this code then mislabels the pin as a feed ceiling, lowers Desktop's requirement, and writes a marker that makes the deliberately outdated backend count as ready; previously the conflicting Desktop floor correctly stopped the install. The PowerShell probe inherits the same environment, so both implementations should either probe index availability without core-package constraints or decline the relaxation when such constraints are active.

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.

Intended: an operator who pins unsloth below the floor with UV_CONSTRAINT gets the version they pinned instead of an install that cannot resolve, and Desktop treats that backend, which is above its compatibility floor, as the newest available.

Comment on lines +1239 to +1243
if reason == "desktop_backend_version_outdated"
&& feed_ceiling_holds(bin, version, expected_backend_version())
{
info!("Managed preflight: backend {version:?} is the newest the package index has; not repairing");
return None;

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 Revalidate the feed ceiling after the mirror catches up

If the delayed index later publishes the requested release while the same Desktop build remains installed, this marker continues to suppress desktop_backend_version_outdated indefinitely: preflight never checks the index or expires the marker, and returning Ready prevents the automatic repair that would rerun the installer and remove it. The new test clears the marker only by directly invoking the installer resolver again, but production has no reason to do that once this branch reports Ready, so users remain on the lagged backend until a manual update or a newer Desktop changes requested. Add a bounded recheck or expiry so a temporary feed delay does not become a permanent version ceiling.

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.

Desktop ships with every backend release, so the next app update changes requested and the repair probes the index again. Until then the backend is the newest the index had and is above Desktop's floor, so it works; an expiry would only add repairs.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

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

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: ce857ecbc8

ℹ️ 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 studio/install_python_stack.py Outdated
Comment on lines +10384 to +10385
if not USE_UV or not _uv_index_may_lag():
return spec

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 Relax the floor for the supported pip fallback

When uv is missing or its bootstrap probe fails, _bootstrap_uv() sets USE_UV false and the core update deliberately falls back to pip, but this early return keeps the Desktop floor without inspecting PIP_INDEX_URL, PIP_EXTRA_INDEX_URL, or pip configuration. On a supported pip-only installation whose corporate index lags the release, the subsequent pip install therefore remains unsatisfiable; the manifest has already been removed and the ceiling marker is removed immediately above, so Settings update/repair cannot recover. Fresh evidence after the update-path fix is that it only covers the uv resolver even though _pip_install_once() explicitly supports pip fallback.

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.

Not on a path users reach with a lagging index: install.sh / install.ps1 always provision uv for the studio venv, and when the update fails anyway Desktop's repair runs the bundled installer, which lowers the floor (uv) and rewrites the manifest. A pip-only update against a lagging index is the exception path of the exception path.

@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: ce857ecbc8

ℹ️ 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 install.sh Outdated
_rfi_zoo=$(printf '%s\n' "$_rfi_have" | sed -n 's/^unsloth-zoo==\([0-9][0-9A-Za-z.+!-]*\)$/\1/p')
[ -n "$_rfi_unsloth" ] && [ -n "$_rfi_zoo" ] || return 0
substep "[WARN] your package index does not have $_unsloth_release_install_spec yet; installing unsloth $_rfi_unsloth, the newest it has" "$C_WARN"
_unsloth_release_install_spec="unsloth>=$_rfi_unsloth"

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 Keep the relaxed backend above Desktop's compatibility floor

When a severely delayed feed's newest backend predates MIN_DESKTOP_BACKEND_VERSION (currently 2026.8.4), this unconditionally lowers the install floor and writes a ceiling marker for that unsupported release. managed_backend_version_stale_reason classifies such a version as desktop_backend_version_too_old, and the new marker bypass applies only to desktop_backend_version_outdated, so the installer can report success only for Desktop to immediately start repair and repeat the same installation. The PowerShell and Python update implementations make the same unconditional relaxation; reject candidates below Desktop's compatibility floor and retain the original resolution failure 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.

An index more than two months behind is outside this fix: main fails that install too, and Desktop still names the reason (too old) instead of looping silently.

Comment thread install.sh Outdated
Comment on lines +8209 to +8210
_rfi_have=$(printf 'unsloth\nunsloth-zoo\n' \
| uv pip compile --python "$_VENV_PY" --no-deps --no-header --no-annotate --quiet - 2>/dev/null) || return 0

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 Resolve a compatible pair for package-specific cutoffs

When UV_EXCLUDE_NEWER_PACKAGE gives unsloth-zoo an older cutoff than unsloth, the first probe fails the Zoo floor and this dependency-free fallback independently selects the newest Unsloth and Zoo versions, for example 2026.10.6 and 2026.10.3. The resulting unsloth>=2026.10.6 floor prevents the dependency-aware install from choosing an older Unsloth compatible with that Zoo, while no-torch paths force-install the incompatible pair. Fresh evidence beyond the earlier upload-order rebuttal is this change's explicit support for package-specific cutoffs, which can create asymmetric availability regardless of release upload order; resolve the two bare requirements with dependencies before setting either floor.

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.

Needs deliberately different per-package cutoffs for unsloth and unsloth-zoo; a lagging mirror or a single cutoff keeps the pair consistent, since zoo always uploads first.

Comment on lines +10422 to +10423
except OSError:
pass

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 feed-ceiling marker cannot be written

When the venv root cannot replace this marker—for example, a stale directory occupies unsloth_feed_ceiling.json while package directories remain writable—this suppresses the error and still returns the relaxed backend specification. The update can then complete with an older backend and a valid install manifest, but Rust preflight finds no valid marker, reports the backend outdated, and launches the same repair on every startup. The marker is required for the fallback to produce a usable Desktop state, so its write failure should abort or retain the original floor rather than being ignored; the shell and PowerShell implementations also make this write best-effort.

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.

A directory occupying the marker path in a venv the installer just created is not a reachable state.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: e6d008f5c2

ℹ️ 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 added a commit to Etherll/unsloth that referenced this pull request Oct 18, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 18, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

danielhanchen added a commit to Etherll/unsloth that referenced this pull request Oct 18, 2026
danielhanchen added a commit to Etherll/unsloth that referenced this pull request Oct 18, 2026

@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: 4019ea217e

ℹ️ 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 +10395 to +10396
if newest(spec) is not None:
return spec

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 Probe the Zoo floor before accepting the Desktop floor

With a package-specific cutoff or partially synced mirror where the requested Unsloth release exists but its required unsloth-zoo floor does not, this early return skips the fallback because it probes only unsloth. uv pip compile --help states that --no-deps ignores dependencies, so the normal update later fails resolution, while the no-torch path can install the requested Unsloth beside an incompatible older Zoo. Fresh evidence in the final tree is that the shell and PowerShell implementations jointly probe both floors, whereas this Python path does not; make this initial check include the Zoo floor before returning spec.

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.

Needs a mirror that carries an unsloth release but not the zoo it was released with; zoo always uploads first, so a delayed feed or a single cutoff cannot produce that. If a partial mirror does, the update fails and Desktop's repair runs the bundled installer, whose joint probe lowers both floors. Probing zoo here would also misfire on PyPI whenever zoo version numbers trail unsloth's (2026.9.14 shipped with zoo 2026.9.9).

@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. Nice work!

Reviewed commit: 687d7742a2

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

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.

[Bug] Studio fails to install OOB when package feeds limit versions

1 participant