Near-simultaneous changes to labels rewrite the whole label set, overwriting previous changes #203549
Replies: 2 comments 1 reply
|
💬 Your Product Feedback Has Been Submitted 🎉 Thank you for taking the time to share your insights with us! Your feedback is invaluable as we build a better GitHub experience for all our users. Here's what you can expect moving forward ⏩
Where to look to see what's shipping 👀
What you can do in the meantime 💻
As a member of the GitHub community, your participation is essential. While we can't promise that every suggestion will be implemented, we want to emphasize that your feedback is instrumental in guiding our decisions and priorities. Thank you once again for your contribution to making GitHub even better! We're grateful for your ongoing support and collaboration in shaping the future of our platform. ⭐ |
|
The lost-update behavior is consistent with a stale read followed by a full-set write: whichever request arrives last replaces labels using an older snapshot and can discard a concurrent addition. The exact GitHub web implementation is not public, so that part is an inference from the result you observed. For bots and scripts, new endpoints are not required. GitHub already exposes delta-style operations for pull requests through the Issues labels API: # Add without replacing existing labels
gh api --method POST \
repos/OWNER/REPO/issues/PR_NUMBER/labels \
-f "labels[]=label1" \
-f "labels[]=label2"
# Remove only one label; URL-encode the label name when needed
gh api --method DELETE \
repos/OWNER/REPO/issues/PR_NUMBER/labels/labelAThe important distinction is:
So Bot A should use the additive endpoint, and any automation doing manual-style removals should use the single-label delete endpoint instead of read-modify-write. That prevents the common automation side of this race. For the web UI case, the user cannot choose which endpoint GitHub sends. If the UI really submitted a stale complete set, that remains a valid GitHub concurrency bug/product-feedback issue. Until GitHub changes it, refreshing immediately before manual maintenance reduces the window; using the CLI delta operations above avoids it entirely. Official reference: REST API endpoints for labels. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
🏷️ Discussion Type
Product Feedback
Body
If different users make near-simultaneous changes to labels assigned to a PR, the latest change overwrites the whole label set. Example:
labelAlabelBlabel1andlabel2labelAvery shortly after step 2Step 3 will remove
label1,label2andlabelA. The PR has onlylabelBremaining.The expectation would have been that the action in step 3 sends a "remove
labelAfrom PR" request, instead of "reset all PR labels to label set in step 1 minuslabelA. Wouldn't the intention of a user in the web UI be to either add/remove labels and not "reset all labels"? Maybe new APIs or syntax would be needed to add/remove labels instead of set labels?Sometimes assigned labels need manual maintenance even if they are mostly automated.
Edit: add keywords for aiding in searching: concurrent concurrency race
All reactions