[Bug]: PR detail and watch_pull_request fail when a fine-grained token can't read check runs (follow-up to #15229) #22966
Follow-up to #15229, as requested there ("please open a new issue for that part only").
What happens#
With a fine-grained GitHub personal access token, opening a pull request's detail still fails, because the detail read asks for every check run and GitHub doesn't offer a Checks permission for fine-grained tokens. GET /repos/{owner}/{repo}/commits/{sha}/check-runs returns 403 "Resource not accessible by personal access token". The detail read treats that single refusal as a failure of the whole answer.
The most visible effect is watch_pull_request. Each sweep reads the PR detail, every read fails, and the watch stops after 8 failures ("failed to read it from the host 8 times", about 16 minutes), so a watched PR never wakes the thread. On one server here that was 58 such stops in a week against 3 real wakes. The PR detail panel and pull-request guides fail the same way.
What already works#
Since #16320 and #19224, the list, pull-request page and merge-settlement reads ask only for the overall check state, so they work with Commit statuses: Read. With the same token, reviews, comments, mergeable state and the overall rollup state all read fine.
Expected#
When check runs can't be read, the detail read should degrade instead of failing: return the rest of the PR with checks marked unavailable (or fall back to the overall rollup state, as the list does). A watch would then still wake on reviews, comments, conflicts and the overall check state.
Environment#
- T3 Code 0.1.2-nightly.20261021.3457 (server, Linux), headless, GitHub auth through
ghwith a fine-grained PAT (Contents, Pull requests, Commit statuses, Actions read). - The same watches work with a classic token or a user login on another machine.
tanstack-source added labelsbug
We hit this as well: PR-watch check reads were denied by a GitHub App, while Actions run metadata remained readable. It still reproduces on v0.1.11.
getPullRequestDetailonly falls back for refused requested-reviewers, and the per-context check query still turns FORBIDDEN into a failed read.We prepared an offline fallback that can report an Actions-terminal change without treating unavailable required checks as passing. It keeps the watch's head/run identity and credential boundaries. I see #22987 takes the overall-check-status route. Ours instead falls back to Actions run data when check contexts are unreadable. Would a bounded fallback along those lines, with targeted regression fixtures, be useful upstream?
Still happening on 0.1.12; #22987 would fix it for us.
Would like this fixed please!
Sign in to join this conversation.
Also seeing this in the macOS desktop app (0.1.7-nightly.20261104.4151): the PR detail panel fails for a private repository whose PR has three GitHub Actions check runs. The panel shows:
The token is a fine-grained PAT with Commit statuses: Read.
One additional observation with the same token:
statusCheckRollup.contexts.checkRunCountsByStateis readable via GraphQL (here FAILURE 1, SKIPPED 1, SUCCESS 1), while the individual CheckRun nodes come back null with FORBIDDEN errors.