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.

studio/ci: harden HF_HOME cache against actions/cache v5 silent restore failures (#5396)

Daniel Han040b80a60e6b
diff --git a/.github/workflows/studio-windows-inference-smoke.yml b/.github/workflows/studio-windows-inference-smoke.yml
index b33b6f9563f..13bd8e58e25 100644
--- a/.github/workflows/studio-windows-inference-smoke.yml
+++ b/.github/workflows/studio-windows-inference-smoke.yml
@@ -73,15 +73,29 @@ jobs:
with:
python-version: '3.12'
- - name: Cache HF_HOME for ${{ env.GGUF_REPO }}
+ # Split restore + save (rather than the one-step actions/cache) so a
+ # transient restore-side failure does not kill the whole job. v5 has a
+ # known flake where it logs "Cache hit for: <key>" and then exits
+ # non-zero without actually extracting the archive (see
+ # actions/cache#1621 and github community discussion #163260).
+ # continue-on-error on restore masks that failure so the Prime step
+ # below can re-download from HF and the job keeps running. Save then
+ # populates the cache key on a real miss only; cache keys are
+ # immutable, so a corrupted cached entry persists until the -v1
+ # suffix below is bumped.
+ - name: Restore HF_HOME cache for ${{ env.GGUF_REPO }}
id: cache-hf
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
+ uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
+ continue-on-error: true
with:
path: hf-cache
key: ${{ runner.os }}-hf-${{ env.GGUF_REPO }}-${{ env.GGUF_VARIANT }}-v1
- name: Prime HF_HOME with the GGUF
- if: steps.cache-hf.outputs.cache-hit != 'true'
+ id: prime-hf
+ # Run on a real cache miss AND on the silent-restore-failure mode
+ # described above (outcome != success).
+ if: steps.cache-hf.outputs.cache-hit != 'true' || steps.cache-hf.outcome != 'success'
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
@@ -90,6 +104,16 @@ jobs:
HF_HUB_ENABLE_HF_TRANSFER=1 \
hf download "$GGUF_REPO" "$GGUF_FILE"
+ - name: Save HF_HOME cache for ${{ env.GGUF_REPO }}
+ # 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'
+ uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
+ with:
+ path: hf-cache
+ key: ${{ runner.os }}-hf-${{ env.GGUF_REPO }}-${{ env.GGUF_VARIANT }}-v1
+
- name: Pre-install Windows tweaks (npm 11 + Defender exclusions)
shell: pwsh
# See studio-windows-update-smoke.yml for the full rationale.
@@ -375,15 +399,20 @@ jobs:
with:
python-version: '3.12'
- - name: Cache GGUF model file
+ # Split restore + save so a transient restore-side failure does not
+ # kill the whole job. See the matching block in the tool-calling job
+ # above for the full rationale (actions/cache#1621).
+ - name: Restore GGUF model cache
id: cache-gguf
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
+ uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
+ continue-on-error: true
with:
path: gguf-cache
key: ${{ runner.os }}-gguf-${{ env.GGUF_REPO }}-${{ env.GGUF_FILE }}-v1
- name: Download GGUF if cache miss
- if: steps.cache-gguf.outputs.cache-hit != 'true'
+ id: download-gguf
+ if: steps.cache-gguf.outputs.cache-hit != 'true' || steps.cache-gguf.outcome != 'success'
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
@@ -392,6 +421,13 @@ jobs:
HF_HUB_ENABLE_HF_TRANSFER=1 \
hf download "$GGUF_REPO" "$GGUF_FILE" --local-dir gguf-cache
+ - name: Save GGUF model cache
+ if: always() && steps.download-gguf.outcome == 'success'
+ uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
+ with:
+ path: gguf-cache
+ key: ${{ runner.os }}-gguf-${{ env.GGUF_REPO }}-${{ env.GGUF_FILE }}-v1
+
- name: Pre-install Windows tweaks (npm 11 + Defender exclusions)
shell: pwsh
# See studio-windows-update-smoke.yml for the full rationale.
@@ -771,15 +807,23 @@ jobs:
with:
python-version: '3.12'
- - name: Cache HF_HOME for ${{ env.GGUF_REPO }} (model + mmproj)
+ # Split restore + save so a transient restore-side failure does not
+ # kill the whole job. See the matching block in the tool-calling job
+ # for the full rationale (actions/cache#1621). This is the block that
+ # actually broke in run 25713577488: "Cache hit for: <key>" was
+ # logged, the step exited non-zero in ~0.3 s without extracting the
+ # 3.4 GiB archive, and steps 6-15 were skipped.
+ - name: Restore HF_HOME cache for ${{ env.GGUF_REPO }} (model + mmproj)
id: cache-hf
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
+ uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
+ continue-on-error: true
with:
path: hf-cache
key: ${{ runner.os }}-hf-${{ env.GGUF_REPO }}-${{ env.GGUF_VARIANT }}-${{ env.MMPROJ_FILE }}-v1
- name: Prime HF_HOME with the GGUF + mmproj
- if: steps.cache-hf.outputs.cache-hit != 'true'
+ id: prime-hf
+ if: steps.cache-hf.outputs.cache-hit != 'true' || steps.cache-hf.outcome != 'success'
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
@@ -790,6 +834,13 @@ jobs:
HF_HUB_ENABLE_HF_TRANSFER=1 \
hf download "$GGUF_REPO" "$MMPROJ_FILE"
+ - name: Save HF_HOME cache for ${{ env.GGUF_REPO }} (model + mmproj)
+ if: always() && steps.prime-hf.outcome == 'success'
+ uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
+ with:
+ path: hf-cache
+ key: ${{ runner.os }}-hf-${{ env.GGUF_REPO }}-${{ env.GGUF_VARIANT }}-${{ env.MMPROJ_FILE }}-v1
+
- name: Pre-install Windows tweaks (npm 11 + Defender exclusions)
shell: pwsh
# See studio-windows-update-smoke.yml for the full rationale.