HttpRequestor: do not reject credentials on HTTP 400 - #2088
Open
tyrielv wants to merge 1 commit into
Open
Conversation
GVFS erased a valid credential when an object-download response was HTTP 400, which triggered a storm of Git Credential Manager popups. A 400 is a request or formatting problem, not an authentication failure. An expired or invalid credential always returns 401 (Unauthorized) or 302 (the Azure DevOps sign-in redirect), never 400. Treating 400 as an auth failure erased good credentials and produced the misleading "Your PAT may be expired" message. Remove BadRequest (400) from the credential-rejection branch in SendRequest. Only 401 and 302 now reject credentials; 400 flows through the generic, non-auth error path (unchanged retry / circuit-breaker behavior, and 400 remains non-retryable). Extract the decision into ShouldRejectCredentials so it is unit tested: 400 does not reject credentials, while 401 and 302 still do. Assisted-by: Claude Opus 4.8 Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
tyrielv
marked this pull request as ready for review
August 13, 2026 18:35
tyrielv
enabled auto-merge
August 13, 2026 18:35
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
GVFS erased a valid credential when an object-download response was HTTP 400, which triggered a storm of Git Credential Manager popups.
A 400 is a request or formatting problem, not an authentication failure. An expired or invalid credential always returns 401 (Unauthorized) or 302 (the Azure DevOps sign-in redirect), never 400. Treating 400 as an auth failure erased good credentials and showed the misleading "Your PAT may be expired" message.
Change
HttpRequestor.SendRequest, removeBadRequest(400) from the credential-rejection branch. Only 401 and 302 now callRejectCredentials.ShouldRetrynever included it).ShouldRejectCredentials(HttpStatusCode)helper.Why 400 is never an auth failure
Verified against the real Azure DevOps and GVFS cache-server endpoints:
dev.azure.comand the cache server); withoutX-TFS-FedAuthRedirect: Suppress,dev.azure.comreturns a 302 to the sign-in page — so 302 is genuinely auth-related.X-Cache-Nameand a generic gateway body — not an auth problem.Tests
Added
GVFS.UnitTests/Http/HttpRequestorTests.cs:New tests pass (4/4); full unit-test suite passes.