Skip to content

Determine the overlay minimum disk space requirement from feature flags - #4080

Draft
henrymercer wants to merge 5 commits into
mainfrom
henrymercer/studious-giggle
Draft

Determine the overlay minimum disk space requirement from feature flags#4080
henrymercer wants to merge 5 commits into
mainfrom
henrymercer/studious-giggle

Conversation

@henrymercer

Copy link
Copy Markdown
Contributor

Overlay analysis skips runners that don't have enough free disk space. Until now that threshold was a single hard-coded value with one flag-gated alternative: 20 GB normally, or 14 GB when overlay_analysis_resource_checks_v2 was enabled. That gave us exactly one step to roll out, and reaching a lower limit meant another flag and another release.

This replaces that with a set of flags that each name a threshold, so we can tune the requirement without shipping code:

  • overlay_analysis_min_disk_8_gb
  • overlay_analysis_min_disk_9_gb
  • overlay_analysis_min_disk_10_gb
  • overlay_analysis_min_disk_11_gb
  • overlay_analysis_min_disk_12_gb
  • overlay_analysis_min_disk_13_gb

When several are enabled the lowest threshold wins, so we can roll a lower limit out to a subset of repositories without having to disable the flag above it first. When none are enabled the default of 14 GB applies.

overlay_analysis_resource_checks_v2 is removed and its 14 GB value becomes the unconditional baseline, so the 20 GB limit is gone. Note that this part is not itself behind a flag — anyone previously on the 20 GB path moves to 14 GB when this ships. On GHES that only affects users who have explicitly opted into overlay analysis via CODEQL_ACTION_OVERLAY_ANALYSIS, since overlay_analysis defaults to off there. Anyone setting CODEQL_ACTION_OVERLAY_ANALYSIS_RESOURCE_CHECKS_V2 will find it no longer has any effect.

Thresholds stay in decimal MB (N * 1000 MB), matching the existing bytes-per-MB convention in the disk check, so the effective byte values are unchanged from the previous 14 GB path. The check also now logs the available and required space at debug level when it passes, so it's possible to tell from a run log which flag took effect.

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?

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.

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?

  • Unit tests - I am depending on unit test coverage (i.e. tests in .test.ts files).

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

  • Feature flags - Lowering the threshold below the 14 GB default is fully controlled by the new feature flags and can be reverted by disabling them.
  • Rollback - The change of the default threshold from 20 GB to 14 GB is not behind a feature flag, and would need a rollback or a follow-up release to revert. Overlay analysis as a whole can still be disabled via the overlay_analysis feature flag, the CODEQL_OVERLAY_DATABASE_MODE environment variable, or the disable-overlay repository property.

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

  • Telemetry - I rely on existing telemetry.
    • Dashboards - I will watch relevant dashboards for issues after the release.

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

  • Special considerations - The six new feature flags need to exist before this is released, otherwise the threshold stays at the 14 GB default.

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 balanced review from Copilot August 6, 2026 15:31
@github-actions github-actions Bot added the size/M Should be of average difficulty to review label Aug 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Warning

  • Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.

Pull request overview

This PR makes overlay-analysis disk requirements configurable through feature flags, with a new 14 GB baseline and lower thresholds from 8–13 GB.

Changes:

  • Adds six minimum-disk feature flags and removes the previous v2 resource-check flag.
  • Selects the lowest enabled threshold and adds successful-check debug logging.
  • Expands overlay enablement tests for default, lowered, and combined thresholds.
Show a summary per file
File Description
src/feature-flags.ts Defines and configures the new disk-threshold flags.
src/config-utils.ts Computes and applies the effective disk threshold.
src/config-utils.test.ts Tests default and feature-controlled disk limits.
lib/entry-points.js Generated JavaScript artifact; excluded from review by policy.

Review details

Files excluded by content exclusion policy (1)
  • lib/entry-points.js
  • Files reviewed: 3/4 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread src/config-utils.ts Outdated
Comment thread src/config-utils.ts
henrymercer and others added 3 commits August 6, 2026 16:38
Add six feature flags, overlay_analysis_min_disk_8_gb through
overlay_analysis_min_disk_13_gb, which will be used to control the
amount of available disk space that overlay analysis requires.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Overlay analysis required 20 GB of available disk space, lowered to
14 GB when overlay_analysis_resource_checks_v2 was enabled. That gave
us a single step to roll out, and any further reduction needed another
flag and another release.

Determine the threshold from the new overlay_analysis_min_disk_N_gb
flags instead, taking the lowest one that is enabled so that a lower
limit can be rolled out to a subset of repositories without first
disabling the flag above it. When none are enabled, the 14 GB limit
now applies unconditionally, replacing the 20 GB default.

Thresholds remain in decimal MB, matching the bytes-per-MB convention
the disk check already used, so the effective byte values are unchanged
from the previous 14 GB path. Also log the available and required space
at debug level when the check passes, so that run logs show which
threshold took effect.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The flag no longer has any effect now that its 14 GB threshold is the
unconditional default, so remove it. Setting
CODEQL_ACTION_OVERLAY_ANALYSIS_RESOURCE_CHECKS_V2 no longer does
anything.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@henrymercer
henrymercer force-pushed the henrymercer/studious-giggle branch from 49e5f70 to 99caaa8 Compare August 6, 2026 15:38
henrymercer and others added 2 commits August 6, 2026 16:41
Say "at or above" in the debug message logged when the check passes,
since the comparison accepts exactly the minimum.

Check each feature flag against the threshold its name declares, rather
than only exercising a few of them, so that a mistake in one of the
mappings cannot go unnoticed. Both sides of the boundary are needed to
pin a threshold down: a mapping to a lower value would still pass the
case at the limit, and one to a higher value would still fail the case
below it.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The comparison accepts exactly the minimum, so say "at or above", to
match the wording of the disk space check.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@henrymercer
henrymercer requested a balanced review from Copilot August 6, 2026 16:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@henrymercer
henrymercer requested a balanced review from Copilot August 6, 2026 16:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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

Labels

size/M Should be of average difficulty to review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants