Skip to content

Skip already-deleted caches in PR cleanup loop#554

Merged
nikobockerman merged 1 commit into
mainfrom
fix-pr-cache-removal-when-github-reports-already-deleted-entries
Jun 8, 2026
Merged

Skip already-deleted caches in PR cleanup loop#554
nikobockerman merged 1 commit into
mainfrom
fix-pr-cache-removal-when-github-reports-already-deleted-entries

Conversation

@nikobockerman

Copy link
Copy Markdown
Owner

GitHub's Actions Cache list endpoint is eventually consistent: a cache just deleted in one outer iteration can reappear in the next list call, causing the second gh cache delete to 404 and fail the job (as seen in PR #553's Cleanup caches run). Track every ID the script has already removed and filter subsequent list responses against it so each cache is only deleted once.

GitHub's Actions Cache list endpoint is eventually consistent: a cache
just deleted in one outer iteration can reappear in the next list call,
causing the second `gh cache delete` to 404 and fail the job (as seen
in PR #553's Cleanup caches run). Track every ID the script has already
removed and filter subsequent list responses against it so each cache
is only deleted once.
Copilot AI review requested due to automatic review settings June 8, 2026 20:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the GitHub Actions cache cleanup script used for PRs to tolerate eventual consistency in gh cache list, preventing attempts to delete the same cache ID multiple times across iterations.

Changes:

  • Track cache IDs already deleted (seen) and filter subsequent gh cache list responses to avoid double-deletes.
  • Adjust the “total” progress string to be based on whether the raw list hit the page limit.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mise-tasks/github/cache/remove-for-pr.py
@nikobockerman nikobockerman merged commit 63db812 into main Jun 8, 2026
53 checks passed
@nikobockerman nikobockerman deleted the fix-pr-cache-removal-when-github-reports-already-deleted-entries branch June 8, 2026 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants