gh stack submit fails trying to unstack an unrelated, permanently-closed stack #494
Replies: 1 comment
|
I hit the same While trying to rename a branch in this fresh stack, even though no rename had happened yet. I manually deleted I then tried For me, I can't be certain the two are connected, but still seems worth flagging: is it possible |
Uh oh!
There was an error while loading. Please reload this page.
Summary
gh stack submitfails trying to delete/unstack a completely unrelated, already-closed stack that contains a merged PR -- even when that stack has zero overlap with the branches/PRs actually being submitted.Environment
gh stackv0.1.1 (latest pergh extension list/gh extension upgrade)ghCLI authenticated as repo collaboratorError
Repro
gh stack link branch1 branch2 --open, then attach local tracking withgh stack checkout <stack B number>.gh stack submit --auto --openagainst stack B -- no code changes, just re-submitting branches that already have open PRs and correct local tracking.submitimmediately fails trying to delete stack A, which shares no PRs or branches with stack B at all.What we ruled out
.git/gh-stackis deleted, hand-edited, or freshly (re)imported viagh stack checkout.POST /repos/OWNER/REPO/stacks/{number}/unstack) and got the same 422 -- this is GitHub's documented, correct behavior for a stack containing a merged PR. The bug is thatgh stack submitis calling unstack on the wrong (unrelated) stack at all.Impact
Once any stack in a repo becomes permanently closed with an unremovable merged PR -- which happens naturally the first time a single-PR stack's PR merges and nothing more is added to it --
gh stack submitappears to become unusable repo-wide, for any stack, from then on.We also found this failure mode is easy to accidentally create: closing (not merging) the remaining open PRs in an otherwise-healthy stack has the same effect.
POST stacks/{number}/unstackstrips out the closed-but-unmerged PRs and leaves the already-merged one behind permanently stuck -- silently turning a normal stack into another landmine.Workaround
gh stack link <branch/PR bottom-to-top>+gh stack checkout <number>works fine for creating/growing a stack, and plaingit pushworks for pushing new commits to branches with existing open PRs.gh stack submitis the only command we've found that reliably fails once a repo has one of these permanently-closed stacks.All reactions