Repository navigation
github: Look up whether a comment landed before resending a mutation - #302
Merged
Merged
Conversation
Collaborator
Author
|
Reviews in this chain: |
Collaborator
Author
aaron-skydio
approved these changes
Sep 24, 2026
jerry-skydio
force-pushed
the
jerry/revup/main/comments
branch
from
September 25, 2026 23:55
4cbf01c to
ff727d7
Compare
Github applies mutation fields in order and their effects survive its gateway giving up, and a transient http failure carries no field results, so replaying the request posts the comment a second time. A real 502 while uploading a 60 pr stack duplicated the review graph and patchsets comments on 13 prs, and three attempts left some prs with three copies each. Fields now carry a replay_safe flag, and addComment is the only unsafe one: github allows unlimited identical comments, and echoes clientMutationId rather than treating it as an idempotency key. Every other mutation is addressed by an id or is a create that github rejects as UNPROCESSABLE the second time, which already reads as done. A request holding an unsafe field is sent once. If that fails transiently, read back the newest comments of each subject pr and resend only the fields whose body isn't there yet, within the usual retry budget. Limitations: - The check is a read, so a comment that did land can still be duplicated if github serves a stale replica, or if 20 newer comments push it out of the window being read. - A comment the check can't prove missing (the pr node came back null, or the lookup itself failed) counts as added, leaving it for the next upload to add. - Exhausting the retry budget raises, so the rest of that mutation and the rest of the upload don't run.
jerry-skydio
force-pushed
the
jerry/revup/main/comments
branch
from
September 25, 2026 23:58
ff727d7 to
4ba0266
Compare
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.
Github applies mutation fields in order and their effects survive its gateway
giving up, and a transient http failure carries no field results, so replaying
the request posts the comment a second time. A real 502 while uploading a 60 pr
stack duplicated the review graph and patchsets comments on 13 prs, and three
attempts left some prs with three copies each.
Fields now carry a replay_safe flag, and addComment is the only unsafe one:
github allows unlimited identical comments, and echoes clientMutationId rather
than treating it as an idempotency key. Every other mutation is addressed by an
id or is a create that github rejects as UNPROCESSABLE the second time, which
already reads as done.
A request holding an unsafe field is sent once. If that fails transiently, read
back the newest comments of each subject pr and resend only the fields whose
body isn't there yet, within the usual retry budget.
Limitations:
github serves a stale replica, or if 20 newer comments push it out of the
window being read.
lookup itself failed) counts as added, leaving it for the next upload to add.
of the upload don't run.