---
title: Stale Flags
description: Identify and clean up stale feature flags to reduce flag debt.
breadcrumbs: Docs > Feature Flags > Concepts > Stale Flags
---

# Stale Flags

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com, us2.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site.md). ({% placeholder "user-datadog-site-name" /%}).
{% /alert %}

{% /callout %}

## Overview{% #overview %}

Creating feature flags is straightforward, but decommissioning them is not. Over time, unused or fully rolled-out flags accumulate into **flag debt** that increases cognitive load, complicates code paths, and raises the risk of incidents when stale logic interacts with new code. Datadog automatically detects stale flags, surfaces them in the UI, and provides in-product actions to help you resolve them.

## How Datadog detects stale flags{% #how-datadog-detects-stale-flags %}

A flag is evaluated for staleness only if it is not archived, not marked as permanent, and not tied to a running experiment. A flag is marked `STALE` when any of the following signals are true:

- **Fully rolled out**: The same variant has been served to 100% of traffic in all production environments for the past 30 days. This indicates the flag is behaving like static code and may no longer provide value as a runtime control.
- **No evaluations**: No evaluation events have been recorded for the flag in the past 30 days across all environments. This may indicate that the flag is no longer referenced in your application code.
- **No activity**: The flag has not been modified in the past 30 days across all environments. This may indicate that the rollout has been deprioritized or completed.

**Note**: Evaluation logging is not supported by every SDK, and some customers opt out. As a result, the **No evaluations** signal is a strong but imperfect indicator that a flag is ready to be archived.

## View stale flags in the flag list{% #view-stale-flags-in-the-flag-list %}

The [Feature Flags list page](https://app.datadoghq.com/feature-flags) shows a STALE chip next to each flag that Datadog has identified as stale. Hover over the chip to see which signal triggered it.

- Use the Staleness filter to narrow the list to stale flags only.
- Filter by team to see the flag debt your team is responsible for.

{% image
   source="https://docs.dd-static.net/images/feature_flags/stale_flag_chip.97a982f4faea412e6052cd621160889e.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/feature_flags/stale_flag_chip.97a982f4faea412e6052cd621160889e.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="Feature flag list view showing the STALE chip and staleness filter." /%}

## Review a stale flag{% #review-a-stale-flag %}

When you open a stale flag, a banner at the top of the flag details page explains why the flag is considered stale and recommends actions to resolve it. The banner highlights one **primary suggestion** based on the highest-confidence signal and the lowest-risk action, and provides additional secondary actions.

{% image
   source="https://docs.dd-static.net/images/feature_flags/stale_flag_banner.41e937ede84938868875a2e97d431473.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/feature_flags/stale_flag_banner.41e937ede84938868875a2e97d431473.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="Stale banner on the feature flag details page with recommended actions." /%}

## Manage stale flags{% #manage-stale-flags %}

### Generate a removal PR with Bits{% #generate-a-removal-pr-with-bits %}

From the stale banner, select Generate Removal PR with Bits to open a pull request that removes the flag-gating logic from your application code. This is the recommended action when the flag is fully rolled out and is still receiving evaluation traffic.

**Note**: Remove the flag from your code and deploy the change before you archive the flag. Archiving a flag that is still referenced in code can cause unexpected behavior in your application.

{% image
   source="https://docs.dd-static.net/images/feature_flags/generate_removal_pr.39adf535040c50cd7028da5ab6dfd2fe.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/feature_flags/generate_removal_pr.39adf535040c50cd7028da5ab6dfd2fe.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="Generate Removal PR with Bits modal." /%}

### Archive the flag{% #archive-the-flag %}

Archiving marks the flag as inactive so it is no longer evaluated or editable. Archive a flag after you have removed its references from application code and confirmed it is no longer receiving evaluation traffic. Archiving a flag requires approval and cancels any experiments running on the flag.

### Mark as permanent{% #mark-as-permanent %}

Some flags are intentionally long-lived, such as kill switches or permission gates. Select Mark as Permanent on the stale banner to designate a flag as a permanent operational control and exclude it from future stale detection. Permanent flags show a PERMANENT indicator in the flag details sidebar.

{% image
   source="https://docs.dd-static.net/images/feature_flags/mark_as_permanent.571bc52e563249968c5f5da4776435dd.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/feature_flags/mark_as_permanent.571bc52e563249968c5f5da4776435dd.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="Feature flag marked as PERMANENT on the flag details page." /%}

### Dismiss for 30 days{% #dismiss-for-30-days %}

If a flag is temporarily inactive or cleanup is intentionally deferred, select Dismiss for 30 days to silence the staleness indicator. The flag is re-evaluated for staleness after 30 days, so you do not need to manually reverse the dismissal.

## Permissions{% #permissions %}

The `FeatureFlagConfigWrite` permission is required to mark a flag as permanent. Archiving a flag also requires `FeatureFlagConfigWrite`.

## Further reading{% #further-reading %}

- [Feature Flag History](https://docs.datadoghq.com/feature_flags/concepts/flag_history.md)
- [Variants and Flag Types](https://docs.datadoghq.com/feature_flags/concepts/variants_and_flag_types.md)
- [Learn about Feature Flags](https://docs.datadoghq.com/feature_flags.md)
