Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

CI: stop three workflows paying for work they throw away (#8976)

Daniel Hanc298c396588b
diff --git a/.github/workflows/consolidated-tests-ci.yml b/.github/workflows/consolidated-tests-ci.yml
index 7ad03d8e89d..0947e3b57c2 100644
--- a/.github/workflows/consolidated-tests-ci.yml
+++ b/.github/workflows/consolidated-tests-ci.yml
@@ -139,6 +139,15 @@ jobs:
with:
python-version: '3.12'
cache: 'pip'
+ # Without this, setup-python's default glob resolves to the repo's only
+ # requirements.txt, unsloth/kernels/moe/requirements.txt: five lines that have
+ # nothing to do with what this job installs. Every job in the repo therefore
+ # shared one cache slot keyed on an unrelated file, so a "hit" restored a few MB
+ # and the install still downloaded the whole tree. Key on what this job actually
+ # reads instead.
+ cache-dependency-path: |
+ pyproject.toml
+ studio/backend/requirements/*.txt
# Node 22 unblocks tests/studio/test_chat_preset_builtin_invariants.py's
# `node --experimental-strip-types` subprocess. Cheap to install; keeps
@@ -211,6 +220,14 @@ jobs:
set -euxo pipefail
python -m pip install --upgrade pip
pip install -r studio/backend/requirements/studio.txt
+ # CPU torch FIRST, before anything that depends on torch. peft, accelerate and
+ # datasets all declare a torch dependency, so installing them first made pip
+ # resolve it from PyPI: the default CUDA build, plus 14 nvidia_* wheels and
+ # cuda-toolkit, roughly 2.3 GB, which the pinned CPU wheel below then replaced
+ # seconds later. Same end state either way; this just stops paying for the
+ # download. torchvision: unsloth_zoo.vision_utils imports it at module scope.
+ pip install --index-url https://download.pytorch.org/whl/cpu --extra-index-url https://pypi.org/simple \
+ 'torch>=2.4,<2.11' 'torchvision<0.26'
pip install \
python-multipart aiofiles sqlalchemy cryptography \
pyyaml jinja2 mammoth unpdf requests typer \
@@ -219,9 +236,6 @@ jobs:
psutil packaging tqdm safetensors datasets \
'peft>=0.18,<0.20' 'accelerate>=0.34,<2' \
ipython
- # torchvision: unsloth_zoo.vision_utils imports it at module scope.
- pip install --index-url https://download.pytorch.org/whl/cpu --extra-index-url https://pypi.org/simple \
- 'torch>=2.4,<2.11' 'torchvision<0.26'
# transformers + trl from the matrix combo.
pip install "$RESOLVED_TRANSFORMERS_SPEC"
pip install "$RESOLVED_TRL_SPEC"
@@ -2223,6 +2237,15 @@ jobs:
with:
python-version: '3.12'
cache: 'pip'
+ # Without this, setup-python's default glob resolves to the repo's only
+ # requirements.txt, unsloth/kernels/moe/requirements.txt: five lines that have
+ # nothing to do with what this job installs. Every job in the repo therefore
+ # shared one cache slot keyed on an unrelated file, so a "hit" restored a few MB
+ # and the install still downloaded the whole tree. Key on what this job actually
+ # reads instead.
+ cache-dependency-path: |
+ pyproject.toml
+ studio/backend/requirements/*.txt
- name: Install runtime deps for unsloth_zoo.llama_cpp
# unsloth_zoo's `__init__` imports `temporary_patches`, which
diff --git a/.github/workflows/lint-ci.yml b/.github/workflows/lint-ci.yml
index ff2b089bf71..b6954ff1df6 100644
--- a/.github/workflows/lint-ci.yml
+++ b/.github/workflows/lint-ci.yml
@@ -55,6 +55,11 @@ jobs:
with:
python-version: '3.12'
cache: 'pip'
+ # This job installs three linters and nothing else. Without an explicit path it
+ # shared one cache key with every other Python 3.12 job in the repo, and whichever
+ # ran first won the slot: in practice this one, leaving a 9 MB cache that Core then
+ # restored before downloading 3.2 GB. Its pins are inline below, so key on this file.
+ cache-dependency-path: .github/workflows/lint-ci.yml
# Pin ruff to match .pre-commit-config.yaml so a CI-only ruff
# bump cannot disagree with what pre-commit accepted.
diff --git a/.github/workflows/notebooks-ci.yml b/.github/workflows/notebooks-ci.yml
index 2c46369a20a..b802dea7999 100644
--- a/.github/workflows/notebooks-ci.yml
+++ b/.github/workflows/notebooks-ci.yml
@@ -433,14 +433,26 @@ jobs:
- name: Install Colab-shaped venv
run: |
python -m pip install --upgrade pip
- # Best-effort: any single line that fails to resolve on CPU is
- # tolerated; the smoke contract is "the install cell + the unsloth
- # import works", not "the entire Colab venv reproduces."
- while IFS= read -r spec; do
- pip install "$spec" --index-url https://download.pytorch.org/whl/cpu \
- --extra-index-url https://pypi.org/simple || \
- echo "::warning::pin failed: $spec"
- done < /tmp/seed_pins.txt
+ # One resolve for the whole pin set instead of one per line. The per-line loop
+ # below re-resolved against both indexes for every one of ~683 pins, which is
+ # why this step spent its entire 25 minute cap here and never once reached
+ # "Verify imports under spoof".
+ #
+ # Best-effort is preserved, just moved: a single unresolvable pin fails the bulk
+ # install, and the fallback then walks the list line by line exactly as before,
+ # tolerating the ones that cannot resolve on CPU. The smoke contract is "the
+ # install cell + the unsloth import works", not "the entire Colab venv
+ # reproduces."
+ if ! pip install -r /tmp/seed_pins.txt \
+ --index-url https://download.pytorch.org/whl/cpu \
+ --extra-index-url https://pypi.org/simple; then
+ echo "::warning::bulk resolve failed, falling back to per-pin best effort"
+ while IFS= read -r spec; do
+ pip install "$spec" --index-url https://download.pytorch.org/whl/cpu \
+ --extra-index-url https://pypi.org/simple || \
+ echo "::warning::pin failed: $spec"
+ done < /tmp/seed_pins.txt
+ fi
- name: Run install cell
run: |
diff --git a/.github/workflows/security-audit.yml b/.github/workflows/security-audit.yml
index d24095114ad..a649ee09db3 100644
--- a/.github/workflows/security-audit.yml
+++ b/.github/workflows/security-audit.yml
@@ -53,7 +53,31 @@
name: Security audit
on:
+ # PRs run this only when they touch something it actually reads. Every job here is a
+ # function of the dependency manifests, the lockfiles, or the scanner sources: the pip
+ # shards build their input entirely from pyproject.toml + studio/backend/requirements/**,
+ # the npm jobs read studio/frontend/package*.json, and advisory-audit adds
+ # studio/src-tauri/Cargo.lock. A PR touching none of those cannot change any verdict, and
+ # over a 198 PR sample only 3.5% touched them, so the other 96.5% were re-scanning an
+ # unchanged dependency tree for roughly 40 minutes each.
+ #
+ # The floating pins that CAN change a verdict without a diff (a version range resolving to
+ # a new release, a fresh advisory) are covered by the daily cron below, which is
+ # deliberately left unfiltered, as is every push to main. So the worst case a filter
+ # introduces is that a newly published malicious version is caught by the nightly run or at
+ # merge instead of on the PR that did not touch dependencies.
pull_request:
+ paths:
+ - 'pyproject.toml'
+ - 'studio/backend/requirements/**'
+ - 'studio/frontend/package.json'
+ - 'studio/frontend/package-lock.json'
+ - 'studio/src-tauri/Cargo.lock'
+ - 'studio/src-tauri/Cargo.toml'
+ - 'scripts/scan_packages.py'
+ - 'scripts/scan_packages_baseline.json'
+ - 'tests/security/**'
+ - '.github/workflows/security-audit.yml'
push:
branches: [main]
schedule:
diff --git a/.github/workflows/studio-backend-ci.yml b/.github/workflows/studio-backend-ci.yml
index 4a12632a0b1..24a842e8544 100644
--- a/.github/workflows/studio-backend-ci.yml
+++ b/.github/workflows/studio-backend-ci.yml
@@ -75,6 +75,9 @@ jobs:
with:
python-version: '${{ matrix.python }}'
cache: 'pip'
+ cache-dependency-path: |
+ pyproject.toml
+ studio/backend/requirements/*.txt
- name: Install backend test dependencies (CPU only)
run: |
@@ -142,6 +145,9 @@ jobs:
with:
python-version: '3.12'
cache: 'pip'
+ cache-dependency-path: |
+ pyproject.toml
+ studio/backend/requirements/*.txt
# node + uv unlock ~60 tests that previously skipped on CI:
# - 9 tests in test_chat_preset_builtin_invariants.py need node to