Skip to content

ci: merge a regen PR that fell behind its base during the merge wait - #164

Merged
mogita merged 2 commits into
mainfrom
fix/regen-catch-up-behind-base
Nov 27, 2026
Merged

mogita merged 2 commits into
mainfrom
fix/regen-catch-up-behind-base

Conversation

@mogita

@mogita mogita commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The default branch requires a PR to be up to date before it merges. When another PR merges while a regen PR waits for its checks, the regen PR falls behind, and every merge the bot tries is refused until the 45-minute wait runs out and a human is pinged, although every check is green. GetStream/stream-py#363 hit this on 2026-11-27.

Solution

  • While land() waits, it checks whether the PR fell behind its base. If so, it takes in the base with gh pr update-branch, as the start of a run already did for a PR labelled sdk-not-breaking, and exits. The checks start over on the new head, and the run that its Regen integration starts on completion merges it, with a full wait of its own.
  • That update moves into a catchup() function used by both places. A base that does not merge cleanly still goes to a human.

How to verify

  1. While a regen PR waits for its checks, merge another PR into the default branch.
  2. The Regenerate run merges the base into regen/auto and exits without a heads-up. The checks rerun on the new head, and the run started when its Regen integration completes merges the PR.

Note

Medium Risk
Changes auto-merge timing in production CI; behavior is scoped to the regen bot workflow but affects when PRs merge without human intervention.

Overview
When a regen PR sits in land()’s merge wait and another PR lands on the default branch, the workflow now detects that the branch is behind base (compare / behind_by), runs catchup() (gh pr update-branch plus waiting for the new head), and exits so checks rerun and a later Regen integration run can merge.

The same catchup path is factored into a shared catchup() function, replacing the duplicated inline logic that only ran for PRs labeled sdk-not-breaking. Merge conflicts on update still route to a human.

Reviewed by Cursor Bugbot for commit 7a1dc42. Bugbot is set up for automated code reviews on this repo. Configure here.

The default branch requires an up-to-date PR, so a PR merged during the 45-minute wait left the regen PR unmergeable until the wait ran out. The wait now takes in the base, as the start of a run already does for a labelled PR, and keeps waiting on the new head.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 209200e. Configure here.

Comment thread .github/workflows/regen.yml Resolved
… starts

Its checks start over on the new head, so waiting out the rest of this run's 45 minutes often ended in a human ping. The run that the new head's Regen integration starts on completion merges it, with a full wait of its own.
@mogita
mogita merged commit 6fd0b7c into main Nov 27, 2026
15 checks passed
@mogita
mogita deleted the fix/regen-catch-up-behind-base branch November 27, 2026 17:56
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.

1 participant