Adding rationale for fields and labels in issues_granular#2505
Open
boazreicher wants to merge 6 commits into
Open
Adding rationale for fields and labels in issues_granular#2505boazreicher wants to merge 6 commits into
boazreicher wants to merge 6 commits into
Conversation
Co-authored-by: Copilot <copilot@github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an optional per-item rationale parameter to two granular issue tools: update_issue_labels (REST) and set_issue_fields (GraphQL). Each rationale is capped at 280 characters and follows the same pattern previously introduced for update_issue_type in #2458, sending the rationale only when present so existing behavior is preserved.
Changes:
update_issue_labelsis rewritten as a standalone tool that accepts either label name strings or{name, rationale}objects, building a raw PATCH request when any rationale is supplied and falling back to the standardgithub.IssueRequest{Labels: ...}wire format otherwise.IssueFieldCreateOrUpdateInputgains aRationale *githubv4.Stringandset_issue_fieldsaccepts an optional per-fieldrationale(trimmed, ≤280 chars) that is forwarded in the GraphQL mutation.- Toolsnaps and tests updated, including table-driven tests for the new label shapes and an end-to-end test for a field with rationale plus length-validation cases.
Show a summary per file
| File | Description |
|---|---|
| pkg/github/issues_granular.go | Rewrites GranularUpdateIssueLabels to support per-label rationale via raw PATCH; adds Rationale to IssueFieldCreateOrUpdateInput and schema/handler in GranularSetIssueFields. |
| pkg/github/granular_tools_test.go | Table-driven coverage for plain/object/mixed labels, label validation errors, plus field rationale success and length-error cases. |
| pkg/github/toolsnaps/update_issue_labels.snap | Schema snapshot updated to reflect the new oneOf string/object label item with rationale (max 280). |
| pkg/github/toolsnaps/set_issue_fields.snap | Schema snapshot updated to include the new optional rationale field property. |
Copilot's findings
- Files reviewed: 4/4 changed files
- Comments generated: 0
alondahari
previously approved these changes
May 19, 2026
Member
alondahari
left a comment
There was a problem hiding this comment.
Looks good, just a comment on superfluous descriptions
Co-authored-by: Copilot <copilot@github.com>
…ionale-to-update-labels-and-fields' into boazreicher/add-rationale-to-update-labels-and-fields
alondahari
approved these changes
May 19, 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
Modifies the issues_granular tool to support adding rationales for changes to an issue's labels or fields.
Context
We decided that in order for our experiment to be more valuable we need to include these two other granular tools. We will not expand this capability beyond these tools before we decide to pursue this feature to GA and have a plan on implementation for all tools.
Why
Closes https://github.com/github/plan-track-agentic-toolkit/issues/156
What changed
Using the same approach as in Add optional
rationaleparameter toupdate_issue_typetool #2458pkg/github/issues_granular.go— RewroteGranularUpdateIssueLabelsas a standalone tool (no longer usesissueUpdateToolhelper). Whenrationaleis provided, sends the labels as an object{"value": "...", "rationale": "..."}via a raw PATCH request. When omitted, sends{"type": "..."}preserving existing behavior. Also updatedGranularSetIssueFieldsspkg/github/granular_tools_test.go— Expanded test to table-driven covering both type-only and type-with-rationale cases.Updated schema snapshots.