Skip to content

fix(rebase-stack): only delete merged branch after full stack success#139

Merged
behinddwalls merged 1 commit into
mainfrom
preetam/rebase
Mar 11, 2026
Merged

fix(rebase-stack): only delete merged branch after full stack success#139
behinddwalls merged 1 commit into
mainfrom
preetam/rebase

Conversation

@behinddwalls
Copy link
Copy Markdown
Collaborator

Summary

  • On rebase failure (conflict, diff mismatch, or force-push failure), stop immediately: comment on the PR and leave everything untouched (no base update, no branch deletion)
  • Only delete the merged branch after all child PRs have been successfully rebased and retargeted
  • Previously, the branch was deleted unconditionally and base was updated even on failure, which could close child PRs or leave them with broken diffs (inheriting parent commits without rebase)

Test plan

  • Merge a stacked PR where the child has no conflicts — verify rebase + retarget + delete all succeed
  • Merge a stacked PR where the child has conflicts — verify branch is kept, base is not updated, and a comment is left with manual fix instructions

🤖 Generated with Claude Code

@behinddwalls behinddwalls requested review from a team and sbalabanov as code owners March 11, 2026 03:27
Prevent closing child PRs by ensuring the merged branch is only deleted
after all rebases, force-pushes, and base updates succeed. On failure,
leave everything untouched and comment with manual fix instructions.

Remove PAT (STACK_REBASE_TOKEN) in favor of GITHUB_TOKEN. Since
GITHUB_TOKEN pushes don't trigger CI (GitHub's anti-recursion), explicitly
request a check suite via the API after each push instead.
@sbalabanov
Copy link
Copy Markdown
Contributor

😄

@behinddwalls behinddwalls added this pull request to the merge queue Mar 11, 2026
Merged via the queue into main with commit 2f6904d Mar 11, 2026
11 checks passed
@github-actions github-actions Bot deleted the preetam/rebase branch March 11, 2026 05:12
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