ci(auto-rebase): no checkout for a pass that cannot push (32 s → 22 s per tick) #2152

Merged
jaylouisw merged 2 commits from ci/1119-1227 into main 2026-11-19 13:11:26 +00:00
Owner

Baseline

auto-rebase.yml — Rebase open PRs and arm auto-merge, run 7513 (main, 2026-11-19T12:30:02Z, task 19784): 32 s, green, 5 mergeable open PRs, batch=5 rebased=0 current=0 conflicts=0 duplicates=0 armed=0 rearmed=3 red=2 no_checks=0 uncheckable=3.

The tick spent 12:30:06.58 → 12:30:14.25 (7.7 s) fetching 792 refs into a working tree no line of the run read, plus the action clone and a Post Check out the queue step. Ten ticks sampled across today (runs 6833, 6901, 6985, 7065, 7140, 7209, 7289, 7356, 7421, 7487) all printed rebased=0; run 7506 printed uncheckable=2 with "this pass holds only the run token" — a push with the run token raises no pull_request event, so the head it mints has no checks and can never be armed. The loop refuses every candidate for that reason, but only after the tree has been paid for.

Median tick over 119 green ticks today: 29 s (p90 40 s) — ~59 min of runner slot per day.

After

Same file, run 7514 (branch ci/1119-1227, workflow_dispatch, 12:35:40Z, task 19785): 22 s, green, same 5 mergeable PRs and identical counters (rearmed=3 red=2 uncheckable=3), with checkout and git prologue skipped:

12:35:43.91 5 mergeable open pull request(s) - running the batch
12:35:43.91 this pass cannot push (run token only) - ...
12:35:44.06 no working tree: this pass cannot push, so there is no rebase to run - arming continues below
12:36:01.61 batch=5 ... rearmed=3 red=2 uncheckable=3

Re-measured after the guard-shape fix: run 7534 (12:43:44Z, task 19835) 17 s, same stand-down, arming still ran (red=2 uncheckable=2).

32 s → 22 s (-31%) on identical work; ~20 min/day of runner slot.

Change

  • The queue step answers a second question, push: false when TOKEN is unset or equals RUN_TOKEN — the loop's own predicate, asked before the tree. The step publishes both outputs and exits on that branch.
  • Check out the queue is gated on push; the git config / remote set-url / fetch main prologue is gated on the same predicate.
  • Arming — the only thing a run-token pass can do — is untouched; the per-candidate guard is unchanged.

Coverage unchanged

Nothing is skipped: same arming calls, same checks_green/checks_failed rules, same rebase path when FORGEJO_TOKEN is a user token (push=true, every command runs as before).

Notes

Run 7517 (first commit) went red on rebase-push-guard: scripts/check-rebase-push-guard.js requires the TOKEN/RUN_TOKEN comparison to be followed by a refusal, and the flag-only version was not. Fixed in 179d23f6 by exiting on that branch; that suite is green in the current run (7535/7536 legs).

## Baseline `auto-rebase.yml` — **Rebase open PRs and arm auto-merge**, run **7513** (main, 2026-11-19T12:30:02Z, task 19784): **32 s**, green, 5 mergeable open PRs, `batch=5 rebased=0 current=0 conflicts=0 duplicates=0 armed=0 rearmed=3 red=2 no_checks=0 uncheckable=3`. The tick spent 12:30:06.58 → 12:30:14.25 (7.7 s) fetching 792 refs into a working tree no line of the run read, plus the action clone and a `Post Check out the queue` step. Ten ticks sampled across today (runs 6833, 6901, 6985, 7065, 7140, 7209, 7289, 7356, 7421, 7487) all printed `rebased=0`; run 7506 printed `uncheckable=2` with *"this pass holds only the run token"* — a push with the run token raises no `pull_request` event, so the head it mints has no checks and can never be armed. The loop refuses every candidate for that reason, but only after the tree has been paid for. Median tick over 119 green ticks today: 29 s (p90 40 s) — ~59 min of runner slot per day. ## After Same file, run **7514** (branch `ci/1119-1227`, `workflow_dispatch`, 12:35:40Z, task 19785): **22 s**, green, **same 5 mergeable PRs** and **identical counters** (`rearmed=3 red=2 uncheckable=3`), with checkout and git prologue skipped: ``` 12:35:43.91 5 mergeable open pull request(s) - running the batch 12:35:43.91 this pass cannot push (run token only) - ... 12:35:44.06 no working tree: this pass cannot push, so there is no rebase to run - arming continues below 12:36:01.61 batch=5 ... rearmed=3 red=2 uncheckable=3 ``` Re-measured after the guard-shape fix: run **7534** (12:43:44Z, task 19835) **17 s**, same stand-down, arming still ran (`red=2 uncheckable=2`). 32 s → 22 s (-31%) on identical work; ~20 min/day of runner slot. ## Change - The queue step answers a second question, `push`: false when `TOKEN` is unset or equals `RUN_TOKEN` — the loop's own predicate, asked before the tree. The step publishes both outputs and exits on that branch. - `Check out the queue` is gated on `push`; the `git config` / `remote set-url` / `fetch main` prologue is gated on the same predicate. - Arming — the only thing a run-token pass can do — is untouched; the per-candidate guard is unchanged. ## Coverage unchanged Nothing is skipped: same arming calls, same `checks_green`/`checks_failed` rules, same rebase path when `FORGEJO_TOKEN` is a user token (`push=true`, every command runs as before). ## Notes Run 7517 (first commit) went red on `rebase-push-guard`: `scripts/check-rebase-push-guard.js` requires the TOKEN/RUN_TOKEN comparison to be followed by a refusal, and the flag-only version was not. Fixed in 179d23f6 by exiting on that branch; that suite is green in the current run (7535/7536 legs).
ci(auto-rebase): no checkout for a pass that cannot push
Some checks failed
CI / Classify the change (pull_request) Successful in 9s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 8s
CI / Server smoke test (pull_request) Successful in 9s
CI / Test (Node 20) (pull_request) Failing after 52s
CI / Test (Node 18) (pull_request) Failing after 55s
CI / Docker build (pull_request) Successful in 17s
CI / Test (Node 22) (pull_request) Failing after 50s
CI / Arm auto-merge (pull_request) Successful in 3s
368437eb94
The scheduled tick costs 14-64 s (median 29 s over 119 green ticks today) and
today it rebased nothing: the ten ticks sampled across 2026-11-19 (runs 6833,
6901, 6985, 7065, 7140, 7209, 7289, 7356, 7421, 7487) all printed rebased=0.

Run 7506 (12:20:03Z) printed batch=5 rebased=0 current=0 conflicts=0
duplicates=0 armed=0 rearmed=1 red=1 no_checks=0 uncheckable=2 with 'this pass
holds only the run token' - a push made with the run token raises no
pull_request event, so a head it mints has no checks and can never be armed.
The loop refuses every candidate for that reason, but only after the checkout
has been paid for: the full-depth fetch of 792 refs ran 12:20:06.83 ->
12:20:11.51 for a tree no line of the run read.

So the queue step now publishes push=false when TOKEN is unset or equal to
RUN_TOKEN - the loop's own predicate, asked before the tree - and the checkout
and the git prologue stand down on it. Arming needs neither, so it still runs
in every tick. With a user token the output is true and every step is
unchanged; the per-candidate guard is untouched.
ci(auto-rebase): make the push answer a refusal, as the guard expects
All checks were successful
CI / Classify the change (pull_request) Successful in 8s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 7s
CI / Test (Node 18) (pull_request) Successful in 58s
CI / Test (Node 20) (pull_request) Successful in 56s
CI / Test (Node 22) (pull_request) Successful in 57s
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 3s
179d23f62e
scripts/check-rebase-push-guard.js requires the TOKEN/RUN_TOKEN comparison to
be followed by a branch that stops the pass (exit 0 / continue); the first
version of this gate set a flag and carried on, and the rebase-push-guard suite
failed on it in run 7517 (PR #2152). The step now writes its two outputs and
exits on that branch, which is the shape the checker describes - the loop's own
per-candidate guard is untouched.
forgejo-actions scheduled this pull request to auto merge when all checks succeed 2026-11-19 12:45:16 +00:00
Sign in to join this conversation.
No description provided.