fix: retry SQS messages when GitHub API fails after EC2 instance creation#5029
Draft
edersonbrilhante wants to merge 1 commit intogithub-aws-runners:mainfrom
Draft
fix: retry SQS messages when GitHub API fails after EC2 instance creation#5029edersonbrilhante wants to merge 1 commit intogithub-aws-runners:mainfrom
edersonbrilhante wants to merge 1 commit intogithub-aws-runners:mainfrom
Conversation
Contributor
|
This seems similar to #4990, can you please have a look? |
Contributor
Author
|
@Brend-Smits your implementation is so much better than mine. |
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.
Closes #5024
When createStartRunnerConfig fails with a GitHub HTTP error (e.g., 401, 404, 422) after EC2 instances have already been created, the SQS messages are consumed and permanently deleted. The workflow jobs are silently lost — runners can't register, and jobs remain queued in GitHub until they time out (24 hours).
This change introduces GHHttpError, a subclass of ScaleError, that catches Octokit HttpError exceptions in createStartRunnerConfig and wraps them. Because GHHttpError extends ScaleError, the existing ScaleError catch in scaleUpHandler handles it via polymorphism — no changes needed in lambda.ts. Unlike ScaleError (which retries only failedInstanceCount messages), GHHttpError overrides toBatchItemFailures() to retry all messages, since the GitHub API failure affects every instance in the batch.