Repository navigation
CI: reclaim this run's artifact storage once the release is published - #82
Conversation
ed9e581 to
50a35ca
Compare
|
Review round 1 applied. One genuine blocker, plus two latent bugs. Rebuilt on the updated #81 head. BLOCKER: the step had no
Artifact names are keyed only on the tag, so a rebuild of tag This also falsified a claim in the original description: the check is on name, not payload. Fixed by giving the publish step an - name: Publish GitHub release
id: publish
...
- name: Reclaim artifact storage
if: ${{ steps.publish.outcome == 'success' }}
Also: a Correction to the reclaim figures. The description said 99.3% of 7.42 GiB. Measured on the completed run Independently confirmed and unchanged:
Known residual, documented rather than fixed: a cancellation landing inside the ~13 second window leaves artifacts partially deleted, and the retry workflow would then rerun Fixture tests re-run against the rebuilt step: happy path 2 delete / 1 keep, draft release 0 deletes, missing release 0 deletes, empty tag 0 deletes, regex-metachar case now KEEP. |
50a35ca to
958e4a9
Compare
|
Round 2 applied. The reviewer found no path that deletes a still-needed artifact -- on real data the matcher is exact in both directions (36/36 deletions have a byte-identical release asset) -- but did find one real interaction bug, and I have reversed an earlier design decision because of it. The reclaim now runs as its own job, not as the last step of I originally argued against a separate job on the grounds that it has to queue for its own runner. That reasoning was incomplete: I weighed the cost of the separate job without weighing the cost of the in-step version, which turns out to be higher. As a trailing step, a cancellation landing inside the ~13 second window left This is not hypothetical: As a separate job, Weighing it properly: if the reclaim job never gets a runner, artifacts age out on the existing 1-day retention, which is exactly today's behaviour. The in-step failure mode is a false alert plus an 8 GiB re-upload. The separate job is clearly the better trade. It also fixes a privilege problem I had underweighted. Gating is now Correction to my previous comment. I wrote that the Nits also applied:
Round-1 fixes all confirmed by the reviewer, two of them load-bearing: without Re-tested after the rework: happy path, idempotent re-run, draft gate, missing release, empty tag, delete-failure reporting. |
958e4a9 to
289128d
Compare
289128d to
958558b
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 958558b32a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # assets match whichever run wrote them. | ||
| reclaim: | ||
| name: Reclaim artifact storage | ||
| needs: [resolve, assemble] |
There was a problem hiding this comment.
Exclude the reclaim job from the assemble waiter
The Wait for the build matrix step builds SIBS from every run job except Assemble metadata + publish and Report pipeline health, then waits until every sibling is completed. This new job depends on assemble, so while it is queued in the run's job list, assemble counts it as pending even though reclaim cannot start until assemble completes. Publish-intent runs therefore deadlock until the waiter's 330-minute timeout and publish nothing; filter Reclaim artifact storage out alongside the alert job.
Useful? React with 👍 / 👎.
| # Gate 2: only THIS run's artifacts are even considered, so the step | ||
| # cannot reach another run's -- including a concurrent build's. | ||
| gh api "repos/$repo/actions/runs/$GITHUB_RUN_ID/artifacts" --paginate \ | ||
| -q '.artifacts[] | select(.expired==false) | "\(.id)\t\(.size_in_bytes)\t\(.name)"' > "$arts" || true |
There was a problem hiding this comment.
Surface failures while listing artifacts
If the run-artifacts request fails because of a transient API, authentication, or pagination error, || true discards the failure and leaves an empty or partial $arts file; the step then reports a successful cleanup with zero or too few artifacts and never warns that this run retained most of its storage. gh help exit-codes documents that a failed command exits with status 1, and the step already has continue-on-error, so preserve or explicitly report this error rather than converting it into an apparent successful sweep.
Useful? React with 👍 / 👎.
| # Every prebuilt is stored TWICE: as an Actions artifact (billed against the | ||
| # Actions storage quota) and as a release asset (not billed against it). | ||
| # Measured on run 31218133438: 36 of its 40 artifacts, 7.67 GiB, are byte-for | ||
| # -byte already on the release. On 2026-08-07 that duplication reached ~492 | ||
| # GiB org-wide, 449 GiB of it here, and GitHub stopped scheduling Actions runs |
There was a problem hiding this comment.
Condense the reclaim job commentary
This begins a roughly 40-line operational postmortem, followed by further long, hard-wrapped explanations throughout the job that repeat the implementation and commit rationale. Keep only concise comments for non-obvious safety invariants and move incident history or measurements to documentation; the repository explicitly requires comments to remain concise, avoid excessive commentary, and avoid fixed-column wrapping.
AGENTS.md reference: AGENTS.md:L74-L77
Useful? React with 👍 / 👎.
Stacked on #81 -- base it there so the diff shows only this change. Retarget to
masteronce #81 merges.Deletes this run's
app-*artifacts as the final step ofassemble, after the release is published and verified.Why
Every prebuilt is stored twice: as an Actions artifact (billed against the Actions storage quota) and as a release asset (not billed against it). Measured on
b10297-mix-b1e9972:Same payload. On 2026-08-07 that duplication stalled Actions across the whole org: artifact storage hit ~492 GiB, 449 GiB of it here, and GitHub stopped scheduling runs for
unslothai/*while personal-account repos ran the same workflows normally. Deleting artifacts restored scheduling within ~45 seconds. Repo retention was already 1 day -- volume alone did it.Reclaims 7.37 of 7.42 GiB per run (99.3%), so the repo settles near zero between runs instead of ~450 GiB.
Why inside
assemble, not a separate jobassemblealready holds its runner for the whole run (it starts alongside the matrix and waits), so appending ~13 seconds of work costs nothing. A separate job would have to queue after assemble finishes -- and during a queue backlog that is exactly when it would be delayed or cancelled, i.e. cleanup fails precisely when storage pressure is highest.permissions.actionsgoesread->write. This job already publishes releases withcontents: write, so deleting its own build artifacts is a smaller power than it already holds.Safety
Published assets cannot break: release assets live in different storage from Actions artifacts.
unsloth-prebuilt-retry.ymlcallsrerun-failed-jobson the same run id. If anything after this failed, a rerun of assemble would restart at "Download built bundles" and find the bundles gone -- turning a trivial failure into an unrecoverable one. Nothing may fail after this point.if:, so the defaultsuccess()applies. A failed publish is exactly when the artifacts are still the only copy./actions/runs/$GITHUB_RUN_ID/artifacts) -- it cannot reach another run's, including a concurrent build's.<name>.tar.gzor<name>.zip). Anything unproven is KEPT.continue-on-error: true-- a cleanup hiccup never fails an already-published release.Gate 5 deliberately keeps the macOS bundles (published as
llama-<tag>-bin-macos-*, notapp-...) and the source tarball: 56 MiB of the 7.42 GiB. Cheap price for never deleting something early.Artifacts stay load-bearing during the run and nothing here changes that -- build children download the source artifact, assemble downloads
pattern: app-*. Verified there are no cross-run artifact downloads (norun-id:/repository:on anydownload-artifact), which is what makes post-publish deletion provably safe.Testing
Script extracted from the YAML and run against fixtures:
bash -ncleanThroughput is measured, not estimated: a real purge ran 1,745 deletes in 617 s (2.9/s, ~344 ms each, 0 failures), so 35 deletes is ~13 seconds on a job that has already been alive 3-6 hours.
Test plan