Skip to content

Conversation

henrymercer
Copy link
Contributor

Bulk onboardings sometimes trigger errors due to the CodeQL download being rate limited. Treat these as configuration errors as onboardings should be spread over a longer period of time to avoid rate limiting.

Risk assessment

For internal use only. Please select the risk level of this change:

  • Low risk: Changes are fully under feature flags, or have been fully tested and validated in pre-production environments and are highly observable, or are documentation or test only.

Which use cases does this change impact?

  • Advanced setup - Impacts users who have custom workflows.
  • Default setup - Impacts users who use default setup.
  • Code Scanning - Impacts Code Scanning (i.e. analysis-kinds: code-scanning).
  • Code Quality - Impacts Code Quality (i.e. analysis-kinds: code-quality).
  • GHES - Impacts GitHub Enterprise Server.

How did/will you validate this change?

  • None - I am not validating these changes.

If something goes wrong after this change is released, what are the mitigation and rollback strategies?

  • Rollback - Change can only be disabled by rolling back the release or releasing a new version with a fix.

How will you know if something goes wrong after this change is released?

  • Telemetry - I rely on existing telemetry or have made changes to the telemetry.
    • Alerts - New or existing monitors will trip if something goes wrong with this change.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Consider adding a changelog entry for this change.
  • Confirm the readme and docs have been updated if necessary.

@henrymercer henrymercer requested a review from a team as a code owner October 8, 2025 13:45
@Copilot Copilot AI review requested due to automatic review settings October 8, 2025 13:45
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds error handling to treat HTTP 429 (rate limiting) errors during CodeQL CLI downloads as configuration errors instead of generic errors. This change helps address bulk onboarding scenarios where multiple downloads trigger rate limiting.

  • Added @octokit/request-error dependency to properly handle HTTP request errors
  • Modified error classification in the setupCodeQL function to treat rate limiting as a configuration error
  • Updated TypeScript source with necessary import and error checking logic

Reviewed Changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated no comments.

File Description
src/codeql.ts Added RequestError import and logic to classify HTTP 429 responses as configuration errors
package.json Added @octokit/request-error dependency
lib/*.js Generated JavaScript files containing the compiled TypeScript changes and dependency updates

@henrymercer henrymercer merged commit 6fd4ceb into main Oct 8, 2025
242 checks passed
@henrymercer henrymercer deleted the henrymercer/download-codeql-rate-limit branch October 8, 2025 14:11
e instanceof util.ConfigurationError ||
(e instanceof Error && e.message.includes("ENOSPC")) // out of disk space
(e instanceof Error && e.message.includes("ENOSPC")) || // out of disk space
(e instanceof RequestError && e.status === 429) // rate limited
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer that we just trust the status code, the exact constructor is a bit too precise and big of a dependency to pull in here for my taste

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants