Repository navigation
Conversation
Post looked for a duplicate only among the 50 newest statuses of the commit. On commits with more than 50 contexts, the latest status of a context is often further back, so an unchanged status was posted again on every reconciliation. Read the combined status instead, which holds the latest status of each context, and page through it until the context is found. Signed-off-by: Steve Lohr <schdief.law@gmail.com> Assisted-by: copilot/claude-opus-5.5
This was referenced Nov 16, 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.
GitHub.Postskips a status when the context's latest status has the same state and description.It looks for that latest status among the commit's 50 newest statuses
(
github.go#L83-L90).That list is the commit's status history, newest first, not one entry per context. On a commit with
more than 50 contexts, the context's latest status is usually further back, the check finds nothing,
and the unchanged status is posted again.
This happens on every interval when many Kustomizations report to one repository:
(
kustomization_controller.go#L171-L187).(
eventkey.go#L35-L42),and the message contains the reconciliation's duration.
Observed with about 200 Kustomizations at
interval: 5mreporting to one repository, so about 200contexts on its head commit: the commit received about 23,000 statuses in 10.5 hours, nearly all of
them repeating the context's previous state and description. At one write per context every
5 minutes, a commit that stays at the head reaches GitHub's limit of 1000 statuses per SHA and
context (docs) after
about 3.5 days. From then on every post for that context fails with 422, including a later failure.
Postnow reads the context's latest status from the combined status(
GET /repos/{owner}/{repo}/commits/{ref}/status),which has one entry per context. It reads 100 per page and follows the pages until it finds the
context. Both endpoints need pull access.
and no write when nothing changed. In the setup above that is 2 reads per event instead of 1 read
and 1 write.
duplicateGithubStatusand the error message are unchanged. A context without a status is posted,as before.
Tests:
TestGitHubPostDuplicateBehindOtherContextsputs the own context on page 2 of the combinedstatus, behind 150 other contexts, with 50 statuses of other contexts on page 1 of the history. Its
unchangedcase fails without this change. The test servers ofTestGitHubWrappedErrorsandTestFactoryHTTPTransportnow answer the combined status endpoint.kustomize-controller's
DisableCommitStatusEventfeature gate also avoids the writes, but it removesthe success status that CI may wait for.
The same approach was proposed in #1387, which its author closed before review. Related: #977. The
GitLab, Gitea and Azure DevOps notifiers also check a single page of statuses; they are not changed
here.