Repository navigation
ci: keep the token across GitHub API redirects - #2234
Conversation
The oracle marker check intermittently failed with "API rate limit exceeded for <runner IP>" although it sends a token. GitHub answers a request for a renamed repository, such as Devolutions/now-proto, with a redirect, and PowerShell drops the Authorization header when following it, so the request counted against the unauthenticated limit that GitHub-hosted runners share, and a private renamed repository would have been reported unreadable instead of checked. The token is now kept on redirects, which stay on api.github.com. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Evidence: "Check oracle markers" failed with Local check with a valid token against Not fixed here: 46488827382 and 46489939261 failed with Lines changed: production code 0; tests +35; other files (CI script) +20/−4. Note LLM-assisted content (no human feedback). |
There was a problem hiding this comment.
🟡 Changes recommended
The tests bypass the default GitHub API implementation, so removing authorization preservation across redirects could reintroduce rate-limit failures without failing the suite.
1 open issue
What changed in this PR
Keeps oracle-marker checks authenticated across redirects for renamed GitHub repositories, avoiding shared anonymous rate limits and preserving access to private repositories.
Changes:
- Add
-PreserveAuthorizationOnRedirectto the GitHub API request. - Extend the
UNTESTEDcomment with a manual check for renamed repositories.
| File | Description |
|---|---|
ci/check-oracle-markers.ps1 |
Preserve authorization across redirects and update manual verification comments. |
Review effort: Max (adaptive)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The HTTPS-only redirect guard and five-redirect cap lack tests or documented verification, so regressions could expose authorization tokens or permit unbounded redirect loops.
2 open issues
1 resolved since last review
Review effort: Max (adaptive)
| # private repository, so redirects are followed here, and only within api.github.com, the one host given the token. | ||
| # A redirect anywhere else is returned as is, and its status then stops the check. | ||
| $Uri = [uri] "https://api.github.com/$Endpoint" | ||
| for ($Redirects = 0; $true; $Redirects++) { |
| # GitHub redirects a request for a renamed repository to its new API path. | ||
| # Without the token, it would count against the runner's shared unauthenticated rate limit and could not read a | ||
| # private repository, so redirects are followed here, and only within api.github.com, the one host given the token. |



The oracle marker check intermittently failed with "API rate limit exceeded for " although it sends a token. GitHub answers a request for a renamed repository, such as Devolutions/now-proto, with a redirect, and PowerShell drops the Authorization header when following it, so the request counted against the unauthenticated limit that GitHub-hosted runners share, and a private renamed repository would have been reported unreadable instead of checked.
The check now follows redirects itself, with the token, and only within api.github.com, the one host given the token; a redirect anywhere else is not followed, and its status stops the check. Tests check that the API call carries the token, keeps it on a redirect within api.github.com, and stops on one elsewhere.