Add field_values to search_issues results#2474
Draft
kelsey-myers wants to merge 4 commits into
Draft
Conversation
Adds Issues 2.0 custom field values to each issue returned by the
list_issues GraphQL query, exposed on MinimalIssue as field_values:
[{field, value}]. Filtering by field is a separate concern (needs the
GraphQL IssueFilters input updated upstream) and is not included here.
shurcooL/graphql's response decoder walks every inline fragment of a
union regardless of __typename, so IssueFieldNumberValue.value is
aliased to valueNumber to avoid a Float-vs-String type clash when the
runtime variant is, e.g., a SingleSelectValue.
After the REST search returns results, batch a single nodes(ids:[...]) GraphQL query to fetch each issue's custom field values. The extra round-trip is one per page of results. Non-breaking: field_values is omitempty and the response shape is additive. Also extracts prepareSearchArgs from searchHandler so the query-building logic is shared with search_pull_requests without coupling PR search to the issue-specific enrichment path.
900d2b9 to
856ce87
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends issue search/listing paths to include custom issue field values from GraphQL while preserving REST-based search_issues pagination.
Changes:
- Adds issue field value GraphQL fragments and minimal response types.
- Adds
search_issuesREST search enrichment via a batchednodes(ids:)GraphQL query. - Updates issue listing/search tests to include field value fixtures.
Show a summary per file
| File | Description |
|---|---|
pkg/github/search_utils.go |
Extracts shared search argument preparation and simplifies the generic search handler. |
pkg/github/minimal_types.go |
Adds minimal issue field value output and maps GraphQL issue fragments into it. |
pkg/github/issues.go |
Adds issue field GraphQL fragments, search enrichment logic, and wires it into search_issues. |
pkg/github/issues_test.go |
Adds search field-value enrichment coverage and updates list issue GraphQL mocks/expectations. |
Copilot's findings
Comments suppressed due to low confidence (1)
pkg/github/issues.go:252
- This connection is capped at
first: 25without requestingpageInfoor documenting the limit, so issues with more than 25 custom field values will silently return an incompletefield_valuesarray. Paginate the connection (or use a documented maximum that covers all issue fields) before presenting this as the issue's field values.
IssueFieldValues struct {
Nodes []IssueFieldValueFragment
} `graphql:"issueFieldValues(first: 25)"`
- Files reviewed: 4/4 changed files
- Comments generated: 7
Comment on lines
+1052
to
+1053
| idStr, ok := n.Issue.ID.(string) | ||
| if !ok || idStr == "" { |
| ClosedAt string `json:"closed_at,omitempty"` | ||
| ClosedBy string `json:"closed_by,omitempty"` | ||
| IssueType string `json:"issue_type,omitempty"` | ||
| FieldValues []MinimalIssueFieldValue `json:"field_values,omitempty"` |
Comment on lines
+1101
to
+1103
| fieldValuesByID, err = fetchIssueFieldValuesByNodeID(ctx, gqlClient, result.Issues) | ||
| if err != nil { | ||
| return ghErrors.NewGitHubGraphQLErrorResponse(ctx, errorPrefix+": failed to fetch issue field values", err), nil |
ZahidDigitalHQ
approved these changes
May 13, 2026
|
|
kelsey-myers:kelsey/search-issues-field-values |
ZahidDigitalHQ
approved these changes
May 13, 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
Extends
search_issuesto include custom issue field values (field_values) on each result item, fetched via a single follow-up GraphQLnodes()query after the REST search.Why
Closes github/plan-track-agentic-toolkit#119
search_issuesreturned no field values (priority, estimate, etc.) even when issues had them. Agents couldn't act on field data from search results without a separate lookup per issue.What changed
search_issuespreviously used the REST search API and returned results as-is. A full GraphQL rewrite would have changed the pagination model (cursor-based instead of page-based), which would be a breaking change for existing callers. Instead, this keeps REST for the search itself and adds a single follow-upnodes(ids:[...])GraphQL query per page to fetch field values in bulk. The caveat is an extra round-trip per page, but no breaking changes.SearchIssueResult/SearchIssuesResponsetypes to wrap REST search results withfield_valuessearchIssuesNodesQueryGraphQL struct for thenodes(ids:)batch lookupfetchIssueFieldValuesByNodeIDhelper that runs one GraphQL round-trip per page of resultssearchIssuesHandlerthat wires REST search + enrichment, called from thesearch_issuestoolprepareSearchArgsfromsearchHandlerso query-building logic is shared withsearch_pull_requestswithout coupling PR search to the enrichment pathTest_SearchIssues_FieldValuesEnrichmentcovers field_values population; existingTest_SearchIssuescases are unchangedMCP impact
search_issuesresponse shape gainsitems[].field_values(omitempty, non-breaking additive change).total_countandincomplete_resultsare now explicit top-level fields.list_issuesalso gainsfield_valueson each result item (same omitempty, non-breaking).Prompts tested (tool changes only)
Security / limits
nodes()respect the viewer's existing GraphQL permissions; no additional scopes required beyondrepo.Tool renaming
Lint & tests
./script/lint./script/testDocs