Enrich issue_read get with hierarchy relationship signals#2764
Open
zwick wants to merge 4 commits into
Open
Conversation
The default issue_read `get` payload surfaced no hierarchy data, forcing agents to drop to raw REST (parent_issue_url) or scan sibling sub_issues to discover relationships. Enrich `get` with a layered, zero-extra-round-trip relationship signal derived from a single combined GraphQL query: - has_parent / has_children: cheap, always-emitted routing booleans (addresses Sam Morrow's #2726 review note). - parent: compact ref (number/title/state/url/repository) mirroring the existing get_parent payload keys; omitted when there is no parent. - sub_issues_summary: native subIssuesSummary counts (total/completed/ percent_completed); omitted when there are no sub-issues. The single-issue field-values GraphQL call in GetIssue is replaced by one combined query (fetchIssueReadEnrichment) returning field values + parent + subIssuesSummary, so `get` adds no round-trips. Enrichment is best-effort: a query failure still returns the base issue and never fails `get`. Parent titles are sanitized (parent may be cross-repo) and redacted under lockdown mode unless the parent content can be verified as safe; numeric/structural fields and counts stay intact. get_parent / sub_issue_write behavior is unchanged; tool descriptions clarify hierarchy is read here but written via sub_issue_write (no writable parent field). Refs github/planning-tracking#3306 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ef3362d to
d7f0c8c
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
d7f0c8c to
a8ed349
Compare
Align issue_read get parent enrichment with the codebase's existing lockdown patterns: rather than introducing a third, redaction-with-sentinel behavior, omit the whole parent reference when its (possibly cross-repo) content cannot be verified safe. This mirrors how unsafe comments, sub-issues, and PR reviews are filtered out. has_parent stays true so an agent can still route to get_parent. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
6 tasks
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enriches the issue_read tool’s get response with lightweight issue hierarchy signals (parent/children presence) and optional relationship summaries, sourced from a single combined GraphQL query and designed to be best-effort (never failing get).
Changes:
- Added hierarchy relationship fields (
has_parent,has_children, optionalparent, optionalsub_issues_summary) to the minimal issue payload returned byissue_read get. - Replaced the prior field-values-only GraphQL enrichment with a combined enrichment query (
fetchIssueReadEnrichment) and applied it viaapplyIssueReadEnrichment, including lockdown-aware parent redaction. - Updated tool/README descriptions and added unit tests covering hierarchy enrichment and failure behavior.
Show a summary per file
| File | Description |
|---|---|
| README.md | Updates generated docs to clarify issue_read get hierarchy signals and sub_issue_write routing guidance. |
| pkg/github/minimal_types.go | Extends MinimalIssue with hierarchy fields and adds helper types for parent reference and sub-issue summary. |
| pkg/github/issues.go | Implements combined GraphQL enrichment for issue_read get and lockdown-safe parent surfacing. |
| pkg/github/issues_test.go | Adds tests for hierarchy enrichment, lockdown redaction behavior, and best-effort fallback on query failure. |
| pkg/github/toolsnaps/sub_issue_write.snap | Updates schema snapshot for revised sub_issue_write method description. |
| pkg/github/toolsnaps/issue_read.snap | Updates schema snapshot for revised issue_read method description. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 3
- Review effort level: Low
Comment on lines
+346
to
+353
| // Hierarchy relationship signals. HasParent and HasChildren are always emitted | ||
| // (an explicit false is itself a useful routing signal); SubIssuesSummary is populated | ||
| // when children exist, and Parent when a parent exists and may be surfaced (under lockdown | ||
| // an unverified parent reference is omitted while HasParent stays true). | ||
| HasParent bool `json:"has_parent"` | ||
| HasChildren bool `json:"has_children"` | ||
| Parent *MinimalIssueRef `json:"parent,omitempty"` | ||
| SubIssuesSummary *MinimalSubIssuesSummary `json:"sub_issues_summary,omitempty"` |
Comment on lines
+356
to
+358
| // MinimalIssueRef is a compact reference to a related issue (e.g. a parent issue). | ||
| // Its keys mirror the get_parent (GetIssueParent) payload so both surfaces agree. | ||
| type MinimalIssueRef struct { |
Comment on lines
+634
to
+637
| { | ||
| name: "has_children is false when total is zero even with completed nonzero", | ||
| parent: nil, | ||
| summary: map[string]any{"total": 0, "completed": 0, "percentCompleted": 0}, |
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
Enrich the
issue_readgetpayload with layered hierarchy relationship signals, derived from a single combined GraphQL round-trip (no added round-trips onget).Why
The default
getpayload surfaced no relationship data, so an agent calling the most obvious tool got zero hierarchy signal and had to drop to raw REST (parent_issue_url) or scan sibling sub-issues. This also addresses the #2726 review note asking for cheaphas_parent/has_childrenrouting booleans as a follow-up.Refs github/planning-tracking#3306
What changed
issue_read getnow returnshas_parent/has_children(always emitted), plusparentandsub_issues_summarywhen those relationships exist.fetchIssueReadEnrichment) returning field values + parent +subIssuesSummary.get.get_parent/sub_issue_writebehavior unchanged; tool descriptions now clarify optional hierarchy summaries and write routing viasub_issue_write.MCP impact
issue_read getresponse gains hierarchy fields;issue_readandsub_issue_writemethoddescriptions updated.Prompts tested (tool changes only)
has_parent: trueandparent(#2820) without raw REST / sibling scanning. Covered by unit tests; live MCP verification noted as a manual follow-up.Security / limits
Tool renaming
Lint & tests
./script/lint./script/testDocs