Skip to main content
GitHub account requiredVega for flag cleanup requires a connected GitHub account to create pull requests. To learn how to connect GitHub, read Connecting Vega to GitHub.
Vega is the LaunchDarkly AI-powered agent. To use Vega, your role requires the Vega actions. To learn more about Vega, including eligibility, pricing, and permissions, read Vega. Vega can help you identify and remove stale feature flags from your codebase. Stale flags accumulate technical debt, and most teams don’t clean them up because the process is manual and error-prone. Vega automates safety checks and code changes, removing the main barriers to keeping flag counts manageable.

How it works

To start a flag cleanup, you can either:
  • Go to the Flags list, click the three-dot overflow menu on any flag, and select Vega cleanup.
The three-dot overflow menu on a flag, with the Vega cleanup option.

The three-dot overflow menu on a flag, with the Vega cleanup option.

  • Or, click a flag in the Flags list, and then click Start cleanup in the Vega cleanup section of the sidebar.
The Vega cleanup section on a flag's detail page, with the Start cleanup link.

The Vega cleanup section on a flag's detail page, with the Start cleanup link.

Either option opens the Flag cleanup modal, which shows a staleness analysis and lets you start the cleanup:
The Flag cleanup modal, showing staleness analysis and the Start cleanup button.

The Flag cleanup modal, showing staleness analysis and the Start cleanup button.

After you start the cleanup, the cleanup job appears on the Previous cleanups tab of the “Flag cleanup” dialog. Vega then checks whether the flag has only a single variation being evaluated across all critical environments, and creates a GitHub pull request to remove the flag from your code.

How Vega determines if a flag is safe to clean up

Vega follows this procedure to determine whether a flag is safe to remove:
  1. Queries your critical environments: Vega identifies all environments marked as critical for your project.
  2. Checks flag evaluations: Vega checks the flag’s evaluations in these environments to confirm that the flag is “stale,” meaning it serves the same variation across all critical environments.
  3. Takes action:
    • If the flag is stale, Vega proceeds with code cleanup and creates a pull request.
    • If the flag is not stale, Vega still proceeds with code cleanup and creates a pull request. It lists the concern as a warning in the pull request description. You decide whether to merge the pull request.

Tracking cleanup status

You can view a flag’s cleanup status in the Vega cleanup section on the flag’s detail page sidebar:
The Vega cleanup section on a flag's detail page.

The Vega cleanup section on a flag's detail page.

When Vega completes a cleanup, it provides a summary including staleness analysis, code changes, and a link to the pull request:
A completed Vega flag cleanup, showing the PR history and Vega's summary.

A completed Vega flag cleanup, showing the PR history and Vega's summary.

To view failed and finished cleanups for all flags in a project, including cleanups started manually, use the “Cleanups” dialog in your project’s Automations settings. This dialog is available when auto-cleanup is turned on for the project. To learn more, read Review and run scheduled cleanups. LaunchDarkly records each flag’s cleanup status. Vega does not add tags to flags during cleanup. However, flags that Vega cleaned up in the past may still have vega-pr-* tags. If Vega has concerns about removing the flag, such as the flag still serving more than one variation across your critical environments, it opens the pull request and lists each concern as a warning in the pull request description. To learn more, read Cleanup warnings. If Vega cannot find the flag in your code repositories, it does not open a pull request.

Identify Vega pull requests

Vega uses the following conventions to identify the pull requests it creates. You can use these to find and monitor them in GitHub:
  • The pull request title begins with the [LaunchDarkly] prefix by default. To change the prefix, update Pull request title prefix in the “Pull request details” section of your project’s Automations settings page.
  • The pull request includes the launchdarkly-pr label. Older pull requests have the vega-pr label instead.
  • Cleanup pull requests also include the flag-cleanup label, and their branch names begin with launchdarkly/flag-cleanup-. Older cleanup pull requests have branch names that begin with vega/flag-cleanup-.
Here is an example GitHub search that shows Vega pull requests in your GitHub organization:
You can also use the launchdarkly-pr label with GitHub’s own notification tools. For example, GitHub’s Slack integration can notify a channel when pull requests are opened in a repository. If Vega finds references to a flag in more than one repository, it opens a separate pull request in each repository. Each pull request description includes a link to the Vega conversation that created it, which means you can trace related pull requests back to the same cleanup.

Automated flag cleanup

In addition to starting cleanups manually, you can have Vega clean up flags on a recurring schedule. Automated flag cleanup runs once a day in each project where you turn it on, starting with the oldest flags that are ready for code removal. You turn it on in the project’s Automations settings. Automated flag cleanup requires the Release Autopilot add-on. To learn how to turn on, review, and turn off automated flag cleanup, read Auto-cleanup.

Supported version control

Vega currently supports GitHub only for creating pull requests. To learn how to connect GitHub, read Connecting Vega to GitHub.