Prevent indefinite retries and 404 errors when fetching ADO commits due to parameter bleed and invalid query reuse
When running the Evaluate ADO utility, certain projects return repeated 404 responses on the commits API endpoint:
https://dev.azure.com/<org>/<project>/_apis/git/repositories/<repoId>/commits?%24top=1000&api-version=7.2-preview&status=all
This results in the message:
Received error 404 for the URL ... Retrying in 2 seconds...
Max retries reached (1). Unable to complete the request.
The root cause is that parameters from previous API calls (such as status=all from PR queries) are leaking into subsequent commits requests.
Additionally, the retry logic does not properly handle non-recoverable errors like 404s, causing unnecessary loops and noisy logs.
Root Cause Analysis
-
Parameter bleed: A shared
paramsdictionary is reused across multiple endpoints (get_prs,get_commits,get_branches), and each function mutates the dictionary by adding its own keys. -
Invalid query parameters: The commits API does not accept
status=allor continuation tokens from other endpoints. - Retry behavior: The retry loop treats all HTTP errors equally, retrying 404s and inflating log noise instead of exiting early.
- User experience impact: Causes false positives for missing repositories, longer runtime, and unnecessary API calls.