Problem
The viewed state set on a file in the Pull Requests tool window does not reach GitHub. A reload of the pull request page in the browser still shows the file as not viewed.
The opposite direction works. A file marked as viewed in the browser appears as viewed in the IDE after Refresh Pull Request action.
Nothing indicates a failure. The checkbox stays ticked, no notification appears, and the IDE log records no error.
Three further signals point to this cause:
- The pull request, the file list, and the diff all load normally.
- The same GitHub account marks files as viewed correctly in the browser.
- Repositories in the account's own namespace sync correctly. Only repositories owned by an organization fail.
Cause
The IDE account was authenticated through the browser login flow, which uses the JetBrains IDE Integration OAuth App. OAuth App access restrictions are enabled on the organization that owns the repository.
Under those restrictions, GitHub grants an unapproved OAuth App public read access only, and denies writes to the organization's resources. GitHub therefore allows a read of a viewed state from a public repository, and refuses the write back. GitHub returns the refusal as an errors array inside an HTTP 200 response, and the IDE discards it, so the file stays marked as viewed in the IDE.
The same restriction denies other writes to the organization's resources. The silent write failure is tracked in Sync “mark as viewed” with Github.
Resolution
Grant the JetBrains IDE Integration OAuth App access to the organization.
An organization owner does this through Approving OAuth apps for your organization. An organization member cannot approve the app. A member requests approval through Requesting organization approval for OAuth apps.
After approval, use Refresh Pull Request in the IDE. If the state still does not sync, remove the GitHub account in Settings | Version Control | GitHub and add it again.
Viewed state does not propagate automatically once approval is in place. Refresh Pull Request in the IDE, or a page reload in the browser, is required to see a change made on the other side.
Workaround
If organization approval is not possible, replace the OAuth account with a classic personal access token. A token is not an OAuth App, so OAuth App access restrictions do not apply to it.
- Create a classic personal access token with the
reposcope. - In Settings | Version Control | GitHub, remove the existing account.
- Add the account again using the token.
The repo scope is broad. An organization that enables the separate personal access token policy blocks the token path too.
Related articles
The same organization restriction produces visible errors on other operations. Cannot access GitHub repository covers Could not connect to repository and Can't get repository when the Pull Requests tool window fails to load. Operations Against a GitHub Repository Are Failing covers Could not resolve to a Repository and HTTP 403 on push, pull, and fetch.
Comments
0 comments
Please sign in to leave a comment.