Repository navigation
fix(gitea): walk every page of PR files and commits - #3022
Merged
Merged
Conversation
Gitea serves list endpoints one page at a time, 30 items by default, and RepoApi.get_change_file_pull_request / get_pr_commits issued a single unpaged call, so a PR past the page size was reviewed against a partial file list. Both now walk the pages until an empty one, keep header token auth on every request, and let a failure mid-way fall through to the existing handlers rather than returning a truncated list. Closes The-PR-Agent#2138
Contributor
IsmaelMartinez
approved these changes
Sep 4, 2026
IsmaelMartinez
left a comment
Collaborator
There was a problem hiding this comment.
Approving. The one thing worth checking was whether the walk can actually end, and it can: Gitea's files and commits handlers clamp the page window to zero once you pass the end and answer with [] rather than the last page, so stopping on an empty page cannot spin. Same clamp in 1.23.6, the version in the report.
Qodo's run errored, so no review had landed here at all. Thanks for taking this on after it sat since December.
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.
Gitea answers list endpoints one page at a time, 30 items by default, and
RepoApi.get_change_file_pull_request/get_pr_commitsissued a single callwith no paging. Any PR past the page size was reviewed against a partial file
list, silently.
Both now walk the pages through one helper,
_list_all_pages. The earlierattempt in #2147 stalled on three points, and each is addressed here:
uses, so no credential lands in a query string
requested limit: the server caps
limitat its ownMAX_RESPONSE_ITEMS,so a capped page must not end the walk early
empty result a failed call always did, never a partial list
The tests cover a multi-page walk for files and for commits, a server that
caps the page below the requested limit, header auth on every page, and the
mid-way failure. All five fail on
main.Closes #2138