Repository navigation
fix(ci): stop hourly prune from deleting the just-published release - #13266
Merged
Merged
Conversation
Hourly prune sorted non-draft releases by createdAt, but nearly every orca-hourly release shares one createdAt from bulk import. At the retain cap, stable sort + reverse put the newest release past the window and immediately deleted it with --cleanup-tag. Sort by publishedAt (tagName as tie-break) and hard-skip the tag this run just published so prune cannot self-delete.
Contributor
📝 WalkthroughWalkthroughThe hourly Mac build workflow now prunes releases only after successful publication. It receives and protects the current release tag. It excludes draft releases. It sorts releases by 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
Review found that skipping only in the delete loop under-prunes when sort is wrong, and excluding TAG before the retain slice would permanently keep retain+1 releases. Force this run's tag to the front of the sorted list before slicing so it always has a retain seat and oldest builds still prune. Also gate prune on publish_live success and warn if TAG still appears stale.
enrick-dev
pushed a commit
to enrick-dev/orca
that referenced
this pull request
Oct 15, 2026
…tablyai#13266) * fix(ci): stop hourly prune from deleting the just-published release Hourly prune sorted non-draft releases by createdAt, but nearly every orca-hourly release shares one createdAt from bulk import. At the retain cap, stable sort + reverse put the newest release past the window and immediately deleted it with --cleanup-tag. Sort by publishedAt (tagName as tie-break) and hard-skip the tag this run just published so prune cannot self-delete. * fix(ci): harden hourly prune protect without retain+1 drift Review found that skipping only in the delete loop under-prunes when sort is wrong, and excluding TAG before the retain slice would permanently keep retain+1 releases. Force this run's tag to the front of the sorted list before slicing so it always has a retain seat and oldest builds still prune. Also gate prune on publish_live success and warn if TAG still appears stale.
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
The hourly macOS pipeline (
.github/workflows/hourly-mac-build.yml) has been publishing tostablyai/orca-hourlyand then immediately deleting the release it just published.Bug (publish-then-self-prune):
HOURLY_RETAIN_COUNT=72and the repo is already at 72 non-draft releases (at the cap).createdAt(2026-08-02T09:48:30Z), sosort_by(.createdAt)does not rank by recency.createdAt, jq’s stable sort +reverseflips the default newest-first list, so the just-published release lands past the retain window.--cleanup-tag. The job still exits 0.Evidence: run
31276157806publishedv1.4.177-hourly.202608082009then loggedPruning v1.4.177-hourly.202608082009. That tag is now 404. Last surviving published hourly at diagnosis wasv1.4.177-hourly.202608080021.Fix
In the prune step:
publishedAt(empty fallback), thentagName(…-hourly.YYYYMMDDHHMM) as a deterministic tie-break. Drafts still excluded from the retention count.$TAGto the front of the sorted list before the retain slice so this run always has a seat in the keep window. (Excluding$TAGbefore the slice would permanently keepretain+1; skipping only in the delete loop under-prunes when sort is still wrong.)$TAGstill appears in the stale list, log a::warning::and do not delete.publish_livesuccess — only reshape retention after a live publish; failed runs leave pruning to the next successful one (draft cleanup stays on the failure path).--cleanup-tagfor genuinely stale releases.Screenshots
No visual change.
Testing
gh/jqsimulation against livestablyai/orca-hourly(72 non-draft releases)publishedAtorder keeps…202608080021firstpublishedAtprunedcreatedAtsort without protect reproduces self-delete of newestpnpm lint/pnpm typecheck/pnpm test/pnpm build— N/A (workflow YAML only)Hourly macOS Dev Buildrun publishes a tag that remains listable (not pruned in the same run)AI Review Report
Reviewed the branch end-to-end (workflow control flow, retain math, sort stability, GHA step gating, live API fields).
Main risks checked:
$TAGpublishedAtnull / tied timestampsFlagged and fixed in follow-up commit:
$TAG-before-slice permanently keepsretain+1after every successful publish — rejected.$TAGto front, then slice, plus warning skip as backup.iftosteps.publish_live.outcome == 'success'.Verified as OK:
gh release list --json publishedAtis populated for all current non-draft hourliessuccess()previously already skipped prune on hard failures; explicit publish gate is clearer and matches intentSecurity Audit
app_token_publish) already required for publish/delete.$TAGis interpolated into a jq string after"escaping; tag values are pipeline-controlled (v*-hourly.YYYYMMDDHHMM), not user input.orca-hourlyonly; no change tostablyai/orcawrite permissions (contents: readat workflow level).--cleanup-tagretained for intentional stale deletes only; just-published tag is protected.Notes
createdAtfrom bulk import; do not reintroducecreatedAtordering for retention.HOURLY_RETAIN_COUNT, re-publishing deleted hourlies, adhoc channel prune (uses age cutoff, not retain count).