link doesn't recognize a branch's existing merged/closed PR, tries to create a duplicate
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 66/100
Rechercherichtung
Beginne beim Einstiegspunkt gh stack link und verfolge die bestehende PR-Suche, bevor createPullRequest aufgerufen wird. Stelle das Verhalten mit gemergten und geschlossenen Branches nach und vergleiche es anschließend mit gh pr list --head <branch> --state all. Als erledigt gilt die Aufgabe, wenn bestehende PRs in jedem Status erkannt werden und keine doppelte Erstellung versucht wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Summary
gh stack link looks up an existing PR for each branch argument, but the lookup appears scoped to open PRs only. For a branch whose PR already merged or was closed (unmerged), link reports no PR found and attempts to create a new one — contradicting the documented additive-only design ("existing PRs are never removed").
Repro
- Build a stack
main <- a <- b <- c <- d <- eviagh stack link. - Merge
aandb. Closecwithout merging (its content landed elsewhere, or it was abandoned). - Later, run
gh stack linkagain with the full historical branch list (e.g. to fixd's base aftercclosed):
gh stack link a b c d e --base main
Actual
Checking existing stacks...
Pushing N branches to origin...
Looking up PRs for 5 branches...
Found PR #.. for branch d
Found PR #.. for branch e
Creating 3 PRs...
✗ failed to create PR for branch a: creating PR: GraphQL: was submitted too quickly, Head sha can't be blank, Base sha can't be blank, No commits between main and a, Head ref must be a branch (createPullRequest)
Only the still-open branches (d, e) were recognized as "Found PR". The merged branch a (whose content is already in main, hence "No commits between main and a") and the closed branch c were both treated as PR-less and queued for creation.
In my case the create call failed immediately on the first attempt (an already-merged branch has no diff vs. its base, so createPullRequest rejects it), so no duplicate PR was actually created — I confirmed this via gh pr list --head <branch> --state all for each affected branch afterward. But this looks like it depends on the specific branch/repo state; a branch that still has some diff against the base (e.g. a closed-but-unmerged PR whose branch wasn't cleaned up) would likely succeed in creating a genuine duplicate PR.
Expected
link's PR lookup should match a branch's PR regardless of state (open, closed, or merged) before deciding whether to create a new one, consistent with the "existing PRs are never removed" behavior documented for this command.
Environment
gh-stack version 0.0.8, installed via gh extension install github/gh-stack.
Related: #372 (same investigation session, different symptom of the same overall stack-mutation scenario — see also the atomicity issue I'm filing separately).
- Vorherrschende Sprache
- Go
- Sterne
- 1.5k
- Forks
- 73
- Ø Merge
- 1 T. 8 Std.
- Gemergte PRs (30 T.)
- 7
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus github/gh-stack
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 92/100
-
feature request topic: cli - general
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
-
feature request topic: auto-merge
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
-
bug topic: docs
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 68/100
Alle Issues in github/gh-stack
Ähnliche Issues
-
textual definition
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
geneontology/go-ontology#32653 ·
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 75/100
-
needs design
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
-
Priority/High ready-for-agent Severity/Major Type/Bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100