Skip to content

Fix gh pr view crash with fine-grained PATs (#12597)#12653

Open
VishnuVV27 wants to merge 1 commit intocli:trunkfrom
VishnuVV27:fix-pr-view-permission-crash
Open

Fix gh pr view crash with fine-grained PATs (#12597)#12653
VishnuVV27 wants to merge 1 commit intocli:trunkfrom
VishnuVV27:fix-pr-view-permission-crash

Conversation

@VishnuVV27
Copy link

Description

Fixes a crash in gh pr view (and related commands using Finder.Find) when the user's authentication token does not have permission to access status checks/statuses. This is a common issue for users with "Fine-Grained" Personal Access Tokens on organization-owned private repositories.

Fix

  1. Resilient Fetching: Moved the statusCheckRollup field out of the initial GraphQL query and into a parallel background fetch within finder.go.
  2. Graceful Error Handling: Introduced api.IsGraphQLErrorResourceNotAccessible to detect permission-related GraphQL failures. If the background fetch for status checks fails because of lack of permissions, the error is now ignored rather than aborting the entire command. This allows the user to see the PR title, body, and comments even if they can't see the check results.

Verification

  • Reproduction Test: Created a test case that mocks a GraphQL FORBIDDEN error for the statusCheckRollup field. Confirmed that without the fix, the test crashes, and with the fix, the command successfully returns the PR data.
  • Regression Testing: Ran the full test suite for pkg/cmd/pr/view/... to ensure standard users (with full permissions) still see check results as intended. All 39 tests passed.

Checklist

  • Fixed the bug locally
  • Added/Updated tests to verify the fix
  • Verified that existing tests still pass

Fixes #12597

@VishnuVV27 VishnuVV27 requested a review from a team as a code owner February 9, 2026 11:09
@VishnuVV27 VishnuVV27 requested a review from BagToad February 9, 2026 11:09
@cliAutomation cliAutomation added the external pull request originating outside of the CLI core team label Feb 9, 2026
@github-actions
Copy link

github-actions bot commented Feb 9, 2026

Thank you for your pull request! 🎉

This PR appears to fix the following issues that are not labeled with help wanted Contributions welcome :

As outlined in our Contributing Guidelines, we expect that PRs are only created for issues that have been labeled help wanted.

While we appreciate your initiative, please note that:

  • PRs for non-help wanted issues may not be reviewed immediately as they might not align with our current priorities
  • The issue might already be assigned to a team member or planned for a specific release
  • We may need to close this PR. For example, if it conflicts with ongoing work or architectural decisions

What happens next:

  • Our team will review this PR and the associated issues
  • We may add the help wanted label to the issues, if appropriate, and review this pull request
  • In some cases, we may need to close the PR. For example, if it doesn't fit our current roadmap

Thank you for your understanding and contribution to the project! 🙏

This comment was automatically generated by cliAutomation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external pull request originating outside of the CLI core team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gh pr view fails with fine-grained PAT on organization private repository due to statusCheckRollup access

2 participants