DoorDash hands stale feature flags to a team of agents
DoorDash built a team of AI agents that remove old on/off switches from its code. Engineers approved the result for 45 of 50 switches, at about $5 and 14 minutes each, where a person needs one to two hours.
ContextFeature flags are switches in code that turn a feature on for some users. Once a feature has fully launched, the switch and the code behind it are dead weight.
DoorDash has over 56,000 flags across about 623 repositories; 1,659 were stale in May and about 2,300 new ones appear each month. Rule-based cleanup tools did not fit its code, so the team built a two-phase agent system and wrote it up for the ICSME 2026 industry track.
First, an orchestrator agent reads the cleanup ticket, asks the experimentation platform through MCP which value each flag actually settled on, finds every reference and writes a report. An engineer confirms it. Then one removal agent per flag works in its own git worktree, up to four at once per repository, and must pass build, tests, 95% patch coverage and the linter before it opens a pull request to the flag's owner.
On 50 stale flags, 31 were accepted first time, 14 after small revisions and 5 failed. CI passed on the first attempt for 44, and all six first-time failures were coverage gaps, not wrong code. The figures are the authors' own, from one company's Kotlin repositories.
$4.79average cost per flag removed (authors' figure)
Technical details
The orchestrator runs on Claude Sonnet 4.6 and the removal agents on Claude Opus 4.6: a cheaper model plans, a stronger one edits. Each removal agent deletes the flag definition, its wrapper and call sites, updates tests, then loops on build, tests, JaCoCo patch coverage of at least 95% and Detekt until they pass.
Simple flags succeeded 6 of 6, medium 17 of 18 and complex 22 of 26. Of the revised pull requests, several had missed a dead variable or reference deep in a call chain, which the agent fixed when asked. The authors say early runs without worktree isolation corrupted each other's changes, and that asking production for the real flag value beat letting the agent guess it.
Why it mattersThis is agent work with a clear finish line: a deterministic check list decides when an edit is done, and a person signs off before and after. Most codebases have a backlog of the same shape, such as dead config or deprecated calls.
For youThe same shape fits your SaaS repos and plugin code: one subagent per cleanup task in its own worktree, real state fetched through MCP or a CLI, and build, tests and lint as the gate. Start with deprecated engine API calls in a plugin.
- Feature flags
- Switches in code that turn a feature on or off for some users without a new release.
- orchestrator
- The agent that plans the work and hands pieces of it to other agents.
- MCP
- Model Context Protocol: a standard way for AI agents to discover and call tools and data sources.
- git worktree
- A second working folder for the same repository, so two changes can be made side by side without touching each other.
- patch coverage
- The share of the lines a change touches that the tests actually run.
Sources Paper (arXiv, ICSME 2026 industry track)Full text (HTML)