OAuth: sync collaborators of repositories with projects only on full syncs - #13243
Draft
ericholscher wants to merge 1 commit into
Draft
OAuth: sync collaborators of repositories with projects only on full syncs#13243ericholscher wants to merge 1 commit into
ericholscher wants to merge 1 commit into
Conversation
This was referenced Aug 18, 2026
ericholscher
force-pushed
the
claude/gh-app-member-events
branch
from
August 18, 2026 21:51
66fb41f to
60fb149
Compare
ericholscher
force-pushed
the
claude/gh-app-scoped-collaborator-sync
branch
from
August 18, 2026 21:53
11fbf97 to
744fb41
Compare
ericholscher
force-pushed
the
claude/gh-app-member-events
branch
from
August 18, 2026 22:37
60fb149 to
80962a8
Compare
…syncs Listing collaborators costs at least one API request per repository, which is the dominant cost of a full installation sync, and makes large installations exceed GitHub's per-installation rate limit. Syncs triggered by organization renames now list collaborators only for repositories linked to a project, which is what SSO access and maintainer listings need fresh. Collaborators of other repositories only feed the list of repositories available to import, and keep being refreshed when each user signs in or manually re-syncs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LVjkPjH3EDEQmtywJvDVau
ericholscher
force-pushed
the
claude/gh-app-scoped-collaborator-sync
branch
from
August 18, 2026 22:39
744fb41 to
ea14521
Compare
ericholscher
added a commit
that referenced
this pull request
Aug 19, 2026
A rate-limited GitHub API request [fails with a 403](https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api), and `update_or_create_repositories()` treats any 403 as if we lost access to the repository — deleting the `RemoteRepository` and silently disconnecting its projects. Large installations are currently hitting the rate limit during webhook-triggered syncs, so this is actively waiting to happen. A rate limit now aborts the operation without deleting anything, and without making further doomed requests. The task still fails visibly — no retries. PyGithub raises `RateLimitExceededException` (a `GithubException` subclass) for both [primary and secondary rate limits](https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api#about-secondary-rate-limits), so catching it before the generic 403/404 handling covers both. Reducing the API usage that triggers the rate limits is handled separately in #13241, #13242, and #13243. Likely related to #13101, since build statuses and PR comments share the same per-installation budget. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01LVjkPjH3EDEQmtywJvDVau Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Listing collaborators costs at least one API request per repository, making it the dominant cost of a full installation sync — for installations with thousands of repositories, a single sync can't fit in GitHub's hourly per-installation budget (5,000–12,500 requests/hour) at all.
sync()gains async_all_collaboratorsflag: when off, collaborators are listed only for repositories linked to a project — the data SSO access and maintainer listings need fresh. Collaborators of repositories without a project only feed the import listing, and keep being refreshed when each user signs in or manually re-syncs. Organization renames — the remaining full-sync trigger from organization events — use it, since renaming doesn't change permissions. For an org with 2,000 repositories and 50 projects, that sync drops from ~2,000 requests to ~70.Stacked on #13242 (the base branch) — merge it first.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LVjkPjH3EDEQmtywJvDVau