fix: return all SQS messages as batch failures on non-ScaleError exceptions; enable throttle retries#5107
Draft
fix: return all SQS messages as batch failures on non-ScaleError exceptions; enable throttle retries#5107
Conversation
…enable throttle retries - lambda.ts: populate batchItemFailures for non-ScaleError exceptions so SQS retries messages instead of permanently deleting them - auth.ts: return true from onRateLimit and onSecondaryRateLimit handlers so @octokit/plugin-throttling retries rate-limited requests - lambda.test.ts: update tests to expect correct retry behavior and add empty batch edge case test - auth.test.ts: add test for throttle handler configuration Agent-Logs-Url: https://github.com/github-aws-runners/terraform-aws-github-runner/sessions/1d1a46e4-807c-4c6e-864d-50a9c09dd84e Co-authored-by: Brend-Smits <15904543+Brend-Smits@users.noreply.github.com>
Co-authored-by: Brend-Smits <15904543+Brend-Smits@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github-aws-runners/terraform-aws-github-runner/sessions/1d1a46e4-807c-4c6e-864d-50a9c09dd84e Co-authored-by: Brend-Smits <15904543+Brend-Smits@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix scaleUpHandler to prevent silent deletion of SQS batch
fix: return all SQS messages as batch failures on non-ScaleError exceptions; enable throttle retries
Apr 14, 2026
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Snapshot WarningsEnsure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice. Scanned FilesNone |
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
When
scaleUp()throws any non-ScaleErrorexception (SSMThrottlingException, EC2Unavailable, GitHub API errors),scaleUpHandlerreturns an emptybatchItemFailuresarray. SQS interprets this as "all messages processed successfully" and permanently deletes them. Jobs queue indefinitely with no runner assigned and no DLQ routing.Root cause in
lambda.ts: theelsebranch in the catch block never populatesbatchItemFailures:Contributing bug in
auth.ts:onRateLimitandonSecondaryRateLimithandlers don'treturn true, so@octokit/plugin-throttlingaborts immediately instead of retrying — the resulting exception then hits the emptybatchItemFailurespath above.Changes:
lambda.ts: PopulatebatchItemFailureswith all message IDs in the non-ScaleErrorcatch pathauth.ts: Addreturn trueto both throttle handlers to enable retrylambda.test.ts: Update tests to assert correct retry behavior; add empty-batch edge caseTest Plan
batchItemFailures: []for non-ScaleError)ScaleErrorRelated Issues