fix(ci): add retry logic to sccache --start-server in setup-sccache action#60577
Merged
Conversation
…ction Wrap sccache --start-server in a 3-attempt retry loop with 5-second delays to handle transient WebDAV 500 errors. On persistent failure, gracefully degrade by unsetting RUSTC_WRAPPER so builds complete without cache rather than failing the entire job. This addresses recurring CI failures (~1-2/week over 4+ months) caused by the WebDAV cache backend returning HTTP 500 on health check.
Contributor
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
.github/actions/setup-sccache/action.yml:71-87
Setting `RUSTC_WRAPPER=sccache` before the retry loop and then attempting to clear it with `RUSTC_WRAPPER=` (empty string) is risky. GitHub Actions sets the env var to an empty string rather than unsetting it, and cargo's handling of `RUSTC_WRAPPER=""` varies by version — older cargo releases may attempt to exec an empty string as the wrapper instead of treating it as "no wrapper", causing builds to fail anyway. The intent of graceful degradation is better served by only writing `RUSTC_WRAPPER=sccache` on success, eliminating the need for the override entirely.
```suggestion
echo "$RUNNER_TEMP/sccache" >> "$GITHUB_PATH"
for i in 1 2 3; do
if "$RUNNER_TEMP/sccache/sccache" --start-server; then
echo "sccache server started successfully"
echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"
break
fi
if [ "$i" -eq 3 ]; then
echo "::warning::sccache failed to start after 3 attempts, continuing without cache"
exit 0
fi
echo "sccache startup attempt $i failed, retrying in 5 seconds..."
"$RUNNER_TEMP/sccache/sccache" --stop-server 2>/dev/null || true
sleep 5
done
"$RUNNER_TEMP/sccache/sccache" --version
```
Reviews (1): Last reviewed commit: "fix(ci): add retry logic to sccache --st..." | Re-trigger Greptile |
Move RUSTC_WRAPPER=sccache into the success branch of the retry loop instead of setting it before and clearing on failure. This avoids issues with cargo interpreting an empty RUSTC_WRAPPER as a command to execute.
gantoine
approved these changes
May 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sccache --start-serverin a 3-attempt retry loop (5s delay between attempts) to handle transient WebDAV 500 errors that have been causing ~1-2 CI failures per week for 4+ monthsRUSTC_WRAPPERso builds complete (slower, without cache) rather than failing the entire jobContext
Related insight: sccache WebDAV backend 500 errors causing recurring Rust CI failures
The WebDAV cache backend intermittently returns HTTP 500 on the startup health check (
GET .sccache_check). Since thesetup-sccacheaction had no retry logic, every transient error immediately failed the step and the entire job. 22+ occurrences observed across 14+ distinct backend IPs over 4 months.Note
Created by Mendral. Tag @mendral-app with feedback or questions.