fix(coderd): stop retrying git provider types that have no implementation - #29997
Open
bharadwaj-pendyala wants to merge 1 commit into
Open
bharadwaj-pendyala wants to merge 1 commit into
bharadwaj-pendyala wants to merge 1 commit into
Conversation
…tion Five configured git provider types (bitbucket-cloud, bitbucket-server, azure-devops, azure-devops-entra, gitea) get (nil, nil) from gitprovider.New, so gitsync re-queued every affected chat_diff_statuses row every DiffStatusTTL and the log blamed origin matching. resolveExternalAuth now reports ErrProviderUnimplemented when every matching config names a git type Coder does not implement, and Worker.tick parks those rows for NotImplementedBackoff. A provider that failed to build takes precedence, since an operator can fix that. Closes coder#28141
Contributor
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
This branch has not been deployed
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.
Closes #28141.
Five configured git provider types (
bitbucket-cloud,bitbucket-server,azure-devops,azure-devops-entra,gitea) get(nil, nil)back fromgitprovider.New. Every affectedchat_diff_statusesrow is re-queued everyDiffStatusTTLand never succeeds. The log blames origin matching, sending operators toward a config mistake that isn't there.resolveGitProviderreturned a baregitprovider.Provider, so "no config matched this origin" and "a config matched but Coder doesn't implement its git type" both reachedRefresher.Refreshasnil. The first is operator-fixable; the second needs different retry behavior.ProviderResolvernow returns(gitprovider.Provider, error).resolveExternalAuthreportsgitsync.ErrProviderUnimplementedwhen every matching config names a git type with no implementation, mirroring the existinggitsync.ErrNoTokenAvailableresult from the token resolver.Worker.tickparks those rows forNotImplementedBackoff(24h) in the same branch asErrNoTokenAvailable. No flag or column is added, soMarkStalestill revives a row on the next reported git activity. Backoff writes per affected chat per day go from 720 to 1.Construction errors take precedence over the unimplemented signal. A GitLab config with a bad
APIBaseURLreturnscreate gitlab client: failed to parse base URL; parking that deployment error for a day would hide it. This occurs when two configs match the same origin. The no-match path is unchanged, includingno provider for origin %q.BackoffChatDiffStatusfilters onchat_idalone, so aMarkStalethat lands during a tick can be overwritten by the backoff write. The race already exists forNoTokenBackoffandNoPRBackoff, but 24h increases its wall-clock cost. A compare-and-swap onupdated_atwould close it:UpsertChatDiffStatusReferencebumpsupdated_at(chats.sql:1968), while the backoff query deliberately leaves it unchanged (chats.sql:2297). Fixing that requires changing shared SQL for a race this PR didn't introduce.Editing external auth so the origin matches an implemented provider does not wake a parked row. The operator can wait up to 24h instead of two minutes, and restarting coderd doesn't clear it.
Sabotage checks:
This failure occurs after dropping the
ErrProviderUnimplementedcase fromWorker.tick.This failure occurs after dropping construction-error precedence.
Resolver results for
https://bitbucket.org/acme/apiwith one matching external auth config per type:jfrogis a non-git type, so it keeps the short retry instead of parking.Local golangci-lint is 2.14.0; the repository pins v2.0.2. Under the newer version, the
coderdpackage already has 131 findings onmain, so CI is the real check there.🤖 Built with AI assistance.