ci(pr-rebase): a pushed head that got no run is put back, not left dead (#2082) #2090

Merged
jaylouisw merged 1 commit from fix/1119-0432 into main 2026-11-19 05:07:55 +00:00
Owner

Second increment on #2082, on top of the credential guard in #2085.

What was wrong. pr-rebase force-pushed a rebased head and never looked at whether the forge created a run for it. On 2026-11-19 that left pull requests at total_count: 0 with no /actions/tasks row at all - not created-and-cancelled, never created. A head with no statuses can never be armed, and since the rebased head sits on current main, no later pass revisits it: the pull request is out of CI permanently. Measured on the instance during this run: d5e15d71, 882f98ec, 740a4235 all answer state: "", total_count: 0, while 460c9281 / 18838f99 (pushed by the authoring loop) answer 8 statuses each. All three dead heads carry packetforge-bot@users.noreply.git.jayw.uk, the identity only this workflow sets.

What changed. After a successful push, the job reads /commits/<pushed_sha>/status, bounded at 60 s against the measured ~25 s a dispatched push takes to report. On zero it force-pushes the branch back to head_sha - the head it replaced, which still carries its checks - leased to the pushed sha so a concurrent push is never overwritten, says why, and stops. Behind main can merge on the checks it has; a head nothing checks cannot be merged at all. The arming path also now sets head_sha="$pushed_sha" after a checked push, so the head_commit_id it sends names the head that exists rather than the one it replaced.

Why this and not only #2085. #2085 refuses the push when the credential is the run token. FORGEJO_TOKEN is set on this repository, and the three dead heads above were pushed while it was set - so the credential guard will not fire for the reported cases, and only the answer from the forge distinguishes a rebased head that is in CI from one that is not.

Tests. New test/pr-rebase-unchecked-head.test.js (3 assertions, all failing before the change): poll is of the pushed sha and comes after the push; the zero answer restores the pre-push head under a lease on the pushed one; the step stops instead of falling through to arming; the arming payload is about the pushed head. node --test test/pr-rebase-unchecked-head.test.js test/ci-disk-hygiene.test.js -> 15 tests, 15 pass, 0 fail. node scripts/syntax-check.js -> 437 files, all OK. The step body also passes bash -n.

Fixes #2082

Second increment on #2082, on top of the credential guard in #2085. **What was wrong.** pr-rebase force-pushed a rebased head and never looked at whether the forge created a run for it. On 2026-11-19 that left pull requests at `total_count: 0` with no `/actions/tasks` row at all - not created-and-cancelled, never created. A head with no statuses can never be armed, and since the rebased head sits on current `main`, no later pass revisits it: the pull request is out of CI permanently. Measured on the instance during this run: `d5e15d71`, `882f98ec`, `740a4235` all answer `state: ""`, `total_count: 0`, while `460c9281` / `18838f99` (pushed by the authoring loop) answer 8 statuses each. All three dead heads carry `packetforge-bot@users.noreply.git.jayw.uk`, the identity only this workflow sets. **What changed.** After a successful push, the job reads `/commits/<pushed_sha>/status`, bounded at 60 s against the measured ~25 s a dispatched push takes to report. On zero it force-pushes the branch back to `head_sha` - the head it replaced, which still carries its checks - leased to the pushed sha so a concurrent push is never overwritten, says why, and stops. Behind main can merge on the checks it has; a head nothing checks cannot be merged at all. The arming path also now sets `head_sha="$pushed_sha"` after a checked push, so the `head_commit_id` it sends names the head that exists rather than the one it replaced. **Why this and not only #2085.** #2085 refuses the push when the credential is the run token. `FORGEJO_TOKEN` is set on this repository, and the three dead heads above were pushed while it was set - so the credential guard will not fire for the reported cases, and only the answer from the forge distinguishes a rebased head that is in CI from one that is not. **Tests.** New `test/pr-rebase-unchecked-head.test.js` (3 assertions, all failing before the change): poll is of the pushed sha and comes after the push; the zero answer restores the pre-push head under a lease on the pushed one; the step stops instead of falling through to arming; the arming payload is about the pushed head. `node --test test/pr-rebase-unchecked-head.test.js test/ci-disk-hygiene.test.js` -> 15 tests, 15 pass, 0 fail. `node scripts/syntax-check.js` -> 437 files, all OK. The step body also passes `bash -n`. Fixes #2082
ci(pr-rebase): a pushed head that got no run is put back, not left dead (#2082)
All checks were successful
CI / Classify the change (pull_request) Successful in 13s
CI / Test (Node 18) (pull_request) Successful in 55s
CI / Test (Node 20) (pull_request) Successful in 51s
CI / Test (Node 22) (pull_request) Successful in 54s
CI / Server smoke test (pull_request) Successful in 6s
CI / Docker build (pull_request) Successful in 15s
CI / Arm auto-merge (pull_request) Successful in 2s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 1m31s
a976b12c8f
On 2026-11-19 the queue filled with pull requests at 0 check statuses that stayed
there. The stuck heads carry the committer this job sets, and for those heads
`/commits/<sha>/status` answered `total_count: 0` while `/actions/tasks` had no row
for the sha at all: no run was ever created, so there was nothing to re-run and
nothing to arm. A head with no checks can never be armed, and because the rebased
head sits on current `main` no later pass revisits it - the pull request is out of
CI permanently.

#2085 closes the credential that was measured (the run's own token) by refusing
the push before it is made. That is necessary but not sufficient: a push is
evidence that the branch moved, never that a run exists, and this job did not
look. So after the push the job now reads the status set of the head it minted,
bounded at 60 s against the measured ~25 s a dispatched push takes to report,
and when the answer is zero it force-pushes the branch back to the head it
replaced - leased to the pushed sha, so a push that landed meanwhile is never
overwritten. That head still has the checks it reported, and a pull request
behind main can merge on them; a head nothing checks cannot be merged at all.

The arming decision afterwards also names the head that now exists: `head_sha`
still pointed at the pre-push commit, so a green answer armed (or refused) a
decision about a commit that was no longer the branch tip.

test/pr-rebase-unchecked-head.test.js holds the rule as text: the poll is of the
pushed sha and comes after the push, the zero answer restores the pre-push head
under a lease on the pushed one, the step stops instead of falling through to
arming, and the arming payload is about the pushed head.
forgejo-actions force-pushed fix/1119-0432 from a976b12c8f
All checks were successful
CI / Classify the change (pull_request) Successful in 13s
CI / Test (Node 18) (pull_request) Successful in 55s
CI / Test (Node 20) (pull_request) Successful in 51s
CI / Test (Node 22) (pull_request) Successful in 54s
CI / Server smoke test (pull_request) Successful in 6s
CI / Docker build (pull_request) Successful in 15s
CI / Arm auto-merge (pull_request) Successful in 2s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 1m31s
to 9ff7ae6b96 2026-11-19 04:42:40 +00:00
Compare
forgejo-actions force-pushed fix/1119-0432 from 9ff7ae6b96 to a976b12c8f
All checks were successful
CI / Classify the change (pull_request) Successful in 13s
CI / Test (Node 18) (pull_request) Successful in 55s
CI / Test (Node 20) (pull_request) Successful in 51s
CI / Test (Node 22) (pull_request) Successful in 54s
CI / Server smoke test (pull_request) Successful in 6s
CI / Docker build (pull_request) Successful in 15s
CI / Arm auto-merge (pull_request) Successful in 2s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 1m31s
2026-11-19 04:43:52 +00:00
Compare
forgejo-actions scheduled this pull request to auto merge when all checks succeed 2026-11-19 04:50:34 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jaylouisw/packetforge!2090
No description provided.