Skip to content

fix: Empty assignees array should clear assignees#2600

Open
RossTarrant wants to merge 1 commit into
mainfrom
rosstarrant/fix-issue-write-assignees-not-clearing
Open

fix: Empty assignees array should clear assignees#2600
RossTarrant wants to merge 1 commit into
mainfrom
rosstarrant/fix-issue-write-assignees-not-clearing

Conversation

@RossTarrant
Copy link
Copy Markdown
Contributor

Summary

Fixes issue_write updates so explicitly empty assignees or labels arrays clear existing values instead of being ignored.

Why

issue_write previously treated empty arrays the same as omitted parameters, making it impossible to unassign all users or remove all labels from an issue.

Fixes #2596

What changed

  • Track whether assignees and labels were explicitly provided in issue_write requests.
  • Pass presence information into UpdateIssue via UpdateIssueOptions.
  • Send empty assignees / labels arrays to the GitHub Issues API when explicitly provided.
  • Added regression tests for both feature-flagged and legacy issue_write update paths.

MCP impact

  • No tool or API changes
  • Tool schema or behavior changed
    • issue_write update behavior now honors explicitly empty assignees and labels arrays.
  • New tool added

Prompts tested (tool changes only)

Security / limits

  • No security or limits impact
  • Auth / permissions considered
    • Uses the existing issue update permissions; no new scopes are required.
  • Data exposure, filtering, or token/size limits considered

Tool renaming

  • I am renaming tools as part of this PR (e.g. a part of a consolidation effort)
    • I have added the new tool aliases in deprecated_tool_aliases.go
  • I am not renaming tools as part of this PR

Lint & tests

  • Linted locally with ./script/lint
  • Tested locally with ./script/test

Docs

  • Not needed
  • Updated (README / docs / examples)

Copilot AI review requested due to automatic review settings June 3, 2026 09:40
@RossTarrant RossTarrant requested a review from a team as a code owner June 3, 2026 09:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes issue_write update semantics so that explicitly-provided empty assignees and/or labels arrays are treated as intentional “clear” operations (instead of being ignored as if omitted). This aligns tool behavior with the GitHub Issues API and resolves the inability to unassign everyone or remove all labels.

Changes:

  • Track whether assignees / labels were explicitly present (and non-nil) in issue_write requests.
  • Extend UpdateIssue with an options mechanism to include empty assignees / labels in PATCH requests when explicitly provided.
  • Add regression coverage for both the feature-flagged (IssueWrite) and legacy (LegacyIssueWrite) issue_write update handlers.
Show a summary per file
File Description
pkg/github/issues.go Detects explicit presence of assignees/labels and propagates that into UpdateIssue so empty arrays can clear values.
pkg/github/issues_test.go Adds regression tests asserting PATCH request bodies include empty assignees/labels arrays for both flag-enabled and legacy paths.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

Comment thread pkg/github/issues.go
Comment on lines +1796 to +1799
func issueWriteHasNonNilParam(args map[string]any, key string) bool {
value, ok := args[key]
return ok && value != nil
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems a bit redundant to inline the helper.

It's both too specifically named for a generic operation and duplication to both the variants is also fine because in the end we will only be keeping one pathway.

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.

issue_write tool ignore parameters set to default values (e.g. empty array)

3 participants