fix(release): retry gh pr merge to cover GraphQL propagation lag#54
Merged
JohnnyVicious merged 1 commit intomainfrom Apr 12, 2026
Merged
fix(release): retry gh pr merge to cover GraphQL propagation lag#54JohnnyVicious merged 1 commit intomainfrom
JohnnyVicious merged 1 commit intomainfrom
Conversation
The v1.0.4 release (run 24312750234) failed at step 11 with:
Created release PR: https://github.com/.../pull/53
GraphQL: Could not resolve to a PullRequest with the number of 53.
##[error]Process completed with exit code 1.
`gh pr create` had returned the PR URL synchronously, but
`gh pr merge` fired ~500ms later and hit GraphQL's eventual-
consistency lag — the PR node wasn't yet resolvable from the merge
endpoint even though it had just been created. By the time I
checked manually the PR was fully mergeable, confirming it was a
pure propagation race and not a real auth/permission failure.
Wrap `gh pr merge` in a 5-attempt retry loop with a 2s backoff.
Worst case the workflow spends an extra 8s; best case the first
attempt still wins. The v1.0.2 and v1.0.3 releases didn't hit this
because they happened to land on the fast side of the race, so the
fix is hardening against a flaky GitHub API, not a new failure
mode.
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.
Summary
Wraps
gh pr mergein the release workflow with a 5-attempt retry loop (2s backoff) to ride out GitHub's GraphQL propagation lag betweengh pr createand the subsequent merge.Why
The v1.0.4 release hit this in anger. Workflow run 24312750234 failed at step 11 with:
gh pr createreturned synchronously with the new PR URL, butgh pr mergefired ~500ms later and the PR node wasn't yet resolvable from the merge endpoint — classic eventual consistency. I confirmed it was a pure race by checking PR #53 manually a few seconds later: it was alreadyMERGEABLE, andgh pr merge 53 --squash --delete-branchworked first-try.v1.0.2 and v1.0.3 releases happened to land on the fast side of the race; this fix is about hardening the automation, not reacting to a new failure mode.
Test plan
.github/workflows/release.ymlis a single step edit)sleep 2between, exits non-zero with a::error::annotation on final failure