ci(arm): wait for the server's mergeable answer before merging #2029

Merged
jaylouisw merged 1 commit from ci/1118-2027 into main 2026-11-18 20:38:13 +00:00
Owner

What was broken

Arm auto-merge goes green without merging. Evidence, all read from /actions/tasks and the pulls API:

PR arm job arm green at actually merged merged by
#2025 run 6611 20:03:29 20:07:33 scheduled rebase pass
#2024 run 6608 20:00:15 20:07:44 scheduled rebase pass
#2023 run 6606 19:52:14 20:08:13 scheduled rebase pass
#2026 run 6627 20:25:56 not merged (8/8 statuses success, mergeable=true at 20:30) -
#2027 run 6629 20:25:56 not merged -
#2028 run 6631 (skipped smoke/docker) not merged -

Every merge above landed via the scheduled pass, which rebases the branch and re-runs the whole five-job matrix on a fresh head. So each green PR paid a second matrix and 4-16 minutes of latency after its gate had already said yes.

The cause is the documented one in pr-rebase.yml: Forgejo fills mergeable from a background task, and a merge POST that arrives before it has answered is refused with 405 "Please try again later". The old loop retried the same POST three times 4 s apart and then exited 0 - which is also why the job takes 30-32 s (runs 6606-6627) doing nothing useful.

The change

  • poll GET /pulls/:n for mergeable first, bounded at 40 s (2 s interval), then POST the merge;
  • the retry drops from 3 attempts/4 s to 2/3 s, and the remaining path is unchanged;
  • the status-set verification is untouched: still every status on the head, still three CI / Test (Node *) legs required, still head_commit_id pinning the commit this run checked. Nothing can merge a red or unmergeable PR that could not before.

Coverage unchanged

No test, job, matrix leg or check is removed or skipped. All three Node legs, smoke, docker and the syntax check still run in full.

Baseline and after-run ids will be recorded in a follow-up comment once this run reports.

## What was broken `Arm auto-merge` goes green without merging. Evidence, all read from `/actions/tasks` and the pulls API: | PR | arm job | arm green at | actually merged | merged by | |----|---------|--------------|-----------------|-----------| | #2025 | run 6611 | 20:03:29 | 20:07:33 | scheduled rebase pass | | #2024 | run 6608 | 20:00:15 | 20:07:44 | scheduled rebase pass | | #2023 | run 6606 | 19:52:14 | 20:08:13 | scheduled rebase pass | | #2026 | run 6627 | 20:25:56 | not merged (8/8 statuses success, mergeable=true at 20:30) | - | | #2027 | run 6629 | 20:25:56 | not merged | - | | #2028 | run 6631 | (skipped smoke/docker) | not merged | - | Every merge above landed via the scheduled pass, which rebases the branch and re-runs the whole five-job matrix on a fresh head. So each green PR paid a second matrix and 4-16 minutes of latency after its gate had already said yes. The cause is the documented one in `pr-rebase.yml`: Forgejo fills `mergeable` from a background task, and a merge POST that arrives before it has answered is refused with 405 "Please try again later". The old loop retried the same POST three times 4 s apart and then exited 0 - which is also why the job takes 30-32 s (runs 6606-6627) doing nothing useful. ## The change - poll `GET /pulls/:n` for `mergeable` first, bounded at 40 s (2 s interval), then POST the merge; - the retry drops from 3 attempts/4 s to 2/3 s, and the remaining path is unchanged; - the status-set verification is untouched: still every status on the head, still three `CI / Test (Node *)` legs required, still `head_commit_id` pinning the commit this run checked. Nothing can merge a red or unmergeable PR that could not before. ## Coverage unchanged No test, job, matrix leg or check is removed or skipped. All three Node legs, smoke, docker and the syntax check still run in full. Baseline and after-run ids will be recorded in a follow-up comment once this run reports.
ci(arm): ask the server whether mergeable has settled before asking it to merge
All checks were successful
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 4s
CI / Classify the change (pull_request) Successful in 6s
CI / Server smoke test (pull_request) Successful in 8s
CI / Docker build (pull_request) Successful in 24s
CI / Test (Node 20) (pull_request) Successful in 52s
CI / Test (Node 22) (pull_request) Successful in 55s
CI / Test (Node 18) (pull_request) Successful in 59s
CI / Arm auto-merge (pull_request) Successful in 57s
e9cc3b4e40
Three consecutive pull requests (runs 6627/6629/6631, #2026-#2028) went
through this gate with all eight statuses green and mergeable=true, and
none of them was merged: the merge POST is refused while Forgejo's
background task has not yet filled the cached mergeable field, and the
old loop answered that refusal with three identical POSTs 4 s apart and
then exited 0. The three pull requests before those landed 4-16 min
after their own arm job had gone green, each via the scheduled rebase
pass, which re-runs the whole matrix on a fresh head.

So poll the cached field first, bounded at 40 s, then POST once. The
status-set verification above is unchanged, head_commit_id still pins
the tested commit, and a refusal still leaves the branch for the next
pass.
jaylouisw deleted branch ci/1118-2027 2026-11-18 20:38:15 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
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!2029
No description provided.