Repository navigation
fix(core): retry the GitHub Actions OIDC token request on 5xx - #417
Merged
Merged
Conversation
The OIDC token is fetched with a single request, so one 5xx from GitHub's token service fails the whole upload after the screenshots are taken. We saw a 503 on a push to the default branch while GitHub reported no incident and a concurrent build got its token. Retry a 5xx three times with p-retry's default backoff, as apiFetch does for the Argos API. GitHub's @actions/core retries 502, 503 and 504 from this endpoint too. A 4xx still fails at once, since a retry would not change it. Assisted-by: Claude <noreply@anthropic.com>
Throw a p-retry AbortError for a 4xx inside the retried call, so the error message is built once and the non-ok check is not repeated after the retry. Count the mocked token requests with a vi.fn handler, and say in the comment that network failures are retried too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 of 6 tasks
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.
Description
Takes over #416 by @kasperg from a branch in this repository so it can be merged. Their commit is kept as is, with a small cleanup on top.
An upload authenticated with GitHub Actions OIDC fails if GitHub's token service answers a single request with a server error. Kasper hit this on a push to
main: the tests passed, then the upload stopped withFailed to fetch GitHub Actions OIDC token: 503, while GitHub reported no incident and a concurrent pull request build got its token.fetchOidcTokennow retries a 5xx (and a network failure) three times with p-retry's default backoff (1, 2 and 4 seconds), asapiFetchdoes for Argos's own API. GitHub's@actions/corealso retries 502, 503 and 504 from this endpoint. A 4xx is still reported at once, since a retry would not change it. The following exchange with the Argos API already goes throughapiFetch, so this GET was the only request in the OIDC flow without retries.The second commit throws a p-retry
AbortErrorfor a 4xx inside the retried call, so the error is built in one place, and counts the mocked requests in the tests with avi.fnhandler.Type of changes
bugChecklist
Optional checks:
🤖 Generated with Claude Code