Skip to content

chore(ci): batch closed-PR cache cleanup into a 6-hourly sweep#8512

Merged
JSONbored merged 1 commit into
mainfrom
chore/cache-cleanup-batched
Jul 24, 2026
Merged

chore(ci): batch closed-PR cache cleanup into a 6-hourly sweep#8512
JSONbored merged 1 commit into
mainfrom
chore/cache-cleanup-batched

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

Queue-pressure follow-up to today's Actions saturation (60 queued runs at peak; CodeQL default-setup already disabled separately). The per-closed-PR pull_request_target:[closed] trigger queued one runner per close — dozens/day at the one-shot gate's volume, all competing with real CI for the concurrent-runner cap. This converts it to a 6-hourly scheduled sweep (+ manual dispatch):

  • Enumerates all PR-scoped cache refs, resolves each unique PR's real state via the API (never inferred from cache age — an idle-but-open maintainer branch must never lose a still-restorable cache), and deletes entries for closed PRs only.
  • 4 flat runs/day regardless of PR volume; a few hours of lingering entries is harmless (the 10GB budget has headroom between sweeps; LRU only bites near the cap — the original problem was permanent unreachable entries, which this still fully solves).
  • Same actions: write scope, plus pull-requests: read for the state checks; single non-cancelling concurrency group.

Validation

actionlint clean (shellcheck-clean after converting the sweep loops to while read). Trigger-and-permissions-only change; no repo code touched.

The per-closed-PR pull_request_target trigger queued one runner per close —
dozens of runs a day at the one-shot gate's volume, competing with real CI
for the org's concurrent-runner cap during exactly the bursts when CI is
most backed up (observed: 60-run queue saturation). A cache entry lingering
a few hours between sweeps costs nothing, so one scheduled sweep (4/day
flat, volume-independent) replaces N per-close runs: enumerate PR-scoped
cache refs, check each unique PR's real state (never inferred from cache
age — an idle-but-open maintainer branch must never lose a restorable
cache), delete the closed ones.
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@JSONbored JSONbored self-assigned this Jul 24, 2026
@JSONbored
JSONbored merged commit 9285881 into main Jul 24, 2026
3 checks passed
@JSONbored
JSONbored deleted the chore/cache-cleanup-batched branch July 24, 2026 16:58
@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.53%. Comparing base (f50d010) to head (58f038a).
⚠️ Report is 24 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #8512       +/-   ##
===========================================
+ Coverage   63.16%   92.53%   +29.36%     
===========================================
  Files         791      793        +2     
  Lines       79348    79527      +179     
  Branches    23970    24029       +59     
===========================================
+ Hits        50124    73591    +23467     
+ Misses      25514     4799    -20715     
+ Partials     3710     1137     -2573     
Flag Coverage Δ
shard-1 54.10% <ø> (?)
shard-2 50.67% <ø> (?)
shard-3 57.96% <ø> (+5.38%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 461 files with indirect coverage changes

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.

1 participant