Title: fix(coderd/x/gitsync): stop retrying unimplemented git provider types forever · Issue #28141 · coder/coder · GitHub
Open Graph Title: fix(coderd/x/gitsync): stop retrying unimplemented git provider types forever · Issue #28141 · coder/coder
X Title: fix(coderd/x/gitsync): stop retrying unimplemented git provider types forever · Issue #28141 · coder/coder
Description: Follow-up from #27711 (CRF-14). Problem Five configured git provider types (bitbucket-cloud, bitbucket-server, azure-devops, azure-devops-entra, gitea) get (nil, nil) from gitprovider.New, so gitsync re-queues every affected row every Di...
Open Graph Description: Follow-up from #27711 (CRF-14). Problem Five configured git provider types (bitbucket-cloud, bitbucket-server, azure-devops, azure-devops-entra, gitea) get (nil, nil) from gitprovider.New, so gitsy...
X Description: Follow-up from #27711 (CRF-14). Problem Five configured git provider types (bitbucket-cloud, bitbucket-server, azure-devops, azure-devops-entra, gitea) get (nil, nil) from gitprovider.New, so gitsy...
Opengraph URL: https://github.com/coder/coder/issues/28141
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"fix(coderd/x/gitsync): stop retrying unimplemented git provider types forever","articleBody":"Follow-up from #27711 (CRF-14).\n\n## Problem\n\nFive configured git provider types (bitbucket-cloud, bitbucket-server, azure-devops, azure-devops-entra, gitea) get `(nil, nil)` from `gitprovider.New`, so `gitsync` re-queues every affected row every `DiffStatusTTL` (120s) forever. It logs `\"no provider for origin %q\"` (`coderd/x/gitsync/gitsync.go`, the `provider == nil` branch), blaming origin matching (a config mistake the operator can fix) rather than a missing implementation (which they cannot).\n\nRows are per-chat (`chat_diff_statuses.chat_id` is the primary key), not per-commit. The cost is one DB write per affected chat per 120s, multiplied across deployments. Bitbucket and Azure DevOps are used by real paying customers, so the churn is real.\n\n## Agreed design decisions (from discussion on #27711)\n\n1. **Distinguish \"unimplemented git type\" from \"no matching config.\"** These are two different errors with different root causes. Do not conflate them. A misconfigured origin should keep the current short backoff (the operator can fix it), while an unimplemented type should get a long backoff (nothing to fix until code ships).\n\n2. **Long backoff, not a terminal flag.** Do not add a permanent `unsupported` flag or column. A flag would require `MarkStale` to clear it on revival, which is easy to forget. A long backoff reuses the existing `NoTokenBackoff` pattern and keeps revival free.\n\n3. **Revival is confirmed safe.** `Worker.MarkStale` (`coderd/x/gitsync/worker.go`) resets `stale_at` to the past unconditionally via `markStaleSingle` whenever the agent reports git activity. So a row parked with a long backoff is revived by new commits regardless of the backoff duration. Verified by tracing, not guessing.\n\n4. **Migration bump for new providers.** When a provider implementation ships (e.g. bitbucket), the accompanying database migration should reset `stale_at` on the parked rows so they all wake at once. This makes even a very long backoff safe: shipping the implementation ships the wake-up.\n\n## Shape of the fix\n\nThe distinction is currently collapsed at two layers:\n\n- `resolveGitProvider(ctx, origin)` returns a bare `gitprovider.Provider`. A `nil` conflates \"origin matched no config\" and \"matched a config but the git type is unimplemented.\" `ProviderResolver` is `func(ctx, origin) gitprovider.Provider`, a single return value with no room to carry the reason.\n- `Config.Git()` deliberately returns `(nil, nil)` for unimplemented types (see CRF-13 and the doc comment in `coderd/externalauth/externalauth.go`). Callers cannot distinguish the two cases from the return values.\n\nSo the fix needs to:\n\n1. Signal three states from the resolver: matched+implemented, matched+unimplemented, no-match. Change `ProviderResolver` to return an error, or add a parallel \"is this origin's provider implemented\" check.\n2. Introduce a sentinel such as `ErrProviderUnimplemented` and propagate it from `resolveGitProvider` through `Refresher.Refresh` into the worker's backoff branch (the block next to `ErrNoTokenAvailable` in `Worker.tick`).\n3. Add a long backoff constant (e.g. `NotImplementedBackoff`) and apply it when the error matches.\n4. `TestWorker_NoTokenBackoff` (`coderd/x/gitsync/worker_test.go`) is the template for the backoff test.\n\n## Estimate\n\nAbout 150-200 lines including tests. Roughly 40 production lines across `coderd/exp_chats.go` (resolver) and `coderd/x/gitsync/gitsync.go` / `worker.go` (type change, propagation, backoff), plus about 100-120 lines of tests. Contained to `coderd/x/gitsync` and `coderd/exp_chats.go`. No DB migration is needed for the fix itself; the wake-up migration ships with each future provider implementation.\n\n> 🤖 Generated by Coder Agents on behalf of @johnstcn.","author":{"url":"https://github.com/johnstcn","@type":"Person","name":"johnstcn"},"datePublished":"2026-08-13T17:37:01Z","url":"https://github.com/coder/coder/issues/28141"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d1eb6f1f-ff8c-4385-9995-72c55e6ce058 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DF94:179D40:1217FF:189B5D:6B044E77 |
| html-safe-nonce | a79312b226734367b5f2f8e1d60e3c57b8c80e611d26111ebd3794261430d740 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERjk0OjE3OUQ0MDoxMjE3RkY6MTg5QjVEOjZCMDQ0RTc3IiwidmlzaXRvcl9pZCI6IjM5Njc2OTY2Njk2NTA0NzI1NjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 1cc05b7ce2b77534b68c8bab263c08f32adb02dc9d98f2185bd01d7838babf33 |
| hovercard-subject-tag | issue:5144128977 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/coder/coder/28141/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1069853d028887a505638d07e13dc3992a23198148be8e53efa618b8d1622d59/coder/coder/issues/28141 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1069853d028887a505638d07e13dc3992a23198148be8e53efa618b8d1622d59/coder/coder/issues/28141 |
| og:image:alt | Follow-up from #27711 (CRF-14). Problem Five configured git provider types (bitbucket-cloud, bitbucket-server, azure-devops, azure-devops-entra, gitea) get (nil, nil) from gitprovider.New, so gitsy... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | johnstcn |
| hostname | github.com |
| expected-hostname | github.com |
| None | 002aa6b95ffa730b0aec436a5c383f536ad677284e60056037fb120afe37b730 |
| turbo-cache-control | no-preview |
| go-import | github.com/coder/coder git https://github.com/coder/coder.git |
| octolytics-dimension-user_id | 95932066 |
| octolytics-dimension-user_login | coder |
| octolytics-dimension-repository_id | 440752086 |
| octolytics-dimension-repository_nwo | coder/coder |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 440752086 |
| octolytics-dimension-repository_network_root_nwo | coder/coder |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 059f24c781e3a0d7df3f27a97da0e93fab06ae39 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width