Auto-Cleanup

What is auto-cleanup?

Once a flag reaches 100% rollout and remains stable (meaning no elevated error rates), DeployRamp marks it for cleanup. A coding agent then opens a pull request that removes the flag wrapper and its fallback branch from your codebase. This prevents flag debt: no stale toggles accumulating over time.

How the cleanup PR works

The cleanup PR removes the flag() call and its else branch, leaving only the new code path inline. The PR follows the same review process as any other pull request; your team reviews, approves, and merges it just like normal code changes.

Stability window

You can configure the stability window: how long a flag must remain at 100% rollout with healthy error rates before cleanup triggers. A shorter window means faster cleanup; a longer window gives you more confidence that the code is truly stable. The default is configurable per project in the dashboard.

Flag lifecycle

The full lifecycle of a DeployRamp feature flag:

  1. Flag created: either automatically by the AI when it detects risky code in a PR, or manually from the dashboard.
  2. Rollout: the flag ramps up through staged percentages (e.g. 5% → 25% → 50% → 100%), pausing or rolling back if errors spike.
  3. Stable at 100%: all users are on the new path and error rates are normal for the configured stability window.
  4. Cleanup PR: a coding agent opens a PR to remove the flag wrapper and fallback code.
  5. Flag removed: after the cleanup PR is merged, the flag is archived and the code is clean.

This end-to-end automation means flags are a temporary safety net, not permanent technical debt.

We use cookies to analyze site usage and improve your experience.