Skip to content

Add a script to cascade a fix through a stacked PR chain - #35

Open
Mearman wants to merge 1 commit into
mainfrom
tooling/restack-stacked-prs
Open

Mearman wants to merge 1 commit into
mainfrom
tooling/restack-stacked-prs

Conversation

@Mearman

@Mearman Mearman commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

GitHub's pull_request synchronize event only fires when a PR's own head ref changes, so pushing a fix to the bottom of a stacked PR chain never retriggers CI for anything built on top of it. This repo currently has a real, open stacked chain sitting on stale CI for exactly this reason.

This script cascades a fix through the chain automatically: give it the bottom branch, it walks the chain via gh pr list --base (so it stays correct as PRs are added or merged out, not a hardcoded list), merges each branch into the next, and pushes. It stops at the first real conflict rather than cascading past it, since everything above a broken link depends on content that link never actually delivered.

Went with a plain script over the gh stack extension deliberately: this repo isn't ExaDev-only, and a third-party CLI extension only some contributors have installed isn't a good default for a shared workflow. This uses only git/gh, matching the plain gh pr create --base stacking convention already in use here. Same script as cluster-api-v2#251, which hit the identical problem.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-09-18T11:20:52.505762Z 1cdee58 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

GitHub's pull_request synchronize event only fires when a PR's own head ref changes, so pushing a fix to the bottom of a stacked PR chain never retriggers CI for anything built on top of it. This repo currently has a real, live stacked chain sitting on stale CI for exactly this reason.

This script cascades a fix through the chain automatically: give it the bottom branch, it walks the chain via gh pr list --base (so it stays correct as PRs are added or merged out, not a hardcoded list), merges each branch into the next, and pushes. It stops at the first real conflict rather than cascading past it, since everything above a broken link depends on content that link never actually delivered.

Went with a plain script over the gh stack extension deliberately: this repo isn't ExaDev-only, and a third-party CLI extension only some contributors have installed isn't a good default for a shared workflow. This uses only git/gh, matching the plain gh pr create --base stacking convention already in use here.
@Mearman
Mearman force-pushed the tooling/restack-stacked-prs branch from 1cdee58 to 21c4b70 Compare October 25, 2026 09:23
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