From 9582f85f5885c142fe51f059a331150f88ce3451 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Fri, 17 Apr 2026 23:57:12 +0000 Subject: [PATCH 1/2] fix(backend): stop Gitea/Forgejo pagination on empty page response When an API token can only see a subset of org repos, the x-total-count header reports the org total while the token returns fewer items. The previous loop condition (output.length < totalCount) would never be satisfied for the visible subset, causing infinite pagination. Now we break out of the loop when the API returns an empty page, matching the Gitea API pagination docs recommendation. Fixes #1108 Co-authored-by: Brendan Kellam --- packages/backend/src/gitea.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/backend/src/gitea.ts b/packages/backend/src/gitea.ts index 23f5c520f..ac7566ee8 100644 --- a/packages/backend/src/gitea.ts +++ b/packages/backend/src/gitea.ts @@ -254,6 +254,9 @@ const paginate = async (request: (page: number) => Promise Date: Sat, 18 Apr 2026 00:01:10 +0000 Subject: [PATCH 2/2] chore: add changelog entry for Gitea/Forgejo pagination fix Co-authored-by: Brendan Kellam --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a37c5e36..454eebecd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fixed revision selection so the 64-revision cap prefers the newest matching branches and tags instead of pruning by ref-name order. [#1122](https://github.com/sourcebot-dev/sourcebot/pull/1122) +- Fixed infinite pagination loop in Gitea/Forgejo when an API token can only see a subset of org repos (the `x-total-count` header reports org total while token returns fewer items). [#1130](https://github.com/sourcebot-dev/sourcebot/pull/1130) ## [4.16.11] - 2026-04-17