Repository navigation
fix: retarget stack children before branch cleanup - #672
Merged
krasnoperov-coding-agent[bot] merged 2 commits intoSep 14, 2026
Merged
Conversation
| if (merged) { | ||
| let children: Array<{ number: number; branch: string; headSha: string; baseBranch: string }>; | ||
| try { | ||
| children = (await ctx.github.listOpenPRs()).filter((pr) => pr.baseBranch === entry.branch); |
There was a problem hiding this comment.
🚨 listOpenPRs() is capped at 1,000 results, so this treats an incomplete list as exhaustive. In repositories above that limit, an omitted child is not retargeted and is closed when its base branch is deleted; query children by base with complete pagination.
| if (merged) { | ||
| let children: Array<{ number: number; branch: string; headSha: string; baseBranch: string }>; | ||
| try { | ||
| children = (await ctx.github.listOpenPRs()).filter((pr) => pr.baseBranch === entry.branch); |
There was a problem hiding this comment.
🚨 Use the live branch returned by getStatus, not the queued entry.branch. If the parent branch was renamed after enqueue, children target the new name; this filter misses them and deletion closes those PRs.
review-quill
Bot
dismissed
their stale review
September 14, 2026 19:30
Superseded by newer head db8923b; review-quill will re-review the latest commit separately.
krasnoperov-coding-agent
Bot
deleted the
feature/retarget-stack-children
branch
September 14, 2026 19:36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Deleting a merged parent branch closes open stacked child PRs that still use that branch as their base.
Fix
Discover direct open children and retarget them to the merged parent's base before deleting the parent branch. If child discovery or retargeting fails, preserve the parent branch and defer cleanup.
Outcome
Declared PR stacks can land parent to child without losing the child PR, while unrelated PRs remain untouched.