feat(ci): reconcile previews that outlived their pull request - #1461
Conversation
Cleanup on close is the fast path and it is also the only path. It exits without doing anything when COOLIFY_API_TOKEN is unset, it never runs for a fork, and it cannot reach Coolify if Coolify is down at that moment. Nothing afterwards notices, so a preview that outlives its pull request keeps a cloned database and a git checkout — roughly 4 GB — until someone goes looking, which is how the last one was found. This asks the opposite question daily: of the pull requests that closed recently, does any still have a preview? Deleting one is idempotent, so an already-clean pull request answers 404 and costs a request. Open pull requests are never touched, and reclaiming anything is reported as a warning rather than absorbed silently — a reconciler that quietly fixes the same leak every night is hiding a broken cleanup path. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EZADQeSx6zQNNqsdu7AAqZ
|
Warning Review limit reached
Next review available in: 59 minutes Limit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?Wait for the limit to reset, then comment An organization admin can change what happens after included review limits in Billing. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
📚 Documentation Preview
|
Description
cleanup-preview.ymldeletes a preview when its pull request closes. That is the fast path, and it works — but it is also the only path, and it has three silent holes:COOLIFY_API_TOKENis unset;Nothing afterwards notices. A preview that outlives its pull request keeps a cloned database and a git checkout — roughly 4 GB — until someone goes looking, which is exactly how the last orphan was found.
What changes
A scheduled job that asks the opposite question daily: of the pull requests that closed recently, does any still have a preview? For each, it issues the same idempotent delete the cleanup workflow does. An already-clean pull request answers 404 and costs one request; open pull requests are never touched.
Reclaiming anything is reported as a warning with the pull request number, and lands in the job summary. That is deliberate: a reconciler that quietly fixes the same leak every night is hiding a broken cleanup path, and the point is to see it.
Defaults to a 45-day window, overridable on manual dispatch. No new secrets — it reuses the Coolify variables the cleanup workflow already has, and skips itself with a notice if they are absent.
How to test
date -dis GNU-only, so I extracted the step script and ran it on a Linux host against a stubbed Coolify and pull request list, covering all three paths:checked=2 reclaimed=1 failed=0, warning raised, summary row writtenCOOLIFY_API_TOKENunsetThe
gh pr list --jqquery was run against this repository for real and returns the expectednumber closedAtpairs.Checklist
.changeset/README.md**Operators:** …) andMIGRATION.mdis updatedNo changeset: this adds a CI workflow only. Nothing under
server/,webapp/ordocker/changes, so there is no operator- or user-visible effect to describe.