Repository navigation
pr-queue: never delete a merged branch with the token; stacked PRs stay open - #250
Conversation
…ay open When GitHub can merge a PR at once, `gh pr merge --auto --delete-branch` merges it directly and then deletes the head branch with the token. GitHub closes every open PR whose base was that branch. The repository's own "Automatically delete head branches" setting retargets those PRs to the merged PR's base first. The queue now never passes --delete-branch and leaves deletion to that setting. `delete_branch` in the config is optional and no longer used; old configs stay valid. Tests: a fake GitHub with stacked PRs (pair, chain of 3, armed-then-merged, setting off, armed again). Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
lens: tests-state · reviewer: opus high (lens1673state) · read at: e3f1cce |
|
lens: correctness · reviewer: opus high (lens1673corr) · read at: e3f1cce
|
…ay open (#250) When GitHub can merge a PR at once, `gh pr merge --auto --delete-branch` merges it directly and then deletes the head branch with the token. GitHub closes every open PR whose base was that branch. The repository's own "Automatically delete head branches" setting retargets those PRs to the merged PR's base first. The queue now never passes --delete-branch and leaves deletion to that setting. `delete_branch` in the config is optional and no longer used; old configs stay valid. Tests: a fake GitHub with stacked PRs (pair, chain of 3, armed-then-merged, setting off, armed again). Co-authored-by: Claude Opus 5.5 <[email protected]>
…ay open (#250) When GitHub can merge a PR at once, `gh pr merge --auto --delete-branch` merges it directly and then deletes the head branch with the token. GitHub closes every open PR whose base was that branch. The repository's own "Automatically delete head branches" setting retargets those PRs to the merged PR's base first. The queue now never passes --delete-branch and leaves deletion to that setting. `delete_branch` in the config is optional and no longer used; old configs stay valid. Tests: a fake GitHub with stacked PRs (pair, chain of 3, armed-then-merged, setting off, armed again). Co-authored-by: Claude Opus 5.5 <[email protected]>
…ay open (#250) When GitHub can merge a PR at once, `gh pr merge --auto --delete-branch` merges it directly and then deletes the head branch with the token. GitHub closes every open PR whose base was that branch. The repository's own "Automatically delete head branches" setting retargets those PRs to the merged PR's base first. The queue now never passes --delete-branch and leaves deletion to that setting. `delete_branch` in the config is optional and no longer used; old configs stay valid. Tests: a fake GitHub with stacked PRs (pair, chain of 3, armed-then-merged, setting off, armed again). Co-authored-by: Claude Opus 5.5 <[email protected]>
|
(Reposted 2026-11-22 with private details removed; original 2026-11-16.) Both lenses: safe (correctness, tests-state). Minors left: #253. The game-project side sets its config key to false now, so the old pinned queue no longer deletes branches either. |
…ay open (#250) When GitHub can merge a PR at once, `gh pr merge --auto --delete-branch` merges it directly and then deletes the head branch with the token. GitHub closes every open PR whose base was that branch. The repository's own "Automatically delete head branches" setting retargets those PRs to the merged PR's base first. The queue now never passes --delete-branch and leaves deletion to that setting. `delete_branch` in the config is optional and no longer used; old configs stay valid. Tests: a fake GitHub with stacked PRs (pair, chain of 3, armed-then-merged, setting off, armed again). Co-authored-by: Claude Opus 5.5 <[email protected]>
…ay open (#250) When GitHub can merge a PR at once, `gh pr merge --auto --delete-branch` merges it directly and then deletes the head branch with the token. GitHub closes every open PR whose base was that branch. The repository's own "Automatically delete head branches" setting retargets those PRs to the merged PR's base first. The queue now never passes --delete-branch and leaves deletion to that setting. `delete_branch` in the config is optional and no longer used; old configs stay valid. Tests: a fake GitHub with stacked PRs (pair, chain of 3, armed-then-merged, setting off, armed again). Co-authored-by: Claude Opus 5.5 <[email protected]>
What
The merge queue armed auto-merge with
--delete-branchwhen the config saiddelete_branch: true. When GitHub can merge a PR at once (up to date, checks green),gh pr merge --autodoes not arm: it merges directly and then deletes the head branch with the token. GitHub closes every open PR whose base was that branch (eventsbase_ref_deleted, thenclosed). Only GitHub's own "Automatically delete head branches" setting retargets those PRs to the merged PR's base before it deletes.Option chosen: leave deletion to GitHub's setting (not "retarget, then delete"). The queue never deletes a branch now. This is the smallest change: no new write, no new API call, no race between a retarget and a delete, and GitHub's setting already does the right thing.
pr_queue.py:arm()never passes--delete-branch.config.py/README.md:delete_branchis optional and no longer used (still accepted so old configs stay valid; the README says to turn on the repository setting instead).Tests
StackedGitHubinpr_queue.test.pyis a fake GitHub + gh that treats a branch delete the way GitHub does (token delete closes stacked PRs; the setting retargets them first), and merges at once a PR that is mergeable, as gh does.main;Without the change (putting
--delete-branchback), 4 of these fail (the pair, the chain, setting off, and the arm-arguments test).pr_queue.test.py242 OK,lens.test.py59 OK,fork-contracts.test.pyandfork-pr-queue-workflow.test.pypass.The state question
delete_branch: trueorfalsestill parses; a config without it parses too.General vs project
General (this PR): the queue in
fork-ci/actions/pr-queue, for every project that uses it. Project part: nothing needed now. A project keeps itsdelete_branchkey until its pin moves past this commit and can drop it then. The project's own tools that delete branches (its arm step, its branch gardener) get the same fix in that project's repository.🤖 Generated with Claude Code