Skip to content

gh-create-issue: consolidate Phase 2 investigate calls (#36) - #39

Merged
cbeaulieu-gt merged 3 commits into
mainfrom
36-gh-create-issue-context-script
Aug 16, 2026
Merged

gh-create-issue: consolidate Phase 2 investigate calls (#36)#39
cbeaulieu-gt merged 3 commits into
mainfrom
36-gh-create-issue-context-script

Conversation

@cbeaulieu-gt

@cbeaulieu-gt cbeaulieu-gt commented Aug 16, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds scripts/gh-create-issue-context.py (gather_context(repo, search_keywords=None)) — consolidates the 4-5 separate gh calls in gh-create-issue/SKILL.md Phase 2 (overlap search, open issues, open PRs, labels, milestones) into one call emitting a single JSON payload.
  • Skips the overlap-search gh call entirely when no keywords are given (not just returns empty).
  • Filters PR-shaped items out of open_issues (GitHub's /issues endpoint includes PRs).
  • Uses jq=".items" server-side for the search endpoint so it correctly unwraps the real /search/issues envelope.
  • Updates skills/gh-create-issue/SKILL.md Phase 2 to consume the script's output. The overlap-judgment call stays with the LLM — the script only surfaces keyword-matched candidates.

Test plan

  • pytest — 231 passed (211 pre-existing + 20 new, test-first via test-implementer)
  • ruff check scripts/ — clean

Closes #36

🤖 Generated by Claude Code on behalf of @cbeaulieu-gt

Summary by CodeRabbit

  • New Features

    • Added a command-line tool that collects open issues, pull requests, labels, milestones, and optional duplicate-search results in a single JSON response.
    • Added automatic repository detection and support for selecting a specific repository.
    • Duplicate searches are skipped when no keywords are provided.
  • Documentation

    • Updated issue investigation guidance to use the consolidated context-gathering workflow.
  • Tests

    • Added comprehensive coverage for successful retrievals, pagination, filtering, searches, and error handling.

Consolidates the 4-5 separate gh calls described in gh-create-issue/
SKILL.md Phase 2 (overlap search, open issues, open PRs, labels,
milestones) into a single gather_context() call returning one JSON
payload. Implemented against the frozen test suite in
scripts/tests/test_gh_create_issue_context.py.
Test-first via test-implementer, implemented against in 6b2f24d.
…pt (#36)

Phase 2 now runs gh-create-issue-context.py once instead of 4-5
separate gh calls (overlap search, open issues, open PRs, labels,
milestones), per gather_context() added in 6b2f24d.
@cbeaulieu-gt cbeaulieu-gt added the needs-review CodeRabbit should review this PR label Aug 16, 2026
@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

The PR adds a Python CLI that gathers open issues, pull requests, labels, milestones, and optional search results through GitHub API calls. It emits one JSON object. The issue-investigation skill now invokes this script.

Issue context gathering

Layer / File(s) Summary
Context collection
scripts/gh-create-issue-context.py
gather_context retrieves paginated datasets, excludes pull requests from issues, and includes optional search results.
CLI and skill integration
scripts/gh-create-issue-context.py, skills/gh-create-issue/SKILL.md
The CLI supports repository and search options, emits JSON, and reports failures. The skill uses the consolidated command.
Context behavior validation
scripts/tests/test_gh_create_issue_context.py
Tests cover result assembly, search behavior, filtering, error propagation, pagination, and API-call mocking.

Sequence Diagram(s)

sequenceDiagram
  participant Investigator
  participant ContextCLI as gh-create-issue-context.py
  participant GitHubAPI as GitHub API
  Investigator->>ContextCLI: Run with repository and optional keywords
  ContextCLI->>GitHubAPI: Fetch issues, pull requests, labels, and milestones
  opt Keywords supplied
    ContextCLI->>GitHubAPI: Search issues
  end
  GitHubAPI-->>ContextCLI: Return datasets
  ContextCLI-->>Investigator: Print one JSON context object
Loading

Merge Risk: 🟡 Moderate · up to 11c33

The new context script can fail at runtime when GitHub returns multiple pages of results, preventing issue creation workflows from gathering context; merge should wait for the pagination parsing fix and regression coverage.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes consolidating the Phase 2 investigation calls into one script.
Linked Issues check ✅ Passed The changes implement the single-call script, unified JSON payload, SKILL.md update, and test coverage required by issue #36.
Out of Scope Changes check ✅ Passed The changes remain within Phase 2 and do not alter later interactive phases or LLM-driven judgments.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d4f935c6-8890-430e-9db5-97b935ab243c

📥 Commits

Reviewing files that changed from the base of the PR and between 5792745 and 11c338b.

📒 Files selected for processing (3)
  • scripts/gh-create-issue-context.py
  • scripts/tests/test_gh_create_issue_context.py
  • skills/gh-create-issue/SKILL.md

Included review availability: Your plan includes up to 3 reviews per rolling hour; 1 remains after this review.

Comment thread scripts/gh-create-issue-context.py
@cbeaulieu-gt

Copy link
Copy Markdown
Member Author

Re: CodeRabbit's pagination finding — not implementing this in scope for #39.

run_gh_api(paginate=True) in scripts/_gh_common.py is pre-existing shared code, not something this PR introduced — it's used identically (no --slurp) by gh-summary.py, gh-quick-wins.py, gh-refresh-issues.py, and gh-release-status.py, all already merged and in production use. gh api --paginate auto-merges JSON-array pages from REST list endpoints into a single combined array without needing --slurp--slurp is for wrapping each page separately (needed for GraphQL cursor pagination or non-array responses), not for simple REST list concatenation. The bot's own research conflates these two cases.

If this turns out to be wrong (real multi-page repos actually break), it's a bug in the shared _gh_common.run_gh_api helper affecting 5 scripts, not something scoped to this PR — worth its own issue with an empirical repro (a repo with >30 open issues) rather than a piecemeal fix here that risks breaking the paginate=True, jq=... combination other callers rely on.

🤖 Generated by Claude Code on behalf of @cbeaulieu-gt

@cbeaulieu-gt
cbeaulieu-gt merged commit aae8355 into main Aug 16, 2026
1 check passed
@cbeaulieu-gt
cbeaulieu-gt deleted the 36-gh-create-issue-context-script branch August 16, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-review CodeRabbit should review this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gh-create-issue: consolidate Phase 2 investigate calls into one script

1 participant