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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
CI: save caches only on main, so PR runs stop evicting the caches they need (#7990)
Daniel Han9a68a9e1eca5
diff --git a/.github/workflows/local-agent-guides-ci.yml b/.github/workflows/local-agent-guides-ci.ymlindex 0dc0cc66d76..f33ed4b2558 100644--- a/.github/workflows/local-agent-guides-ci.yml+++ b/.github/workflows/local-agent-guides-ci.yml@@ -36,6 +36,30 @@ on:schedule:- cron: '37 7 * * 1'workflow_dispatch:+ # This workflow's cache saves are gated to refs/heads/main, and unlike the+ # other ten workflows in that change it had no main-ref trigger at all, so+ # main's copy of the 4.6GB GGUF could only ever be written by the Monday+ # cron. That is a poor match for a 7-day unused-cache retention on a repo+ # that is over the 10GB budget: once LRU evicts main's copy, every PR+ # re-downloads until the next cron repairs it. Seed it on merge instead,+ # behind the same paths filter as the pull_request trigger below so this+ # only runs when the guarded sources actually change.+ push:+ branches: [main]+ paths:+ - 'unsloth_cli/**'+ - 'studio/backend/routes/**'+ - 'studio/backend/main.py'+ - 'studio/backend/core/inference/llama_cpp.py'+ - 'studio/backend/models/**'+ - 'install.sh'+ - '.github/workflows/local-agent-guides-ci.yml'+ - '.github/scripts/serve-unsloth-run.sh'+ - '.github/scripts/assert-prompt-cache.sh'+ - '.github/scripts/agent-guides-install.sh'+ - '.github/scripts/agent-guides-drive.sh'+ - '.github/scripts/ci-connect-prompt.txt'+ - '.github/scripts/ci-min-system-prompt.txt'pull_request:paths:- 'unsloth_cli/**'@@ -148,7 +172,17 @@ jobs:bash .github/scripts/hf-download-with-retry.sh "$GGUF_REPO" "$GGUF_FILE" gguf-cache- name: Save GGUF model file- if: always() && steps.download-gguf.outcome == 'success'+ # Save on main only. Caches created on a PR ref are scoped to that+ # merge ref -- per GitHub's docs they "can only be restored by re-runs+ # of the pull request" -- while every PR *can* restore from the default+ # branch. So a PR-scoped save helps almost nothing and competes for the+ # 10GB per-repo budget, and when that budget is exceeded GitHub evicts+ # by least-recently-used, which deletes main's copies that all PRs share.+ # This repo was measured at 33.3GB across 30 caches, 3.3x over, with the+ # same 4.6GB model held four times on four different PR refs and no copy+ # on main at all. That is the thrash loop: PR misses -> downloads ->+ # saves its own copy -> evicts main's -> next PR misses.+ if: always() && github.ref == 'refs/heads/main' && steps.download-gguf.outcome == 'success'uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5with:path: gguf-cache@@ -288,7 +322,14 @@ jobs:# ═════════════════════════════════════════════════════════════════════file-edit:name: file-edit (${{ matrix.agent }})- if: github.event_name != 'pull_request'+ # Weekly / dispatch only, stated explicitly rather than as "not a PR".+ # The main push trigger above exists solely to seed the cache that the+ # save steps are now gated to main for, and `connection` already writes+ # the identical key (same GGUF_REPO and GGUF_FILE), so this job seeds+ # nothing new. Left as `!= 'pull_request'` a push would newly start its+ # 2-job matrix at 60 minutes each, which is runtime the seeding does not+ # need and which this job was never meant to spend outside its cron.+ if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'runs-on: ubuntu-latesttimeout-minutes: 60# hermes and openclaw drive a multi-turn tool loop that a CPU-only runner@@ -355,7 +396,7 @@ jobs:bash .github/scripts/hf-download-with-retry.sh "$GGUF_REPO" "$GGUF_FILE" gguf-cache- name: Save GGUF model file- if: always() && steps.download-gguf.outcome == 'success'+ if: always() && github.ref == 'refs/heads/main' && steps.download-gguf.outcome == 'success'uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5with:path: gguf-cache@@ -539,7 +580,7 @@ jobs:bash .github/scripts/hf-download-with-retry.sh "$GGUF_REPO" "$GGUF_FILE" gguf-cache- name: Save GGUF model file- if: always() && steps.download-gguf.outcome == 'success'+ if: always() && github.ref == 'refs/heads/main' && steps.download-gguf.outcome == 'success'uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5with:path: gguf-cache@@ -702,7 +743,7 @@ jobs:bash .github/scripts/hf-download-with-retry.sh "$GGUF_REPO" "$GGUF_FILE"- name: Save HF_HOME for ${{ env.GGUF_REPO }}- if: always() && steps.prime-hf.outcome == 'success'+ if: always() && github.ref == 'refs/heads/main' && steps.prime-hf.outcome == 'success'uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5with:path: hf-cachediff --git a/.github/workflows/security-audit.yml b/.github/workflows/security-audit.ymlindex 27eafbedea8..15a2410498f 100644--- a/.github/workflows/security-audit.yml+++ b/.github/workflows/security-audit.yml@@ -169,6 +169,11 @@ jobs:- uses: swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1with:+ # Save only on main. This action defaults to saving on every ref, and+ # a PR-scoped rust cache (550-840MB here) can only be restored by+ # re-runs of that same PR while still counting against the 10GB+ # per-repo budget, evicting main's copy that every PR can restore.+ save-if: ${{ github.ref == 'refs/heads/main' }}workspaces: studio/src-tauri -> target- name: Install pip-audit + cargo-auditdiff --git a/.github/workflows/studio-api-smoke.yml b/.github/workflows/studio-api-smoke.ymlindex 1cfa66fea4b..6825a39c729 100644--- a/.github/workflows/studio-api-smoke.yml+++ b/.github/workflows/studio-api-smoke.yml@@ -92,7 +92,17 @@ jobs:bash .github/scripts/hf-download-with-retry.sh ggml-org/models tinyllamas/stories260K.gguf- name: Save HF_HOME for ${{ env.GGUF_REPO }}- if: always() && steps.prime-hf.outcome == 'success'+ # Save on main only. Caches created on a PR ref are scoped to that+ # merge ref -- per GitHub's docs they "can only be restored by re-runs+ # of the pull request" -- while every PR *can* restore from the default+ # branch. So a PR-scoped save helps almost nothing and competes for the+ # 10GB per-repo budget, and when that budget is exceeded GitHub evicts+ # by least-recently-used, which deletes main's copies that all PRs share.+ # This repo was measured at 33.3GB across 30 caches, 3.3x over, with the+ # same 4.6GB model held four times on four different PR refs and no copy+ # on main at all. That is the thrash loop: PR misses -> downloads ->+ # saves its own copy -> evicts main's -> next PR misses.+ if: always() && github.ref == 'refs/heads/main' && steps.prime-hf.outcome == 'success'uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5with:path: hf-cachediff --git a/.github/workflows/studio-inference-smoke.yml b/.github/workflows/studio-inference-smoke.ymlindex c37c9555bf0..c909976953c 100644--- a/.github/workflows/studio-inference-smoke.yml+++ b/.github/workflows/studio-inference-smoke.yml@@ -106,7 +106,17 @@ jobs:bash .github/scripts/hf-download-with-retry.sh ggml-org/models tinyllamas/stories260K.gguf- name: Save HF_HOME for ${{ env.GGUF_REPO }}- if: always() && steps.prime-hf.outcome == 'success'+ # Save on main only. Caches created on a PR ref are scoped to that+ # merge ref -- per GitHub's docs they "can only be restored by re-runs+ # of the pull request" -- while every PR *can* restore from the default+ # branch. So a PR-scoped save helps almost nothing and competes for the+ # 10GB per-repo budget, and when that budget is exceeded GitHub evicts+ # by least-recently-used, which deletes main's copies that all PRs share.+ # This repo was measured at 33.3GB across 30 caches, 3.3x over, with the+ # same 4.6GB model held four times on four different PR refs and no copy+ # on main at all. That is the thrash loop: PR misses -> downloads ->+ # saves its own copy -> evicts main's -> next PR misses.+ if: always() && github.ref == 'refs/heads/main' && steps.prime-hf.outcome == 'success'uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5with:path: hf-cache@@ -375,7 +385,7 @@ jobs:bash .github/scripts/hf-download-with-retry.sh "$GGUF_REPO" "$GGUF_FILE" gguf-cache- name: Save GGUF model file- if: always() && steps.download-gguf.outcome == 'success'+ if: always() && github.ref == 'refs/heads/main' && steps.download-gguf.outcome == 'success'uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5with:path: gguf-cache@@ -955,7 +965,7 @@ jobs:bash .github/scripts/hf-download-with-retry.sh ggml-org/models tinyllamas/stories260K.gguf- name: Save HF_HOME for ${{ env.GGUF_REPO }} (model + mmproj)- if: always() && steps.prime-hf.outcome == 'success'+ if: always() && github.ref == 'refs/heads/main' && steps.prime-hf.outcome == 'success'uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5with:path: hf-cachediff --git a/.github/workflows/studio-mac-inference-smoke.yml b/.github/workflows/studio-mac-inference-smoke.ymlindex 1dbf86ae98d..7afc1466f29 100644--- a/.github/workflows/studio-mac-inference-smoke.yml+++ b/.github/workflows/studio-mac-inference-smoke.yml@@ -102,7 +102,17 @@ jobs:# Save partial caches on cancel/timeout -- hf download resumes by# content hash. `outcome != skipped` keeps cache-hit a no-op.- name: Save HF_HOME for ${{ env.GGUF_REPO }}- if: always() && steps.prime-hf.outcome != 'skipped' && hashFiles('hf-cache/**/*.gguf') != ''+ # Save on main only. Caches created on a PR ref are scoped to that+ # merge ref -- per GitHub's docs they "can only be restored by re-runs+ # of the pull request" -- while every PR *can* restore from the default+ # branch. So a PR-scoped save helps almost nothing and competes for the+ # 10GB per-repo budget, and when that budget is exceeded GitHub evicts+ # by least-recently-used, which deletes main's copies that all PRs share.+ # This repo was measured at 33.3GB across 30 caches, 3.3x over, with the+ # same 4.6GB model held four times on four different PR refs and no copy+ # on main at all. That is the thrash loop: PR misses -> downloads ->+ # saves its own copy -> evicts main's -> next PR misses.+ if: always() && github.ref == 'refs/heads/main' && steps.prime-hf.outcome != 'skipped' && hashFiles('hf-cache/**/*.gguf') != ''uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5with:path: hf-cache@@ -358,7 +368,7 @@ jobs:# Save partial caches on cancel; next run resumes via content hash.- name: Save GGUF model file- if: always() && steps.download-gguf.outcome != 'skipped' && hashFiles('gguf-cache/**/*.gguf') != ''+ if: always() && github.ref == 'refs/heads/main' && steps.download-gguf.outcome != 'skipped' && hashFiles('gguf-cache/**/*.gguf') != ''uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5with:path: gguf-cache@@ -805,7 +815,7 @@ jobs:# additional mmproj-presence check stops a partial save from# poisoning the cache for the next run.- name: Save GGUF + mmproj files- if: always() && steps.download-gguf.outcome != 'skipped' && hashFiles('gguf-cache/**/*.gguf') != '' && hashFiles(format('gguf-cache/{0}', env.MMPROJ_FILE)) != ''+ if: always() && github.ref == 'refs/heads/main' && steps.download-gguf.outcome != 'skipped' && hashFiles('gguf-cache/**/*.gguf') != '' && hashFiles(format('gguf-cache/{0}', env.MMPROJ_FILE)) != ''uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5with:path: gguf-cachediff --git a/.github/workflows/studio-mac-ui-smoke.yml b/.github/workflows/studio-mac-ui-smoke.ymlindex 6b0db19d55b..0e5efbcfb1e 100644--- a/.github/workflows/studio-mac-ui-smoke.yml+++ b/.github/workflows/studio-mac-ui-smoke.yml@@ -111,7 +111,17 @@ jobs:bash .github/scripts/hf-download-with-retry.sh ggml-org/models tinyllamas/stories260K.gguf- name: Save HF_HOME for ${{ env.GGUF_REPO }}- if: always() && steps.prime-hf.outcome == 'success'+ # Save on main only. Caches created on a PR ref are scoped to that+ # merge ref -- per GitHub's docs they "can only be restored by re-runs+ # of the pull request" -- while every PR *can* restore from the default+ # branch. So a PR-scoped save helps almost nothing and competes for the+ # 10GB per-repo budget, and when that budget is exceeded GitHub evicts+ # by least-recently-used, which deletes main's copies that all PRs share.+ # This repo was measured at 33.3GB across 30 caches, 3.3x over, with the+ # same 4.6GB model held four times on four different PR refs and no copy+ # on main at all. That is the thrash loop: PR misses -> downloads ->+ # saves its own copy -> evicts main's -> next PR misses.+ if: always() && github.ref == 'refs/heads/main' && steps.prime-hf.outcome == 'success'uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5with:path: hf-cachediff --git a/.github/workflows/studio-tauri-smoke.yml b/.github/workflows/studio-tauri-smoke.ymlindex ff46cfed222..61a4d82b7ce 100644--- a/.github/workflows/studio-tauri-smoke.yml+++ b/.github/workflows/studio-tauri-smoke.yml@@ -58,6 +58,11 @@ jobs:- uses: swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2.9.1with:+ # Save only on main. This action defaults to saving on every ref, and+ # a PR-scoped rust cache (550-840MB here) can only be restored by+ # re-runs of that same PR while still counting against the 10GB+ # per-repo budget, evicting main's copy that every PR can restore.+ save-if: ${{ github.ref == 'refs/heads/main' }}workspaces: studio/src-tauri -> target- name: Install pinned Tauri CLI (matches release-desktop.yml)@@ -169,6 +174,11 @@ jobs:- uses: swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2.9.1with:+ # Save only on main. This action defaults to saving on every ref, and+ # a PR-scoped rust cache (550-840MB here) can only be restored by+ # re-runs of that same PR while still counting against the 10GB+ # per-repo budget, evicting main's copy that every PR can restore.+ save-if: ${{ github.ref == 'refs/heads/main' }}workspaces: studio/src-tauri -> target# Windows runners expose `python`, not `python3`, so pin an interpreterdiff --git a/.github/workflows/studio-ui-smoke.yml b/.github/workflows/studio-ui-smoke.ymlindex f7d484993ca..4002ad397ff 100644--- a/.github/workflows/studio-ui-smoke.yml+++ b/.github/workflows/studio-ui-smoke.yml@@ -102,7 +102,17 @@ jobs:bash .github/scripts/hf-download-with-retry.sh ggml-org/models tinyllamas/stories260K.gguf- name: Save HF_HOME for ${{ env.GGUF_REPO }}- if: always() && steps.prime-hf.outcome == 'success'+ # Save on main only. Caches created on a PR ref are scoped to that+ # merge ref -- per GitHub's docs they "can only be restored by re-runs+ # of the pull request" -- while every PR *can* restore from the default+ # branch. So a PR-scoped save helps almost nothing and competes for the+ # 10GB per-repo budget, and when that budget is exceeded GitHub evicts+ # by least-recently-used, which deletes main's copies that all PRs share.+ # This repo was measured at 33.3GB across 30 caches, 3.3x over, with the+ # same 4.6GB model held four times on four different PR refs and no copy+ # on main at all. That is the thrash loop: PR misses -> downloads ->+ # saves its own copy -> evicts main's -> next PR misses.+ if: always() && github.ref == 'refs/heads/main' && steps.prime-hf.outcome == 'success'uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5with:path: hf-cachediff --git a/.github/workflows/studio-windows-api-smoke.yml b/.github/workflows/studio-windows-api-smoke.ymlindex 0fe9cccf493..1d199772e44 100644--- a/.github/workflows/studio-windows-api-smoke.yml+++ b/.github/workflows/studio-windows-api-smoke.yml@@ -85,7 +85,17 @@ jobs:bash .github/scripts/hf-download-with-retry.sh ggml-org/models tinyllamas/stories260K.gguf- name: Save HF_HOME for ${{ env.GGUF_REPO }}- if: always() && steps.prime-hf.outcome == 'success'+ # Save on main only. Caches created on a PR ref are scoped to that+ # merge ref -- per GitHub's docs they "can only be restored by re-runs+ # of the pull request" -- while every PR *can* restore from the default+ # branch. So a PR-scoped save helps almost nothing and competes for the+ # 10GB per-repo budget, and when that budget is exceeded GitHub evicts+ # by least-recently-used, which deletes main's copies that all PRs share.+ # This repo was measured at 33.3GB across 30 caches, 3.3x over, with the+ # same 4.6GB model held four times on four different PR refs and no copy+ # on main at all. That is the thrash loop: PR misses -> downloads ->+ # saves its own copy -> evicts main's -> next PR misses.+ if: always() && github.ref == 'refs/heads/main' && steps.prime-hf.outcome == 'success'uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5with:path: hf-cachediff --git a/.github/workflows/studio-windows-inference-smoke.yml b/.github/workflows/studio-windows-inference-smoke.ymlindex 73e319adb69..f2e8a8c498c 100644--- a/.github/workflows/studio-windows-inference-smoke.yml+++ b/.github/workflows/studio-windows-inference-smoke.yml@@ -154,7 +154,17 @@ jobs:# Only write a fresh cache entry when we actually rebuilt the# directory (Prime ran and succeeded). Skipping when Prime is# skipped avoids "already exists" save warnings on the happy path.- if: always() && steps.prime-hf.outcome == 'success'+ # Save on main only. Caches created on a PR ref are scoped to that+ # merge ref -- per GitHub's docs they "can only be restored by re-runs+ # of the pull request" -- while every PR *can* restore from the default+ # branch. So a PR-scoped save helps almost nothing and competes for the+ # 10GB per-repo budget, and when that budget is exceeded GitHub evicts+ # by least-recently-used, which deletes main's copies that all PRs share.+ # This repo was measured at 33.3GB across 30 caches, 3.3x over, with the+ # same 4.6GB model held four times on four different PR refs and no copy+ # on main at all. That is the thrash loop: PR misses -> downloads ->+ # saves its own copy -> evicts main's -> next PR misses.+ if: always() && github.ref == 'refs/heads/main' && steps.prime-hf.outcome == 'success'uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5with:path: hf-cache@@ -502,7 +512,7 @@ jobs:bash .github/scripts/hf-download-with-retry.sh "$GGUF_REPO" "$GGUF_FILE" gguf-cache- name: Save GGUF model cache- if: always() && steps.download-gguf.outcome == 'success'+ if: always() && github.ref == 'refs/heads/main' && steps.download-gguf.outcome == 'success'uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5with:path: gguf-cache@@ -1000,7 +1010,7 @@ jobs:bash .github/scripts/hf-download-with-retry.sh ggml-org/models tinyllamas/stories260K.gguf- name: Save HF_HOME cache for ${{ env.GGUF_REPO }} (model + mmproj)- if: always() && steps.prime-hf.outcome == 'success'+ if: always() && github.ref == 'refs/heads/main' && steps.prime-hf.outcome == 'success'uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5with:path: hf-cache@@ -1412,7 +1422,7 @@ jobs:bash .github/scripts/hf-download-with-retry.sh ggml-org/models tinyllamas/stories260K.gguf- name: Save HF_HOME for ${{ env.GGUF_REPO }}- if: always() && steps.prime-hf.outcome == 'success'+ if: always() && github.ref == 'refs/heads/main' && steps.prime-hf.outcome == 'success'uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5with:path: hf-cachediff --git a/.github/workflows/studio-windows-ui-smoke.yml b/.github/workflows/studio-windows-ui-smoke.ymlindex 894672a85a2..098f57f9c8e 100644--- a/.github/workflows/studio-windows-ui-smoke.yml+++ b/.github/workflows/studio-windows-ui-smoke.yml@@ -101,7 +101,17 @@ jobs:bash .github/scripts/hf-download-with-retry.sh ggml-org/models tinyllamas/stories260K.gguf- name: Save HF_HOME for ${{ env.GGUF_REPO }}- if: always() && steps.prime-hf.outcome == 'success'+ # Save on main only. Caches created on a PR ref are scoped to that+ # merge ref -- per GitHub's docs they "can only be restored by re-runs+ # of the pull request" -- while every PR *can* restore from the default+ # branch. So a PR-scoped save helps almost nothing and competes for the+ # 10GB per-repo budget, and when that budget is exceeded GitHub evicts+ # by least-recently-used, which deletes main's copies that all PRs share.+ # This repo was measured at 33.3GB across 30 caches, 3.3x over, with the+ # same 4.6GB model held four times on four different PR refs and no copy+ # on main at all. That is the thrash loop: PR misses -> downloads ->+ # saves its own copy -> evicts main's -> next PR misses.+ if: always() && github.ref == 'refs/heads/main' && steps.prime-hf.outcome == 'success'uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5with:path: hf-cache