Skip to content

OAuth: sync collaborators of repositories with projects only on full syncs - #13243

Draft
ericholscher wants to merge 1 commit into
claude/gh-app-member-eventsfrom
claude/gh-app-scoped-collaborator-sync
Draft

OAuth: sync collaborators of repositories with projects only on full syncs#13243
ericholscher wants to merge 1 commit into
claude/gh-app-member-eventsfrom
claude/gh-app-scoped-collaborator-sync

Conversation

@ericholscher

@ericholscher ericholscher commented Aug 18, 2026

Copy link
Copy Markdown
Member

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 a sync_all_collaborators flag: 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

…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
ericholscher force-pushed the claude/gh-app-scoped-collaborator-sync branch from 744fb41 to ea14521 Compare August 18, 2026 22:39
@ericholscher ericholscher changed the title OAuth: sync collaborators of repositories with projects only on org events OAuth: sync collaborators of repositories with projects only on full syncs Aug 18, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants