Skip to content

feat: issue_graph — cross-repo issue/PR hierarchy traversal - #5

Merged
gastrodon merged 1 commit into
mainfrom
issue-graph
Jun 27, 2026
Merged

feat: issue_graph — cross-repo issue/PR hierarchy traversal#5
gastrodon merged 1 commit into
mainfrom
issue-graph

Conversation

@gastrodon

Copy link
Copy Markdown

Summary

Backport of upstream github#1511. Implements the issue_graph tool that traverses issue/PR hierarchies via BFS and returns a flat node+edge list optimized for LLM consumption.

Closes #3

What this adds

  • issue_graph tool registered in the issues toolset (alongside issue_read, sub_issue_write, etc.)
  • BFS traversal from a root issue/PR, following:
    • Sub-issues (GitHub sub-issues API)
    • Parent issues (GraphQL parent field, requires no beta header in v87)
    • Body references (closes #N, fixes #N, cross-repo owner/repo#N, full GitHub URLs)
    • Cross-referenced issues from the timeline (focus node only)
  • Node classification: epic (by issue type, label, or title), batch (has sub-issues), task, pr
  • Priority queue ensures parents are visited before siblings, children before cross-refs
  • focus=epic|batch — shifts focus up the hierarchy to the nearest epic or batch
  • cross_repo=false (default) — skips edges that point to a different repo than root
  • max_nodes=50 (default) — BFS node limit to prevent runaway crawls
  • 30-second crawl timeout; returns partial results on timeout

Output format (text, LLM-optimized)

GRAPH SUMMARY
=============
Focus: #42 (task) "Fix login bug"
State: open
Graph contains 1 nodes: 1 task(s)

Node types: epic (large initiative), batch (has sub-issues), task (regular issue), pr (pull request)

NODES (1 total)
===============
#42|task|open|Fix login bug [FOCUS]
  Preview: Users cannot log in after the recent update.

SUB-ISSUES (parent → child)
===========================
(none)

CROSS-REFERENCES (mentioned/referenced)
=======================================
(none)

Test plan

  • go build ./... passes
  • All new tests pass (TestIssueGraph_*, TestExtractIssueRefs, TestClassifyIssueNode, TestSanitizeBodyPreview)
  • Existing TestAllToolsHaveRequiredMetadata, TestAllToolsHaveHandlerFunc, TestAllToolsetIconsExist all pass
  • Toolsnap created at pkg/github/__toolsnaps__/issue_graph.snap
  • Manual end-to-end test against a real repo with sub-issue hierarchy

Implements the issue_graph tool that performs a BFS traversal from a
root issue/PR, following sub-issues, parent issues (via GraphQL), and
body references (closes/fixes/mentions). Returns a flat node+edge list
formatted for LLM consumption.

Supports focus=epic|batch to shift the focus node up the hierarchy, and
cross_repo=true to follow references into other repos. Registered in the
issues toolset alongside IssueRead, SubIssueWrite, etc.
@gastrodon
gastrodon merged commit ffe42f5 into main Jun 27, 2026
@gastrodon
gastrodon deleted the issue-graph branch June 27, 2026 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

backport: issue_graph tool — cross-repo issue/PR hierarchy traversal

1 participant