Skip to content

gh-prs-merge: merge stacked PRs through the asynchronous merge endpoint (0.45.2) - #87

Merged
ralyodio merged 1 commit into
masterfrom
merge-async
Sep 24, 2026
Merged

ralyodio merged 1 commit into
masterfrom
merge-async

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

gh-prs-merge: merge stacked PRs through the asynchronous merge endpoint (0.45.2)

gh pr merge calls the GraphQL mergePullRequest mutation, and GitHub refuses
that mutation outright for a pull request that belongs to a stack, naming the
asynchronous merge REST API instead. Nothing is wrong with such a PR: it reads
MERGEABLE and CLEAN with every check green, so no repair applies and the sweep
just reported FAILED and merged nothing.

Gh.squashMerge now falls back to PUT /repos/{owner}/{repo}/pulls/{n}/merge-async
and polls the uuid it returns until the merge settles. The fallback is narrow
on purpose: it fires only on that one refusal message, still pins the head
commit, still asks for a squash, and still passes no --admin, so a PR is held
to exactly the rules it was held to before. A PR the endpoint hands to a merge
queue reports enqueued, which counts as merged because nothing further is ours
to do.

The refusal is matched on the message rather than on the base branch: GitHub
still calls a PR stacked after it has retargeted it onto the default branch,
which is how profullstack/hqtui#96 behaved in practice.

The shell original in profullstack/scripts got the same fix (v0.3.2) and is
being retired in favour of this one.

Co-Authored-By: Claude Opus 5 (1M context) noreply@anthropic.com

…nt (0.45.2)

`gh pr merge` calls the GraphQL mergePullRequest mutation, and GitHub refuses
that mutation outright for a pull request that belongs to a stack, naming the
asynchronous merge REST API instead. Nothing is wrong with such a PR: it reads
MERGEABLE and CLEAN with every check green, so no repair applies and the sweep
just reported FAILED and merged nothing.

`Gh.squashMerge` now falls back to PUT /repos/{owner}/{repo}/pulls/{n}/merge-async
and polls the uuid it returns until the merge settles. The fallback is narrow
on purpose: it fires only on that one refusal message, still pins the head
commit, still asks for a squash, and still passes no --admin, so a PR is held
to exactly the rules it was held to before. A PR the endpoint hands to a merge
queue reports enqueued, which counts as merged because nothing further is ours
to do.

The refusal is matched on the message rather than on the base branch: GitHub
still calls a PR stacked after it has retargeted it onto the default branch,
which is how profullstack/hqtui#96 behaved in practice.

The shell original in profullstack/scripts got the same fix (v0.3.2) and is
being retired in favour of this one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

ThreatCrush Security Scan

23 finding(s)

HIGH/CRITICAL: 4 | MEDIUM: 10 | LOW: 9

Severity Rule Location
HIGH sh-remote-script-execution root-ubuntu.sh:3227
HIGH sh-remote-script-execution root-ubuntu.sh:3228
HIGH sh-remote-script-execution root-ubuntu.sh:4840
HIGH sh-remote-script-execution root-ubuntu.sh:4844
MEDIUM sh-remote-script-execution root-ubuntu.sh:4993
MEDIUM redos-nested-quantifier src/domain-free.ts:56
MEDIUM redos-nested-quantifier src/emoji.ts:167
MEDIUM redos-nested-quantifier src/icon.ts:133
MEDIUM redos-nested-quantifier src/mail.ts:1042
MEDIUM sql-template-interpolation src/users-dump.ts:487
MEDIUM sql-string-concatenation src/users-dump.ts:507
MEDIUM sql-template-interpolation src/users-dump.ts:540
MEDIUM sql-string-concatenation src/users-dump.ts:574
MEDIUM redos-nested-quantifier src/wcag.ts:556
LOW secret-generic-credential src/credentials.ts:36
LOW secret-generic-credential src/user-export.ts:632
LOW secret-generic-credential src/user-export.ts:638
LOW secret-generic-api-key test/credentials.test.ts:208
LOW secret-generic-credential test/mail.test.ts:140
LOW secret-generic-credential test/shorten.test.ts:36
LOW secret-database-url test/users-dump.test.ts:108
LOW secret-database-url test/users-dump.test.ts:119
LOW secret-database-url test/users-dump.test.ts:120

Snippets are redacted; ThreatCrush never prints matched credential material.

@ralyodio
ralyodio merged commit 9e57cd4 into master Sep 24, 2026
5 checks passed
ralyodio added a commit to profullstack/scripts that referenced this pull request Sep 24, 2026
profullstack/cli-tools#87 carries the same tool in TypeScript with the fix for
GitHub refusing to merge a stacked PR through the GraphQL mutation, plus tests
around the asynchronous merge endpoint. Two implementations of one name on PATH
is the drift `cli-tools list` marks with `!`, and this pair had already drifted:
the shell copy got the fix first, in v0.3.2, and only there.

Unlike the gh-pulse retirement, a release WAS cut between the two here, so a box
that upgrades past v0.3.2 loses this name until cli-tools installs it. Repoint
~/.local/bin/gh-prs-merge at cli-tools/bin/gh-prs-merge.ts.

One behaviour differs and the README says so: repairs were on here unless you
passed --no-fix, and are off there unless you pass --fix. The gh-prs-merge-all
alias passes neither, so it needs --fix added to keep repairing.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

1 participant