Skip to content

Retire closed PR CI and reclaim its cache from the trusted default branch - #2412

Open
lalalune wants to merge 3 commits into
developfrom
codex/develop-closed-pr-cache-custody
Open

lalalune wants to merge 3 commits into
developfrom
codex/develop-closed-pr-cache-custody

Conversation

@lalalune

@lalalune lalalune commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

Why

A closed PR should release the CI capacity needed to verify the next Android and Pixel release. The development CI rewrite moved three close events back to pull_request_target. GitHub recorded startup failures before any job started, so the previous PR runs kept running. The ordinary closed event already runs on main. The newly added cache cleanup needs to retain its write permission inside trusted code. Failed CI retirement · Failed Android retirement · Earlier closed-event repair

Change

The three retirement workflows respond to ordinary pull_request.closed with empty token permissions and keep their existing concurrency groups. The general retirement records the PR number and exact closure time in its run name. A successful run wakes a separate workflow_run job sourced from the default branch. The job checks out no code and downloads no artifacts. Only that job receives actions: write and pull-requests: read.

The worker verifies the canonical PR's state, closure time, base repository/branch and head repository/branch/commit. It enumerates only that PR's merge-ref caches, keeps the IDs created by the recorded closure, and checks the live PR again before each deletion. An already absent ID is a successful retry. Other API errors are reported. Uploads after closure stay outside this cleanup. An unmarked historical close run keeps its existing behavior. GitHub has separate PR and cache APIs, so the last state read and the deletion cannot be atomic. Each deletion names a previously observed immutable cache ID. GitHub workflow-run events · GitHub cache deletion by ID

Verification

Real GitHub readback on a closed merged PR confirmed its head SHA and branch match the run, its embedded pull-request list is empty, and its cache rows use fractional-second timestamps. The forked Alpha PR, its ordinary PR run and its close receipt all recorded the same distinct source repository ID, branch and commit. The write path was exercised with the candidate workflow on the standard remote, a real loopback HTTP DELETE endpoint and captured provider metadata. The checks cover a normal closure, a fork, reopening, a changed closure/head/base, missing source identity, two pages of IDs, unrelated refs and newer IDs, 404 retry, and visible read/write failures. No live cache was used for the rehearsal. All four workflows passed actionlint. The first normal hosted closure after this lands is the live check of GitHub's two event deliveries.

This branch is being deployed

1 queued deployment
turbo-cache-read — fea71ac6 Deployed Dec 4, 2026 by lalalune via prepare-eliza #1664
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