Skip to content

gh pr view --json files and --json commits silently truncate at 100 items #13338

@SebTardif

Description

@SebTardif

Describe the bug

gh pr view --json files and gh pr view --json commits return at most 100 items, silently dropping any beyond the first page. This is because the GraphQL fragments for prFiles and prCommits do not include pageInfo, and there are no corresponding preloadPr* pagination functions — unlike reviews, comments, and closingIssuesReferences, which already paginate correctly.

Steps to reproduce

# On any PR with >100 changed files:
gh pr view 12345 --json files --jq ".files | length"
# Always returns 100, even if the PR has 200+ files

Expected vs actual behavior

Expected: All files/commits are returned, regardless of count.
Actual: Silently truncated to 100.

Context

This was identified in #12522 (making gh better for agents). Silent truncation is particularly problematic for automated workflows that assume complete data. The fix follows the exact pagination pattern already used by preloadPrReviews, preloadPrComments, and preloadPrClosingIssuesReferences in finder.go.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggh-prrelating to the gh pr commandpriority-3Affects a small number of users or is largely cosmetic

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions