ci(arm): arm the merge instead of retrying a POST its own pending check blocks #2031

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

Follow-up to #2029, which found the symptom but fixed the wrong cause. #2029 has landed; this replaces its mergeable wait with the actual mechanism.

What was broken

Arm auto-merge never merged. It spent 30-57 s per pull request doing it.

PR arm job arm green merged how
#2026 run 6627 (task 17238) 20:30:15 20:37:27 armed by the scheduled pass at 20:30:02, landed on Forgejo's auto-merge queue
#2027 run 6629 ~20:30 20:37:38 same
#2028 run 6631 ~20:30 20:37:51 same
#2029 run 6634 (task 17247, 57 s) 20:36:57 20:38:13 the same POST sent by hand, from outside the run

Eight statuses success, mergeable: true, and the in-job POST refused every time with 405 and an empty body.

The cause

The caller's own commit status. While the step runs, CI / Arm auto-merge is pending on the head commit, and Forgejo validates a merge against every status on that commit - so the one check that says "not green" is the caller's own. It cannot turn green until the job ends, which is why three POSTs 4 s apart all got the same answer: a retry loop inside a check cannot outrun its own status. Outside the run (my manual POST at 20:38:13, 8/8 green) the identical request merged immediately.

The change

Send the request that means what this step already means: merge_when_checks_succeed: true. Both scheduled passes (auto-rebase.yml, pr-rebase.yml) already send exactly this; a PR armed here is armed the same way it would have been minutes later, and stops waiting for someone else to ask.

  • one POST, no retries: 30-57 s of futile retrying becomes one request;
  • 200/201 = armed, 409 = already armed, anything else is a refusal;
  • on refusal the server's own words are posted as a PR comment (the job log needs a login, the job status is success by design, and a ::warning:: is an annotation nobody opens).

Coverage / gate unchanged

  • the status-set reader is untouched: every status on the head must be success, and all three CI / Test (Node *) legs must be present;
  • head_commit_id still pins the commit whose checks were read;
  • no job, matrix leg, test or check is removed or skipped.

After-run ids will be added as a comment.

Follow-up to #2029, which found the symptom but fixed the wrong cause. #2029 has landed; this replaces its `mergeable` wait with the actual mechanism. ## What was broken `Arm auto-merge` never merged. It spent 30-57 s per pull request doing it. | PR | arm job | arm green | merged | how | |----|---------|-----------|--------|-----| | #2026 | run 6627 (task 17238) | 20:30:15 | 20:37:27 | armed by the scheduled pass at 20:30:02, landed on Forgejo's auto-merge queue | | #2027 | run 6629 | ~20:30 | 20:37:38 | same | | #2028 | run 6631 | ~20:30 | 20:37:51 | same | | #2029 | run 6634 (task 17247, 57 s) | 20:36:57 | 20:38:13 | the same POST sent by hand, from outside the run | Eight statuses `success`, `mergeable: true`, and the in-job POST refused every time with `405` and an empty body. ## The cause The caller's own commit status. While the step runs, `CI / Arm auto-merge` is `pending` on the head commit, and Forgejo validates a merge against every status on that commit - so the one check that says "not green" is the caller's own. It cannot turn green until the job ends, which is why three POSTs 4 s apart all got the same answer: **a retry loop inside a check cannot outrun its own status.** Outside the run (my manual POST at 20:38:13, 8/8 green) the identical request merged immediately. ## The change Send the request that means what this step already means: `merge_when_checks_succeed: true`. Both scheduled passes (`auto-rebase.yml`, `pr-rebase.yml`) already send exactly this; a PR armed here is armed the same way it would have been minutes later, and stops waiting for someone else to ask. - one POST, no retries: 30-57 s of futile retrying becomes one request; - `200/201` = armed, `409` = already armed, anything else is a refusal; - on refusal the server's own words are posted as a PR comment (the job log needs a login, the job status is `success` by design, and a `::warning::` is an annotation nobody opens). ## Coverage / gate unchanged - the status-set reader is untouched: every status on the head must be `success`, and all three `CI / Test (Node *)` legs must be present; - `head_commit_id` still pins the commit whose checks were read; - no job, matrix leg, test or check is removed or skipped. After-run ids will be added as a comment.
ci(arm): arm the merge instead of retrying a POST its own pending check blocks
All checks were successful
CI / Classify the change (pull_request) Successful in 7s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 4s
CI / Test (Node 20) (pull_request) Successful in 51s
CI / Test (Node 18) (pull_request) Successful in 56s
CI / Test (Node 22) (pull_request) Successful in 53s
CI / Server smoke test (pull_request) Successful in 4s
CI / Docker build (pull_request) Successful in 16s
CI / Arm auto-merge (pull_request) Successful in 2s
adcdb58f95
The arm job never merged anything. #2026/#2027/#2028 (runs 6627/6629/6631)
each had eight successful statuses and mergeable=true and stayed open;
the same merge POST from outside the run merged #2029 at 20:38:13 against
8/8 green. The caller's own check is the difference: it is pending while
the step runs, and Forgejo validates the merge against every status on
the head, so the POST is answered 405 with an empty body - a retry four
seconds later cannot change that answer, which is why the job spent
30-57 s (tasks 17222/17238/17247) failing three times.

merge_when_checks_succeed is what this step has always meant, and what
both scheduled passes already send. The status-set verification, the
three-leg requirement and head_commit_id are unchanged; a refusal is
reported on the pull request because the job log needs a login.
forgejo-actions scheduled this pull request to auto merge when all checks succeed 2026-11-18 20:50:24 +00:00
Author
Owner

Baseline and after

Baseline - Arm auto-merge, branch #2026, run 6627, task 17222, 32 s, success, and the pull request was not merged (same for run 6629 task 17229, 30 s). Under the intermediate fix that #2029 landed, the same job took 57 s (task 17247, run 6634) and 61 s (task 17310, run 6654, #2020) - waiting 40 s for a mergeable field that was already true.

After - Arm auto-merge, branch #2031, run 6658, task 17317: 2 s, success, 200/201 on the arm call (no refusal comment).

Run wall clock, same shape of change (code PR, three test legs + smoke + docker):

run classify slowest test leg docker arm total
before 6627 5 s 62 s 25 s 32 s 106 s
after 6658 7 s 59 s 16 s 2 s 92 s

That is the 30 s the arm job spent retrying a POST its own pending check was blocking.

Coverage unchanged

No job, matrix leg, test, static check or timeout was removed. The status-set reader above the arm call is byte-identical: every status on the head must be success, all three CI / Test (Node *) legs must be present, and head_commit_id still pins the tested commit. Test (Node 18/20/22), Server smoke test and Docker build all ran in run 6658.

Still open (next increment)

Forgejo's own auto-merge queue is the remaining latency: this PR was armed at 20:45:36 and was still unmerged at 20:53:31 (8 min); the earlier batch (#2026-#2028, armed by the scheduled pass at 20:30:02) landed at 20:37:27-20:37:51, ~7.4 min later. So the in-workflow gate is now 2 s, but armed-to-merged is server-side. The scheduled pass (auto-rebase.yml) arms rather than merges, and it is the piece to look at next: a direct POST /merge from that queue-external context merged this PR in 51 ms (HTTP 200, 20:54:00), so the fast path exists. Merged by hand at 20:54:00 for that reason.

## Baseline and after **Baseline** - `Arm auto-merge`, branch `#2026`, run 6627, task 17222, 32 s, `success`, and the pull request was **not** merged (same for run 6629 task 17229, 30 s). Under the intermediate fix that #2029 landed, the same job took 57 s (task 17247, run 6634) and 61 s (task 17310, run 6654, #2020) - waiting 40 s for a `mergeable` field that was already `true`. **After** - `Arm auto-merge`, branch `#2031`, run 6658, task 17317: **2 s**, `success`, 200/201 on the arm call (no refusal comment). Run wall clock, same shape of change (code PR, three test legs + smoke + docker): | | run | classify | slowest test leg | docker | arm | total | |-|-----|----------|------------------|--------|-----|-------| | before | 6627 | 5 s | 62 s | 25 s | 32 s | 106 s | | after | 6658 | 7 s | 59 s | 16 s | 2 s | 92 s | That is the 30 s the arm job spent retrying a POST its own `pending` check was blocking. ## Coverage unchanged No job, matrix leg, test, static check or timeout was removed. The status-set reader above the arm call is byte-identical: every status on the head must be `success`, all three `CI / Test (Node *)` legs must be present, and `head_commit_id` still pins the tested commit. `Test (Node 18/20/22)`, `Server smoke test` and `Docker build` all ran in run 6658. ## Still open (next increment) Forgejo's own auto-merge queue is the remaining latency: this PR was armed at 20:45:36 and was still unmerged at 20:53:31 (8 min); the earlier batch (#2026-#2028, armed by the scheduled pass at 20:30:02) landed at 20:37:27-20:37:51, ~7.4 min later. So the in-workflow gate is now 2 s, but armed-to-merged is server-side. The scheduled pass (`auto-rebase.yml`) arms rather than merges, and it is the piece to look at next: a direct `POST /merge` from that queue-external context merged this PR in 51 ms (HTTP 200, 20:54:00), so the fast path exists. Merged by hand at 20:54:00 for that reason.
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!2031
No description provided.