GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Change waitForProcessing to use exponential backoff by robertbrignull · Pull Request #3937 · github/codeql-action

Conversation

@robertbrignull

@robertbrignull robertbrignull commented May 28, 2026

Copy link
Copy Markdown
Contributor

The goal is to change waitForProcessing to backoff a bit more aggressively and reduce the maximum number of requests that it makes. During periods where analysis processing is being delayed, we're seeing a large number of extra GET requests that I believe are coming from here. See linked internal issue for more info.

In this PR I'm suggesting changing it to exponential backoff that'll make a maximum of 5 requests, instead of the current behaviour which can make up to 24 requests. I also add a wait before the first poll because processing will always take at least a couple of seconds so it's unlikely that an immediate poll will get anything. Let me know if you think this is reasonable. We can also tweak values to keep the maximum timeout to 2 minutes if that would be better.

Risk assessment

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

  • Low risk: Hopefully can be safely tested before merge (either by tests or on a test repository)

Which use cases does this change impact?

Workflow types:

  • Advanced setup - Impacts users who have custom CodeQL workflows.
  • Managed - Impacts users with dynamic workflows (Default Setup, Code Quality, ...).

Products:

  • Code Scanning - The changes impact analyses when analysis-kinds: code-scanning.
  • Code Quality - The changes impact analyses when analysis-kinds: code-quality.
  • Other first-party - The changes impact other first-party analyses.
  • Third-party analyses - The changes affect the upload-sarif action.

Environments:

  • Dotcom - Impacts CodeQL workflows on github.com and/or GitHub Enterprise Cloud with Data Residency.
  • GHES - Impacts CodeQL workflows on GitHub Enterprise Server.

How did/will you validate this change?

  • Test repository - This change will be tested on a test repository before merging.
  • Unit tests - I am depending on unit test coverage (i.e. tests in .test.ts files).
  • End-to-end tests - I am depending on PR checks (i.e. tests in pr-checks).

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.
    • Dashboards - I will watch relevant dashboards for issues after the release. Consider whether this requires this change to be released at a particular time rather than as part of a regular release.
    • Alerts - New or existing monitors will trip if something goes wrong with this change.

Are there any special considerations for merging or releasing this change?

  • No special considerations - This change can be merged at any time.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@robertbrignull
robertbrignull requested a review from a team as a code owner May 28, 2026 09:54
Copilot AI review requested due to automatic review settings May 28, 2026 09:54
Copilot started reviewing on behalf of robertbrignull May 28, 2026 09:54
View session
@github-actions github-actions Bot added the size/XS Should be very easy to review label May 28, 2026
Copilot AI reviewed May 28, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this 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 changes SARIF processing polling to use exponential backoff, reducing request volume during delayed analysis processing.

Changes:

  • Replaces fixed 5-second polling with exponential backoff.
  • Adds an initial delay before the first processing-status request.
  • Limits processing-status polling to 5 intended attempts.
Show a summary per file
File Description
src/upload-lib.ts Updates waitForProcessing polling constants and loop behavior to use exponential backoff.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 2

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/upload-lib.ts Outdated
Comment on lines +922 to +923
statusCheckBackoff *= STATUS_CHECK_BACKOFF_MULTIPLIER;
await util.delay(statusCheckBackoff, { allowProcessExit: false });

@robertbrignull robertbrignull May 28, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I don't think this comment is quite right about the worst case calculations, but it's still a good idea and it would be cleaner to put the timeout check at the end of the loop, instead of doing an extra loop iteration just to break out early.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/upload-lib.ts Outdated
Comment on lines +863 to +868
for (
let statusCheckingCount = 0;
statusCheckingCount <= STATUS_CHECK_MAX_TRIES; // Aborts on the last loop iteration
statusCheckingCount++
) {
if (statusCheckingCount === STATUS_CHECK_MAX_TRIES) {
@github-actions github-actions Bot added size/S Should be easy to review and removed size/XS Should be very easy to review labels May 28, 2026
@robertbrignull
Change waitForProcessing to use exponential backoff
dfc1411
@robertbrignull
robertbrignull force-pushed the robertbrignull/waitForProcessing_backoff branch from e930918 to dfc1411 Compare May 28, 2026 10:15
mbg
mbg previously approved these changes May 28, 2026
View reviewed changes

@mbg mbg left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks for preparing this! The change makes to me as-is and there's nothing blocking here.

We may want to review how well chosen the backoff pattern is, but that's something we can adjust later if needed.

Just one comment about the (potential) delay this imposes on the unit tests.

Also agree with Copilot that it would be nice to have a test that checks that this works as expected.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/upload-lib.ts Outdated
Comment on lines +860 to +861
let statusCheckBackoff = STATUS_CHECK_INITIAL_BACKOFF_MILLISECONDS;
await util.delay(statusCheckBackoff, { allowProcessExit: false });

@mbg mbg May 28, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Minor: I think this also adds a STATUS_CHECK_INITIAL_BACKOFF_MILLISECONDS long delay to tests where we can get a "response" from a stubbed client.request faster. If that is the case, we could either make this initial wait conditional on e.g. the NODE_ENV (like in #3930) or stub util.delay in relevant tests to not wait.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@robertbrignull robertbrignull Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Good point. I think skipping this initial wait during tests makes sense.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@robertbrignull robertbrignull Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Looking more closely, the code from #3930 has now changed and there aren't any other references to NODE_ENV is the codebase. I've changed this PR to use isInTestMode(). Do you think that's the right way to do things?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@robertbrignull

robertbrignull commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

We may want to review how well chosen the backoff pattern is, but that's something we can adjust later if needed.

I don't have any good data on what a good backoff pattern would be. This was just the idea that came to me first. But yes, it's easy to adjust it later on.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@robertbrignull
Only do initial wait when not running tests
d40e417
@robertbrignull
robertbrignull dismissed mbg’s stale review via d40e417 June 1, 2026 15:43
github-advanced-security[bot]
github-advanced-security Bot found potential problems Jun 1, 2026
View reviewed changes
Comment thread src/upload-lib.ts Dismissed

Uh oh!

There was an error while loading. Please reload this page.

henrymercer
henrymercer reviewed Jun 2, 2026
View reviewed changes

@henrymercer henrymercer left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Echoing Michael's review, this looks good. One comment: I think it would be better to use NODE_ENV as you originally implemented vs isInTestMode — the latter is mainly intended for disabling uploading SARIFs to code scanning, and I don't think it's true when we run the unit tests locally or in CI. We can add NODE_ENV to queries/default-setup-environment-variables.ql to suppress the warning, sorry about the noise from that check.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@robertbrignull
robertbrignull force-pushed the robertbrignull/waitForProcessing_backoff branch from b37e12b to d40e417 Compare June 4, 2026 09:24
@robertbrignull

robertbrignull commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

I think it would be better to use NODE_ENV as you originally implemented vs isInTestMode — the latter is mainly intended for disabling uploading SARIFs to code scanning, and I don't think it's true when we run the unit tests locally or in CI.

Thanks for explaining. I'll just remove my last commit.

I looked earlier for the test mode env var and saw lots of cases of CODEQL_ACTION_TEST_MODE: true in workflow files, but you're right it not in the pr-checks workflow file and wouldn't be set locally either.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@robertbrignull
Merge branch 'main' into robertbrignull/waitForProcessing_backoff
6047ac7
henrymercer
henrymercer approved these changes Jun 4, 2026
View reviewed changes
@robertbrignull

robertbrignull commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

I also tested this with an advanced setup workflow in a test repo and everything worked as expected.

henrymercer reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@robertbrignull
robertbrignull added this pull request to the merge queue Jun 4, 2026
Merged via the queue into main with commit cb1a588 Jun 4, 2026
232 of 244 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@robertbrignull
robertbrignull deleted the robertbrignull/waitForProcessing_backoff branch June 4, 2026 10:19
This was referenced Jun 4, 2026
Merge main into releases/v4 #3949
Merged
Merge releases/v4 into releases/v3 #3952
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@henrymercer henrymercer henrymercer approved these changes
@mbg mbg mbg left review comments
+1 more reviewer
@github-advanced-security github-advanced-security[bot] github-advanced-security[bot] left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

size/S Should be easy to review

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@robertbrignull @mbg @henrymercer @github-advanced-security
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.