Uh oh!
There was an error while loading. Please reload this page.
use the REST PATCH endpoint if updating rationale or suggestion - #2592
use the REST PATCH endpoint if updating rationale or suggestion#2592boazreicher wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the granular set_issue_fields tool to route requests through the REST Issues PATCH endpoint when rationale and/or is_suggestion are provided, since those attributes aren’t supported by the GraphQL setIssueFieldValue mutation.
Changes:
- Detects when a request includes
rationale/is_suggestionand switches execution from GraphQL to REST. - Adds a REST fallback implementation that resolves field database IDs (and single-select option names) via GraphQL before PATCHing the issue.
- Updates granular tool tests to validate the REST wire format for rationale/suggestion.
Show a summary per file
| File | Description |
|---|---|
| pkg/github/issues_granular.go | Adds needsREST routing plus a REST PATCH implementation for issue field updates with rationale/suggestion. |
| pkg/github/granular_tools_test.go | Updates tests to mock GraphQL field-definition lookup and assert REST PATCH payloads for rationale/suggestion cases. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 7
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Follow-up to #2557.
Summary
When
set_issue_fieldsis called with arationaleoris_suggestion, route the request through the RESTPATCH /repos/{owner}/{repo}/issues/{issue_number}endpoint instead of the GraphQLsetIssueFieldValuemutation, since GraphQL does not currently support those parameters.Why
#2557 added
rationaleandis_suggestionto theset_issue_fieldstool, but the GraphQL mutation does not accept those inputs. The REST update-issue endpoint does (the same wayupdate_issue_labelsalready uses it for labels with rationale).What changed
pkg/github/issues_granular.go:GranularSetIssueFields, set aneedsRESTflag when any field has a non-emptyrationaleoris_suggestion: true. Existing GraphQL parsing/dispatch is unchanged otherwise.needsRESTis set, dispatch via a newsetIssueFieldsViaRESThelper:fetchIssueFieldsto resolve each field's integer database ID and (for single-select fields) option name.{ "issue_field_values": [ { "field_id": <int>, "value": "<string>", "rationale": "...", "suggest": true } ] }.delete: trueis combined withrationale/is_suggestion(not supported on the REST shape).pkg/github/granular_tools_test.go: updated the two rationale/suggest test cases to mock the new REST flow (GraphQL field-defs query + REST PATCH) instead of the GraphQL mutation.No tool schema changes.
MCP impact
The tool's input/output schema is unchanged; only the underlying transport changes when
rationale/is_suggestionis set.Prompts tested (tool changes only)
N/A — input schema unchanged.
Security / limits
Tool renaming
Lint & tests
./script/lint./script/testDocs