Skip to content

Commit 9e34bf7

Browse files
mtfishmanclaude
andauthored
Disable cache-on-failure (save-always: false on julia-actions/cache@v3) (#119)
## Summary `julia-actions/cache@v3` (introduced via #118) saves caches **on job failure** by default, where v2 only saved on success. The escape hatch documented in the v3 release notes is `save-always: false`. This PR sets that on every `julia-actions/cache@v3` invocation in the reusable workflows here. The new v3 default is reasonable for the common case (test-failure retries reuse the expensive depot install). But when the failure is in the *setup* itself — a half-installed depot, an aborted `Pkg` precompile — the broken state is cached, the restore-key prefix matches subsequent runs, and every retry restores the broken state and fails identically. Reruns alone can't recover; the cache has to be manually evicted or expire. This was hit on [`ITensor/ITensorNetworks.jl#373`](ITensor/ITensorNetworks.jl#373): a fresh Windows run failed in `Pkg.test` precompilation (`ChainRulesCore is required but does not seem to be installed`), the broken state was cached, and two reruns reproduced the failure verbatim by restoring from that cache. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e892924 commit 9e34bf7

6 files changed

Lines changed: 22 additions & 0 deletions

File tree

.github/workflows/CheckCompatBounds.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ jobs:
7474
if: "${{ inputs.cache }}"
7575
with:
7676
token: "${{ secrets.GITHUB_TOKEN }}"
77+
# See the comment in `Tests.yml`: don't cache a failed job's
78+
# half-installed depot, which would otherwise poison the cache.
79+
save-always: false
7780

7881
- uses: julia-actions/julia-buildpkg@v1
7982
if: "${{ inputs.buildpkg }}"

.github/workflows/Documentation.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ jobs:
9898
if: "${{ inputs.cache }}"
9999
with:
100100
token: "${{ secrets.GITHUB_TOKEN }}"
101+
# See the comment in `Tests.yml`: don't cache a failed job's
102+
# half-installed depot, which would otherwise poison the cache.
103+
save-always: false
101104

102105
- name: "Export extra environment variables"
103106
if: "${{ inputs.extra-env != '' }}"

.github/workflows/FormatCheck.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ jobs:
6464
arch: "x64"
6565

6666
- uses: julia-actions/cache@v3
67+
with:
68+
# See the comment in `Tests.yml`: don't cache a failed job's
69+
# half-installed depot, which would otherwise poison the cache.
70+
save-always: false
6771

6872
- name: "Install ITensorFormatter"
6973
run: |

.github/workflows/FormatPullRequest.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ jobs:
5454
arch: "${{ runner.arch }}"
5555

5656
- uses: julia-actions/cache@v3
57+
with:
58+
# See the comment in `Tests.yml`: don't cache a failed job's
59+
# half-installed depot, which would otherwise poison the cache.
60+
save-always: false
5761

5862
- name: "Install ITensorFormatter"
5963
run: |

.github/workflows/Registrator.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ jobs:
7676
- uses: julia-actions/cache@v3
7777
with:
7878
delete-old-caches: false
79+
# See the comment in `Tests.yml`: don't cache a failed job's
80+
# half-installed depot, which would otherwise poison the cache.
81+
save-always: false
7982

8083
- name: "Checkout package"
8184
uses: actions/checkout@v6

.github/workflows/Tests.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,11 @@ jobs:
180180
if: "${{ steps.classify.outputs.triggers == 'true' && inputs.cache }}"
181181
with:
182182
token: "${{ secrets.GITHUB_TOKEN }}"
183+
# Restore the pre-v3 behavior: don't save a cache from a failed
184+
# job. v3 caches on failure by default, which poisons the cache
185+
# with broken state (e.g. a half-installed depot) and makes every
186+
# subsequent run restore that broken state and fail the same way.
187+
save-always: false
183188

184189
- uses: julia-actions/julia-buildpkg@v1
185190
if: "${{ steps.classify.outputs.triggers == 'true' && inputs.buildpkg }}"

0 commit comments

Comments
 (0)