From 3e65a8763d6bf810124cd4d2d45ec98c56893bb9 Mon Sep 17 00:00:00 2001 From: Jaehyun Yeom Date: Mon, 8 Jun 2026 22:17:15 -0700 Subject: [PATCH] fix(gh-nudge): fetch all open PRs instead of capping at 10 GetPendingPullRequests used `gh pr status -q ".createdBy"`, but `gh pr status` is hardcoded to return at most 10 PRs and exposes no --limit flag, so users with more than 10 open PRs lost the rest silently. Both gh-nudge and gh-merge share this fetch path. Switch to `gh pr list --author "@me" --limit 100`, which preserves the "open PRs created by me" semantics and the same JSON array shape while supporting an explicit limit. --- devtools/gh-nudge/internal/github/github.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/devtools/gh-nudge/internal/github/github.go b/devtools/gh-nudge/internal/github/github.go index 062e883..9c52c73 100644 --- a/devtools/gh-nudge/internal/github/github.go +++ b/devtools/gh-nudge/internal/github/github.go @@ -55,12 +55,23 @@ func NewClientWithExecutor(executor CommandExecutor) *Client { return &Client{executor: executor} } +// pullRequestListLimit caps how many pull requests are fetched. The gh CLI's +// `pr list` defaults to 30; we raise it well past that so users with many open +// PRs are not silently truncated (the previous `pr status` command was capped +// at 10 with no way to override). +const pullRequestListLimit = 100 + // GetPendingPullRequests fetches pending pull requests using the gh CLI. -// It fetches PRs created by the current user. +// It fetches open PRs created by the current user. func (c *Client) GetPendingPullRequests() ([]models.PullRequest, error) { - // Construct the gh command to get PR information - // This command fetches PRs with their title, URL, review requests, and files - output, err := c.executor.Execute("gh", "pr", "status", "--json", "url,title,reviewRequests,files,mergeable,headRefName,statusCheckRollup", "-q", ".createdBy") + // Construct the gh command to get PR information. + // This fetches open PRs authored by the current user with their title, URL, + // review requests, and files. We use `pr list --author @me` instead of + // `pr status` because `pr status` is hardcoded to return at most 10 PRs. + output, err := c.executor.Execute("gh", "pr", "list", + "--author", "@me", + "--limit", fmt.Sprintf("%d", pullRequestListLimit), + "--json", "url,title,reviewRequests,files,mergeable,headRefName,statusCheckRollup") if err != nil { return nil, fmt.Errorf("failed to execute gh command: %w", err) }