Skip to content

ci: debounce auto-rebase by 30 minutes#29

Merged
alandtse merged 2 commits into
devfrom
ci/rebase-debounce
May 21, 2026
Merged

ci: debounce auto-rebase by 30 minutes#29
alandtse merged 2 commits into
devfrom
ci/rebase-debounce

Conversation

@alandtse
Copy link
Copy Markdown
Owner

Summary

  • Add a 30-minute debounce to auto-rebase-prs.yaml so a burst of PR merges into dev coalesces into a single rebase pass instead of firing one rebase per merge.
  • Flip the concurrency policy from cancel-in-progress: false (queue) to cancel-in-progress: true (replace), so a new push during the sleep window kills the still-sleeping run and the fresh push gets its own timer.
  • Gate the sleep on github.event_name == 'push' so workflow_dispatch runs (urgent manual rebase) skip the wait entirely.

Why

Currently every push to dev triggers an immediate rebase across all open PRs. Each rebased head fires that PR's build pipeline. With 5 open PRs and 3 merges in a few minutes, that's 15 PR-build firings — the per-PR cancel-in-progress on pr-checks.yaml cancels back-to-back builds on the same PR head but can't help across PRs. CI ends up doing a lot of work that the next merge invalidates a minute later.

The 30-minute debounce makes CI load proportional to landings-per-half-hour rather than landings × open-PR-count.

Behavior matrix

Scenario Before After
Single merge, then quiet rebase fires immediately rebase fires after 30 min
3 merges in 10 min 3 rebase passes × N PRs each 1 rebase pass × N PRs (after the last merge + 30 min)
workflow_dispatch (manual urgent) immediate immediate (sleep skipped)
Push lands during prior sleep second run queued behind first first run cancelled; second run starts its own 30-min timer

Test plan

  • Merge a small PR into dev. Confirm the Auto-rebase open PRs workflow run enters the Debounce dev-push storms step and sits in sleep 1800 for the configured 30 min before proceeding to checkout.
  • During that sleep, push a noop commit to dev. Confirm the first run reports cancelled and a second run starts with a fresh debounce.
  • Trigger the workflow via gh workflow run "Auto-rebase open PRs" --ref dev and confirm the debounce step is skipped (manual dispatch).
  • After the debounce completes, confirm the rebase action still runs against all open non-draft PRs targeting dev (same coverage as today).

🤖 Generated with Claude Code

A push to dev currently fires the rebase loop immediately, and every
rebased PR head triggers that PR's build pipeline. When a few PRs
land in quick succession, the multiplier kicks in: 3 merges × 5 open
PRs = 15 PR-build firings inside a few minutes. The per-PR
`cancel-in-progress` on `pr-checks.yaml` cancels back-to-back builds
on the same PR head, but doesn't help across PRs.

Add a 30-minute debounce:

- Flip the concurrency policy to `cancel-in-progress: true` so a new
  push during the sleep kills the still-sleeping run.
- Add a leading `sleep 1800` step gated on `github.event_name == 'push'`.
  Manual `workflow_dispatch` invocations skip the sleep so a maintainer
  who needs an urgent rebase isn't blocked.

End state: one rebase pass per quiet 30-minute window regardless of
how many merges land in it. CI load becomes proportional to
landings/half-hour rather than landings × open-PR-count.
Copilot AI review requested due to automatic review settings May 21, 2026 05:33
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 21, 2026

Warning

Rate limit exceeded

@alandtse has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 59 minutes and 53 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 027ce5f5-b374-4c48-9359-207ac747495f

📥 Commits

Reviewing files that changed from the base of the PR and between 20a38a1 and 08364ab.

📒 Files selected for processing (1)
  • .github/workflows/auto-rebase-prs.yaml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/rebase-debounce

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Auto-rebase open PRs GitHub Actions workflow to reduce CI churn caused by bursts of merges into dev, by debouncing the auto-rebase pass and adjusting concurrency so only the latest push “wins” during the debounce window.

Changes:

  • Add a 30-minute debounce (sleep 1800) before rebasing when the workflow is triggered by a push to dev.
  • Change workflow concurrency to cancel-in-progress: true so newer pushes replace older in-flight runs.
  • Ensure workflow_dispatch runs skip the debounce to allow urgent/manual rebases immediately.
Comments suppressed due to low confidence (1)

.github/workflows/auto-rebase-prs.yaml:52

  • This sleep 1800 holds a GitHub-hosted runner for 30 minutes doing no work. If dev receives frequent pushes, that can consume a lot of runner-minutes and can also starve the rebase indefinitely (each new push cancels and restarts the timer). If runner utilization is a concern, consider an approach that doesn’t occupy a runner while waiting (e.g., a scheduled workflow that runs every 30 minutes and rebases only if dev advanced since the last run), or add a bounded max-wait/fallback so rebases still happen under sustained activity.
            - name: Debounce dev-push storms
              # Only debounce when fired by a push to dev. Manual dispatches run
              # immediately. If another push lands during this sleep, the
              # concurrency policy above cancels this run before it does any
              # work, and the new push gets its own debounce. Coalesces a
              # burst of PR merges into a single rebase pass per PR, keeping
              # the PR-build CI load proportional to landings/half-hour rather
              # than landings × open-PR-count.
              if: github.event_name == 'push'
              run: sleep 1800

Comment thread .github/workflows/auto-rebase-prs.yaml Outdated
Copilot finding on PR #29: `cancel-in-progress: true` on the
single-job workflow would cancel not just during the debounce
sleep but also during peter-evans/rebase's force-push phase.
That could leave PR heads half-rebased — some pushed, some not,
or worse, a push interrupted mid-operation.

Split the workflow into two jobs with distinct concurrency:

- `debounce`: sleeps 30 min on push events. Cancellable
  (`cancel-in-progress: true`) so a fresh push kills the
  still-sleeping run and starts a new timer.
- `rebase`: depends on `debounce`, runs peter-evans/rebase.
  NOT cancellable (`cancel-in-progress: false`) — once force-pushes
  begin, a subsequent dev push queues behind it rather than
  interrupting mid-flight.

End state: one rebase pass per quiet 30-min window, no half-done
rebases.
@alandtse alandtse merged commit 2ce7b61 into dev May 21, 2026
9 checks passed
@alandtse alandtse deleted the ci/rebase-debounce branch May 21, 2026 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants