fix(api): add index tiebreaker to commit status ordering (#39508) - #39525
Merged
Merged
Conversation
) Commit status list orders only by `created_unix`/`updated_unix`, which have 1-second resolution while CI often posts many statuses per second. With LIMIT/OFFSET paging, databases (e.g. PostgreSQL using a Sort plan) may order tied rows differently per page, so `GET /repos/{owner}/{repo}/commits/{ref}/statuses` returns some statuses twice and never returns others. This became visible after go-gitea#36521 made requests without `page` paginated. Clients like Renovate that page until `X-Total-Count` can miss a context's newest status and see a stale `pending`, blocking automerge. Fix: add `index` (unique per commit) as a tiebreaker to the timestamp-based orders. Co-authored-by: silverwind <me@silverwind.io>
silverwind
approved these changes
Oct 1, 2026
silverwind
enabled auto-merge (squash)
October 1, 2026 10:55
bircni
approved these changes
Oct 1, 2026
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.
Backport #39508 by @perfectra1n
Commit status list orders only by
created_unix/updated_unix, which have 1-second resolution while CI often posts many statuses per second. With LIMIT/OFFSET paging, databases (e.g. PostgreSQL using a Sort plan) may order tied rows differently per page, soGET /repos/{owner}/{repo}/commits/{ref}/statusesreturns some statuses twice and never returns others.This became visible after #36521 made requests without
pagepaginated. Clients like Renovate that page untilX-Total-Countcan miss a context's newest status and see a stalepending, blocking automerge.Fix: add
index(unique per commit) as a tiebreaker to the timestamp-based orders.Possibly a candidate for backport to v28.