Fix set_issue_fields mutation: use correct inline fragments for IssueFieldValue union#2366
Merged
mattdholloway merged 3 commits intogithub:mainfrom Apr 22, 2026
Merged
Conversation
…FieldValue union The mutation response struct used a single inline fragment '... on IssueFieldDateValue' with a 'Name' field that doesn't exist on that type (only IssueFieldSingleSelectValue has 'name'). This caused GraphQL validation to fail with: Field 'name' doesn't exist on type 'IssueFieldDateValue' Since GraphQL validates the entire document (including response selection sets) before executing any operation, the mutation never fired at all — no fields were ever set regardless of input. Fix by adding correct inline fragments for all four union types: - IssueFieldTextValue (value) - IssueFieldSingleSelectValue (name) - IssueFieldDateValue (value) - IssueFieldNumberValue (value)
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes the set_issue_fields granular MCP tool’s GraphQL mutation selection set so it uses valid inline fragments for the IssueFieldValue union, preventing GraphQL from rejecting the request at validation time.
Changes:
- Updated the
setIssueFieldValuemutation response struct to use correct inline fragments for all supportedIssueFieldValueunion members. - Updated the corresponding GraphQL mock matcher in unit tests to reflect the corrected selection set.
- Minor formatting alignment in an HTTP handler test table.
Show a summary per file
| File | Description |
|---|---|
| pkg/github/issues_granular.go | Fixes mutation response selection set by adding correct union inline fragments for issue field values. |
| pkg/github/granular_tools_test.go | Updates mocked mutation matcher struct to match the new inline fragments. |
| pkg/http/handler_test.go | Formatting-only alignment in the Content-Type handling test. |
Copilot's findings
- Files reviewed: 2/3 changed files
- Comments generated: 1
Comment on lines
795
to
808
| IssueFieldValues []struct { | ||
| Field struct { | ||
| TextValue struct { | ||
| Value string | ||
| } `graphql:"... on IssueFieldTextValue"` | ||
| SingleSelectValue struct { | ||
| Name string | ||
| } `graphql:"... on IssueFieldSingleSelectValue"` | ||
| DateValue struct { | ||
| Value string | ||
| } `graphql:"... on IssueFieldDateValue"` | ||
| NumberValue struct { | ||
| Value float64 | ||
| } `graphql:"... on IssueFieldNumberValue"` | ||
| } |
There was a problem hiding this comment.
IssueFieldValues is requested in the mutation response but never read (the tool only marshals MinimalResponse from Issue). Consider removing IssueFieldValues from the selection set to reduce response payload and avoid having to maintain inline fragments for union validation; if you want to keep it, add a short comment explaining why it's intentionally unused.
mattdholloway
approved these changes
Apr 22, 2026
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
Fix the
set_issue_fieldsMCP tool's GraphQL mutation: calls failed with:Root Cause
The mutation response struct used a single inline fragment
... on IssueFieldDateValuewith aNamefield, butIssueFieldDateValuedoesn't have anamefield — onlyIssueFieldSingleSelectValuedoes.Since GraphQL validates the entire document (including response selection sets) before executing any operation, the invalid fragment caused GraphQL to reject the entire request. The mutation never fired at all — no fields were ever set, regardless of input.
Fix
Replace the single broken inline fragment with correct fragments for all four
IssueFieldValueunion types:IssueFieldTextValue→valueIssueFieldSingleSelectValue→nameIssueFieldDateValue→valueIssueFieldNumberValue→valueThe response still uses
MinimalResponse(issue ID + URL), so the additional fragments are purely for GraphQL validation correctness and future-proofing.Testing