Repository navigation
ci: auto-update queued PR branches when main advances - #1801
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 19 minutes Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Failed to generate code suggestions for PR |
There was a problem hiding this comment.
No issues found across 1 file
Auto-approved: Adds a CI workflow to auto-update branches of queued PRs when main advances. Low-risk configuration addition using existing PAT.
Re-trigger cubic
|
## Bug (observed live) After #1801 merged, its `auto-update-pr-branches` workflow ran green but updated **0** PRs — all 7 queued auto-merge PRs stayed BEHIND and the queue **deadlocked** (no further main-advance to re-fire the workflow; had to manually `update-branch` all 7). ## Root cause `on: push: [main]` fires the instant main advances, but GitHub hasn't recomputed the *other* PRs' `mergeStateStatus` to `BEHIND` yet — it reads `UNKNOWN` — so the `== "BEHIND"` filter matches none. ## Fix - **45s settle** on push events before listing (lets mergeStateStatus recompute). - **`*/15` cron backstop** — catches any stranded PR within ~15 min regardless of the race. Cheap (a `gh pr list` job, seconds). Makes the merge-train self-heal instead of stranding on the first-merge race — the automation `ship-all-prs` depends on. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes a race in the auto-update workflow after merges to main that sometimes updated zero PRs and stalled the queue. We now wait briefly on push runs and add a 15‑minute cron backstop to keep the merge train moving. - **Bug Fixes** - On push events, wait 45s before listing PRs so GitHub sets mergeStateStatus to BEHIND. - Add a */15 cron schedule to catch and update any stranded PRs within ~15 minutes. <sup>Written for commit 73e3ae6. Summary will update on new commits.</sup> <a href="https://cubic.dev/pr/LucasSantana-Dev/Lucky/pull/1811?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->



Problem
Branch protection requires branches be up to date, but GitHub auto-merge does not auto-update-branch. So every merge re-stales the sibling queued PRs, forcing a manual
gh pr update-branchon each — I ran it ~10× in one session working through the backlog (the merge-train thrash).Fix
A workflow on
push: mainthat update-branches every open PR which already has auto-merge enabled (the opt-in signal) and isBEHIND. As each queued PR lands, the rest are automatically re-based and re-run CI, so the train drains itself.Notes
RELEASE_PLEASE_TOKEN(PAT), notGITHUB_TOKEN: a branch update made withGITHUB_TOKENdoesn't re-trigger the PR's workflows, which would leave required checks pending forever and auto-merge never firing. The repo already uses this PAT for the same reason in release-please.workflow_dispatchincluded for manual runs.Alternative considered: the repo-level "Automatically update branches" setting does the same thing with zero YAML — flip that instead and this workflow is redundant. This PR is the in-repo, reviewable version.
Summary by cubic
Automatically updates queued PR branches when
mainadvances to keep auto-merge trains moving without manual updates. Only touches non-draft PRs with auto-merge enabled.mainwith auto-merge enabled.RELEASE_PLEASE_TOKENinstead ofGITHUB_TOKENso required checks re-run and auto-merge can finish.workflow_dispatch.Written for commit 010b3f0. Summary will update on new commits.