You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the feature or problem you'd like to solve
There is currently no way to remove a single label from an issue without replacing the issue's entire label set. The only issue-label tool, update_issue_labels (pkg/github/issues_granular.go), states in its own description: "This replaces the current labels with the provided list."
To remove one label, a client must:
Read all current labels on the issue
Compute the full set minus the one to remove
Send the complete remaining set back
If step 1 or 2 is incomplete or stale, labels are silently dropped. This read-modify-write pattern is error-prone for agents and adds round-trips.
Proposed solution
Add discrete, non-destructive tools backed by the existing REST endpoints:
add_label_to_issue → POST /repos/{owner}/{repo}/issues/{issue_number}/labels
These operate on a single label without touching the rest of the issue's labels.
Precedent in the codebase
Sub-issues already follow exactly this granular pattern with add_sub_issue and remove_sub_issue, rather than forcing a full-set replacement. Labels-on-issues would benefit from the same treatment.
Additional context
Related to #2412 (bulk/batch label operations). This proposal is the single-issue, single-label complement: #2412 covers operating across many issues at once, while this covers safely adding/removing one label on one issue without clobbering the others.
I agree we need a non-destructive way to add/remove individual labels.
Where I'd diverge is on the shape. Rather than introduce two new tools (add_label_to_issue / remove_label_from_issue), I think we can fold this into the existing update_issue_labels tool via a method parameter, similar to label_write etc.
I will link a PR shortly.
A live repro of the "stale read silently drops labels" case described here. It also applies to the default-toolset issue_write, not only the feature-flagged update_issue_labels: issue_writemethod: update sends labels as a full replacement (pkg/github/issues.go:3423).
Tested on v2.1.0 (image sha256:f6056fc1…0f8a) and main nightly 99d6d65, same result on both:
Issue N has labels [c, d]. Agents A and B each read them (issue_readmethod: get_labels).
(123 stands for the issue/PR number.)
B, working from its own read, adds a different one: "labels":["b","c","d"].
Both calls return success. Final labels: [b, c, d]. A's label is lost.
Control: the same two adds through POST /repos/OWNER/REPO/issues/N/labels (append) leave [a, b, c, d].
This is read-then-replace, not a timing race: with sequential calls it loses the first add every time. In an earlier run (v2.1.0) with two sessions each reading then writing at the same moment, one label was lost in 9 of 17 pairs.
Same read-merge-replace shape for issue fields: #3751.
Both open PRs would remove the need for read-modify-write: #2742 (method: add|remove on update_issue_labels) and #3149 (batch_update_issue_labels with add/remove via AddLabelsToIssue / RemoveLabelForIssue). Either way, issue_write's description could say that labels replaces the set (item 4 in #3473).
Found during an independent audit of v2.1.0 on a throwaway org and private test repo. Prepared with AI assistance (Claude Code); reproduced by two independent test runs before filing.
Thanks @rafe-walker for the repro, that's exactly the case this targets.
I've rebased #2742 onto the current typed granular tools. update_issue_labels now takes method: replace | add | remove (default replace, so existing calls are unchanged). add/remove use POST/DELETE .../labels, so there's no read-modify-write.
I re-ran your scenario live with two separate adds of different labels: both labels survive. It also sets destructiveHint: true, in line with #3760.
On #3149: I see it as complementary rather than an alternative. It batches label changes across many issues (#2412), while this fixes add/remove on a single issue without adding a new tool.
issue_write still has the replace behaviour you described; happy to pick that up as a follow-up.
Activity
MayorFaj commentedon Jun 21, 2026
I agree we need a non-destructive way to add/remove individual labels.
Where I'd diverge is on the shape. Rather than introduce two new tools (add_label_to_issue / remove_label_from_issue), I think we can fold this into the existing update_issue_labels tool via a method parameter, similar to
label_writeetc.I will link a PR shortly.
rafe-walker commentedon Nov 9, 2026
A live repro of the "stale read silently drops labels" case described here. It also applies to the default-toolset
issue_write, not only the feature-flaggedupdate_issue_labels:issue_writemethod: updatesendslabelsas a full replacement (pkg/github/issues.go:3423).Tested on v2.1.0 (image
sha256:f6056fc1…0f8a) and main nightly 99d6d65, same result on both:[c, d]. Agents A and B each read them (issue_readmethod: get_labels).(123 stands for the issue/PR number.)
{"name":"issue_write","arguments":{"method":"update","owner":"OWNER","repo":"REPO","issue_number":123,"labels":["a","c","d"]}}"labels":["b","c","d"].[b, c, d]. A's label is lost.Control: the same two adds through
POST /repos/OWNER/REPO/issues/N/labels(append) leave[a, b, c, d].This is read-then-replace, not a timing race: with sequential calls it loses the first add every time. In an earlier run (v2.1.0) with two sessions each reading then writing at the same moment, one label was lost in 9 of 17 pairs.
Same read-merge-replace shape for issue fields: #3751.
Both open PRs would remove the need for read-modify-write: #2742 (
method: add|removeonupdate_issue_labels) and #3149 (batch_update_issue_labelswith add/remove viaAddLabelsToIssue/RemoveLabelForIssue). Either way,issue_write's description could say thatlabelsreplaces the set (item 4 in #3473).Found during an independent audit of v2.1.0 on a throwaway org and private test repo. Prepared with AI assistance (Claude Code); reproduced by two independent test runs before filing.
feat(issues): add method option to update_issue_labels
MayorFaj commentedon Nov 15, 2026
Thanks @rafe-walker for the repro, that's exactly the case this targets.
I've rebased #2742 onto the current typed granular tools.
update_issue_labelsnow takesmethod: replace | add | remove(defaultreplace, so existing calls are unchanged).add/removeusePOST/DELETE .../labels, so there's no read-modify-write.I re-ran your scenario live with two separate adds of different labels: both labels survive. It also sets
destructiveHint: true, in line with #3760.On #3149: I see it as complementary rather than an alternative. It batches label changes across many issues (#2412), while this fixes add/remove on a single issue without adding a new tool.
issue_writestill has the replace behaviour you described; happy to pick that up as a follow-up.