Blog/SaaS & Startups

Feature Flag Hygiene: Remove Stale Flags Before They Cause Outages

Put owners, expiry dates and a monthly cleanup on every feature flag so toggles stay a safety tool instead of becoming hidden risk.

By Sagar Makker · 6 min read · October 2026
Team Meeting
In short
Every flag needs a type, an owner and an expiry date from the day it is created.
Release flags should be removed within weeks of full rollout, not kept forever.
A monthly review of a flag inventory keeps the count small and the code readable.
The problem

This is for engineering leads and product managers at SaaS companies that adopted feature flags to ship safely and now have dozens nobody fully understands. Old flags make code harder to read, multiply the combinations you never test and occasionally switch off something important by accident. This post shows how to classify flags, assign owners and expiry dates, keep an inventory and run a short monthly cleanup so flags keep doing their job.

An engineer cleaning up configuration turns off a flag called new_checkout_v2, assuming it is leftover from last year. It was, but the old checkout path it guarded had since been deleted, and the flag now controlled whether payments worked for one customer segment. Checkout breaks for those customers for an hour before anyone connects the change to the outage.

Flags are cheap to add and easy to forget. Release toggles, experiments, customer-specific switches and kill switches all live in the same list with similar names. Nobody knows which ones are still needed. Testing covers only the default combination, so the code paths behind rarely used flags quietly rot until someone flips one in production.

Why it happens
01Flags are created without a type, owner or planned removal date
02Release, experiment, permission and kill-switch flags are mixed with no naming rule
03Removing a flag is never part of the definition of done for a feature
04There is no inventory showing which flags are on, off or split for whom
05Tests cover only default flag states, leaving other paths untested
How to fix it
1
Classify every flag by type
The engineering lead defines four types: release, experiment, permission and operational kill switch. Each flag name carries a prefix such as rel_ or perm_, so anyone reading the code knows how long it should live.
2
Require owner and expiry
Whoever creates a flag records an owner and expiry date in the flag tool or a shared register. Release flags might get a few weeks after full rollout, while permission flags are reviewed each quarter.
3
Build a flag inventory
A platform engineer exports all flags with type, owner, created date, current state and last change into one view. Highlight flags past expiry and flags that are fully on or off everywhere.
4
Run a monthly cleanup
In a short monthly meeting, the engineering lead walks through expired flags with owners. Each one is either removed, with the dead code path deleted, or given a justified new date.
5
Add removal to definition of done
The product manager adds a follow-up ticket to remove the release flag whenever a feature ships behind one. The feature is not considered done until that ticket is closed.
Worked example
A project management SaaS cleans up flag sprawl

A project management SaaS in Pune had accumulated many feature flags over three years, and engineers were nervous about touching any of them. The engineering lead exported every flag, tagged each by type and asked the original creator, or their manager, to claim ownership. Flags fully on everywhere for months were removed along with the dead code. New flags now require a prefix, an owner and an expiry date, and a monthly review clears anything overdue. The codebase became easier to read, onboarding new engineers took less explanation, and the team stopped finding surprise behaviour behind toggles nobody remembered.

Common mistakes
×
Turning a flag off instead of removing it
A flag set permanently off still leaves dead code and a risky switch. Delete the flag and the unused code path together in one reviewed change.
×
Using release flags for customer entitlements
Plan features and customer access belong in your billing and permissions model, not temporary toggles. Move long-lived access rules into proper entitlement logic.
×
Letting anyone flip production flags
Unrestricted access causes accidental outages. Limit who can change production flags, log every change, and require a second person for kill switches.
Where an AI agent helps
Input
Flag tool export, code references to each flag and recent change history
Agent does
An agent on XDQ AgentOS lists expired or fully rolled-out flags and drafts removal tickets with code locations
Human gate
Flag owner confirms each removal before a ticket is raised or code is changed
Outcome
Monthly stale flag report and ready-to-review removal tickets
Checklist
Define four flag types with naming prefixes
Record an owner and expiry date for every new flag
Export a full flag inventory into one shared view
Hold a monthly review of expired flags
Add a flag removal ticket to every flagged feature
Restrict and log changes to production flags
What to measure
Total active flags
Flags past their expiry date
Median age of release flags
Incidents linked to a flag change
Questions
How many feature flags is too many?

There is no fixed number. The warning sign is flags nobody can explain or that have been fully on for months. If your inventory has many flags past expiry or without owners, you have more than your team can safely manage.

How long should a release flag stay in the code?

Set your own window, such as a few weeks after full rollout once the feature is stable. After that the flag adds risk without benefit. Remove it along with the old code path.

Should customer-specific features use feature flags?

For a short beta, yes. For permanent differences between plans or customers, model them as entitlements tied to billing and permissions, so they are visible, auditable and not mixed with temporary release toggles.

Do we need a paid feature flag tool?

Not at first. A configuration table with an admin screen and change logging can work. As flag count and team size grow, a dedicated tool helps with targeting, audit logs and inventory. The hygiene rules matter more than the tool.

Keep reading
All posts →
Code CodingSaaS & Startups
Blameless Incident Postmortems That Actually Prevent Repeat Outages
6 min readRead →
Team MeetingSaaS & Startups
API Versioning Strategy for SaaS: Change Without Breaking Customers
7 min readRead →
Coding ProgrammingSaaS & Startups
Zero-Downtime Database Migrations: A Safe Process for SaaS Teams
7 min readRead →
Next step

Want this fixed in your business?

Send the workflow. You get a scope and a fixed price within two working days — or a straight answer that it isn't a fit.

Secure by default · find → fix → verify · authorised scope only
Send a brief →enquiry@xdqlabs.com