Repository navigation
Know when a provider credential stops working - #2126
Merged
Merged
Conversation
ppXD
force-pushed
the
fix/know-when-a-provider-credential-stops-working
branch
from
October 18, 2026 12:07
b58f9d8 to
acfeec3
Compare
ppXD
force-pushed
the
fix/send-gitlab-the-right-auth-on-the-right-host
branch
from
October 18, 2026 12:09
0afe394 to
cd25e9d
Compare
ppXD
changed the base branch from
fix/send-gitlab-the-right-auth-on-the-right-host
to
main
October 18, 2026 12:09
A credential whose provider had refused it for good stayed Active with nothing to say why: a dead OAuth refresh token was re-presented by every run and webhook and failed as a string, an expired or revoked GitLab token read as Connected, a 401 on an access token GitLab had retired early was never recovered, and a failed members lookup refused the author's own merge request as if they were a stranger. Credential health is now carried by the existing columns. A refresh the provider refuses for the grant or the client (invalid_grant and its kin, not a 5xx or a malformed answer) marks the credential Error with "needs reconnect: <error>" over the row it judged, and fails with the typed credential_needs_reconnect naming it; the resolver fails fast on an Error credential and a successful refresh or probe lifts it. A 401 to an OAuth credential is sent once more with the token another caller already stored, or after one rotation (not again within a minute), by NGitLab and every raw call; a write through the typed client that opens a call is repeated by the provider once the refusal has put the replacement on the credential. A recurring probe asks each provider about a bounded batch of credentials: it validates what GitLab accepts and records a static token's real expiry (also when a token is linked or added), marks only a definite 401, and re-asks an Error credential after an hour so it can heal. The members lookup throws instead of answering Unknown, retries a 429 or 5xx once, and admission refuses with credential_rejected or author_standing_unknown naming the status and the scope needed. CredentialSummary gains a derived health and the days to expiry. A provider that stops answering cannot hold the sweep: the identity call is asynchronous and honours its deadline, a probe that ignores its token is walked away from at the probe deadline, a pass ends at a budget under the tick interval, and a tick that finds the previous pass still running skips. Reconnecting beside a credential its provider refused, by OAuth, token link or the credentials API, carries its repositories and group hooks to the new credential as a disconnect's reconnect does, and the repair sweep applies the same rule to what an older pod left behind. A pair a process kept because it could not store it is stored before the fail-fast applies, so another process's refusal of the consumed refresh token cannot strand it. An OAuth credential marked Error is asked again on use once an hour has passed, so a grant that heals recovers without waiting for the sweep. No migration: status Error and last_error already exist.
ppXD
force-pushed
the
fix/know-when-a-provider-credential-stops-working
branch
from
October 18, 2026 12:10
acfeec3 to
9f5155d
Compare
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.
Summary
credential_needs_reconnect; a successful refresh or probe lifts it. A 401 on an access token GitLab retired early is retried once with the token another caller stored (or after one rotation), by NGitLab, the raw calls, and the provider's typed writes.CredentialSummarygains a derived health and the days to expiry.credential_rejectedorauthor_standing_unknownnaming the status and the scope needed.No migration:
statusError andlast_erroralready exist. Adding a token throughPOST /api/credentials/pator/group-access-tokennow asks the provider about it (bounded by the 30 s probe deadline); a provider that cannot be reached, is silent or refuses the token leaves the credential added as before and due for the sweep.Test plan
StoreKeptPairAsync, GitLab probe deadline / retry / refusal classification, typed-write resend matrix, pinned deadlines and lock key)expiringat once; the three tests that asserted no provider traffic after seeding now count from after the seedcredential-health-probefor "ran out of its budget" and "previous pass is still running" warnings after deploy