Skip to content

Build PRs targeting main, recognized GitHub Stacks, or other tracked open PRs - #361

Merged
alexreinking merged 1 commit into
masterfrom
fix/stacked-pr-ci
Jul 29, 2026
Merged

Build PRs targeting main, recognized GitHub Stacks, or other tracked open PRs#361
alexreinking merged 1 commit into
masterfrom
fix/stacked-pr-ci

Conversation

@alexreinking

Copy link
Copy Markdown
Member

Summary

  • Previously, the scheduler only built PRs whose base branch was literally main, so a PR whose base is another PR's branch (a stacked PR, e.g. [Target] Keep all implied features in canonical representation Halide#9253 based on #9251) was silently never scheduled.
  • Gating moves into SafeGitHubEventHandler.handle_pull_request, where the full PR payload is available. A PR is now built if:
    • its base is main (unchanged), or
    • it's part of a recognized GitHub Stack (the stack payload field) — confirmed by inspecting the actual refs/pull/*/merge commit parents on [Target] Replace public fields with getters/setters Halide#9249-#9253 that this ref is chained through every lower PR's own merge ref, so building it already transitively tests against stack.base.ref (main), or
    • its base is otherwise the head of another open PR in the same repo (an informal/pre-Stacks-feature chain, e.g. a long-lived shared integration branch).
  • PRs against release/N.x branches are still skipped (unchanged), and anything else (an untracked, possibly short-lived branch) is now explicitly skipped to avoid wasting CI on builds that can be invalidated without warning.

Fixes #148

Test plan

🤖 Generated with Claude Code

…open PRs

Previously the scheduler only built PRs whose base branch was literally
"main", so a PR whose base is another PR's branch (a stacked PR, e.g.
halide/Halide#9253 based on #9251) was silently never scheduled.

Move the gating into SafeGitHubEventHandler.handle_pull_request, where the
full PR payload is available:
- base == "main": build, as before.
- base is a release/N.x branch: skip, as before.
- PR is part of a recognized GitHub Stack (the `stack` payload field): build.
  refs/pull/<N>/merge for a stacked PR is chained through every lower PR's
  own merge ref, so building it already transitively tests against
  stack.base.ref (main) -- confirmed by inspecting the actual merge commit
  parents on halide/Halide#9249-#9253.
- base is otherwise the head of another open PR in the same repo (an
  informal/pre-Stacks-feature chain): build.
- anything else (an untracked, possibly short-lived branch): skip, to avoid
  wasting CI on builds that can be invalidated without warning.

Fixes #148

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@alexreinking
alexreinking merged commit 96a9587 into master Jul 29, 2026
9 checks passed
@alexreinking
alexreinking deleted the fix/stacked-pr-ci branch July 29, 2026 13:42
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.

Fix PR-to-PR

1 participant