Add nightly GHCR retention workflow for eval-agent-server#689
Add nightly GHCR retention workflow for eval-agent-server#689all-hands-bot merged 2 commits intomainfrom
Conversation
Refs #684. Deletes package versions older than a configurable cut-off (default 2mo), keeping a safety buffer of 100 most-recent versions and preserving legacy v1.0.0* tags. Uses snok/container-retention-policy. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
juanmichelini
left a comment
There was a problem hiding this comment.
LGTM, this is a GitHub action, approving so it can be tested
all-hands-bot
left a comment
There was a problem hiding this comment.
🟡 Acceptable - Pragmatic solution with solid safety mechanisms. A few clarifications suggested but the core design is sound.
[RISK ASSESSMENT][Overall PR] This PR introduces a nightly maintenance workflow that automatically deletes old container images from GHCR. Risk factors: Elevated Risk Factors:
Mitigating Factors:
Recommendation: This is acceptable for autonomous merge with the following caveats:
VERDICT: KEY INSIGHT: This review was created by an AI agent (OpenHands) on behalf of the repository maintainers. |
we can always test it by overriding another pre-existing github action and then renaming it before merging btw! |
Pin snok/container-retention-policy to the v3.0.0 commit SHA so a future tag retarget can't hand a PAT with delete:packages to arbitrary code. Drop the job-level packages: write block — it's dead since the action authenticates via GHCR_CLEANUP_PAT, not GITHUB_TOKEN. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Adds
.github/workflows/ghcr-retention.yml— a nightly GC job that deletes old versions ofghcr.io/openhands/eval-agent-server. Refs #684.What it does
workflow_dispatchwithdry-run(defaulttrue),cut-off(default2mo), andkeep-n-most-recent(default100) inputs. Scheduled runs perform real deletions; manual runs dry-run by default.cut-offexcept the 100 most-recently-created and any tag matchingv1.0.0*.snok/container-retention-policy@v3.0.0— handles multi-arch manifest lists so deleting a parent index doesn't leave dangling children.eval-agent-serveronly.Prerequisites
GHCR_CLEANUP_PAT— classic PAT withdelete:packages+read:packages(or fine-grained withPackages: read & writeon the org).GITHUB_TOKENcannot delete org package versions.benchmarkshasWriterole at https://github.com/orgs/OpenHands/packages/container/eval-agent-server/settings (the existing 8 build workflows already push successfully, so this is likely already set).Rollout
dry-run: true→ read the log, sanity-check the delete count (expect tens of thousands).dry-run: falsefor the first real purge, or wait for the next nightly. First run may take hours due to GHCR secondary rate limits (timeout-minutes: 720).Known gap
Retention does not cross-reference eval metadata on GCS (
gs://openhands-evaluation-results/metadata/*.jsonl), so an in-flight eval against a >2mo SDK sha could lose its image mid-run. Low probability given the 100-version buffer; proper fix (pre-delete jsonl filter) is a follow-up PR. cc @juanmichelini @simonrosenberg.Test plan
GHCR_CLEANUP_PATsecretWriteroledry-run: true— inspect the deletion listdry-run: falsefor the first real purgeghcr.io/v2/openhands/eval-agent-server/tags/list(expect ~130k → a few thousand)build-swebench-images.ymlrun still succeeds