Rebase the queue with real git, and wait for mergeable before arming #1064

Merged
jaylouisw merged 1 commit from ci/auto-rebase-v2 into main 2026-11-08 15:26:19 +00:00
Owner

The first version of the auto-rebase job could not have worked. All three faults only show up when you execute it — which is what happened last iteration.

1. The API's "rebase" is not a rebase. POST /pulls/{n}/update with {"style":"rebase"} records a Merge branch 'main' into <branch> commit in this Forgejo version. Repeating it every ten minutes leaves branches that can no longer be updated: #65 answered HTTP 500 on every attempt, and #110, #152, #198 all ended up with merge commits instead of rebased histories. This job now fetches the branch, rebases locally and force-pushes --force-with-lease.

2. Arming immediately after the rebase always fails. mergeable is computed asynchronously; arming in the same breath returns 405 "Please try again later", which reads as a refusal but only means "not computed". Measured settling time on this host: 5 s to >140 s. The job now polls (settle_seconds, default 120) before arming.

3. Empty diffs. #152 and #198 are duplicates — their device file is already on main, so after rebasing they have no diff. Pushing them produces a blocked merge forever. They are now detected (git diff --quiet origin/main HEAD) and reported instead.

Also fixes the loop counters: echo "$pulls" | while ran the loop in a subshell, so the summary line always printed zeros.

Verified locally

  • YAML parses; job/step structure intact.
  • The extracted run: block passes bash -n.
  • The rebase strategy was exercised by hand on six PRs (#175, #198, #764, #776, #788, #798): all six rebased cleanly with real git, zero conflicts; #788 went green and armed, #198 turned out to be an empty diff.

Still open (needs a human, not code)

The schedule: trigger has never fired on this instance, and POST /actions/workflows/<file>/dispatches returns 204 while producing no run — for ci.yml too. So this workflow is correct but currently only runs when driven by hand. That is a Forgejo scheduler issue, not a workflow issue.

The first version of the auto-rebase job could not have worked. All three faults only show up when you execute it — which is what happened last iteration. **1. The API's "rebase" is not a rebase.** `POST /pulls/{n}/update` with `{"style":"rebase"}` records a `Merge branch 'main' into <branch>` commit in this Forgejo version. Repeating it every ten minutes leaves branches that can no longer be updated: **#65** answered HTTP 500 on every attempt, and #110, #152, #198 all ended up with merge commits instead of rebased histories. This job now fetches the branch, rebases locally and force-pushes `--force-with-lease`. **2. Arming immediately after the rebase always fails.** `mergeable` is computed asynchronously; arming in the same breath returns **405 "Please try again later"**, which reads as a refusal but only means "not computed". Measured settling time on this host: 5 s to >140 s. The job now polls (`settle_seconds`, default 120) before arming. **3. Empty diffs.** #152 and #198 are duplicates — their device file is already on `main`, so after rebasing they have no diff. Pushing them produces a blocked merge forever. They are now detected (`git diff --quiet origin/main HEAD`) and reported instead. Also fixes the loop counters: `echo "$pulls" | while` ran the loop in a subshell, so the summary line always printed zeros. ### Verified locally - YAML parses; job/step structure intact. - The extracted `run:` block passes `bash -n`. - The rebase strategy was exercised by hand on six PRs (#175, #198, #764, #776, #788, #798): all six rebased cleanly with real git, zero conflicts; #788 went green and armed, #198 turned out to be an empty diff. ### Still open (needs a human, not code) The `schedule:` trigger has never fired on this instance, and `POST /actions/workflows/<file>/dispatches` returns 204 while producing no run — for `ci.yml` too. So this workflow is correct but currently only runs when driven by hand. That is a Forgejo scheduler issue, not a workflow issue.
Rebase the queue with real git, and wait for mergeable before arming
All checks were successful
CI / Test (Node 18) (pull_request) Successful in 1m27s
CI / Test (Node 20) (pull_request) Successful in 1m22s
CI / Server smoke test (pull_request) Successful in 23s
CI / Docker build (pull_request) Successful in 10s
CI / Test (Node 22) (pull_request) Successful in 1m25s
2b19c85e04
The first version of this job could not have worked, for three reasons that only
show up once you run it.

1. It called POST /pulls/{n}/update with {"style":"rebase"}. In this Forgejo
   version that does not rebase: it records a 'Merge branch main into <branch>'
   commit instead. Repeated every ten minutes it leaves branches that can no
   longer be updated at all - #65 answered HTTP 500 on every attempt. The job now
   fetches the branch, rebases it locally, and force-pushes with a lease, which
   leaves the branch exactly as the author wrote it.

2. It armed the merge in the same breath as the rebase. Forgejo computes
   'mergeable' asynchronously, so that call returns 405 'Please try again later'
   on essentially every PR - a refusal that means 'not computed yet'. The job now
   polls until it settles, then arms.

3. It had no idea what to do with a PR whose change is already on main. #152 and
   #198 are both empty diffs after rebasing; pushing them produces a blocked
   merge and a permanently red row. They are now detected and reported instead.

Also fixes the loop counters: 'echo | while' ran the loop in a subshell, so the
summary line always said zero regardless of what happened.
jaylouisw scheduled this pull request to auto merge when all checks succeed 2026-11-08 14:37:30 +00:00
jaylouisw scheduled this pull request to auto merge when all checks succeed 2026-11-08 15:19:41 +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!1064
No description provided.