Feature flags are runtime configuration mechanisms used for gradual feature rollouts, experimentation, and kill switches. Once a feature is fully rolled out, the flag and its gated code become technical debt and can introduce operational risk through inadvertently enabling dormant code paths. At DoorDash, over 56,000 feature flags span 623 repositories, with 1,659 currently stale as of May 2026, with internal estimates of one to two hours per manual cleanup. Existing rule-based cleanup tools proved insufficient in DoorDash's codebases. Our contribution is an end-to-end automated LLM-based feature flag cleanup system that integrates querying live feature flag rollout data using MCP, Jira ticket processing, and end-to-end pull request creation. Our system successfully produced engineer-approved flag removal PRs for 45 (90%) of the 50 stale flags it was evaluated on, proving the system's operational viability at scale with each cleanup averaging only $4.79 and 13.8 minutes. We evaluated the system's quality and reliability boundary based on success rates, cost per cleanup and time metrics. Furthermore, we discuss our lessons learned when architecting this system, to provide practical guidance for developing similar multi-agent systems.
Figures & tables
Fig. 1: System architecture. The orchestrator agent (dashed rectangle) manages the cleanup lifecycle in two phases. In Phase 1, it retrieves stale DVs from Jira, queries the experimentation platform for rollout state, and searches the codebase for all references. The resulting DV report is reviewed by an engineer who confirms target values. In Phase 2, the orchestrator spawns parallel cleanup agents in isolated git worktrees, each editing code, running tests, verifying coverage, and linting before creating a pull request.
Metric
Value
DV cleanups analyzed
50
Accepted (first-shot)
31 (62%)
Accepted with revision
14 (28%)
Failed
5 (10%)
Overall cleanup rate
45/50 (90%)
CI first-pass rate
44/50 (88%)
TABLE I: Evaluation results on 50 stale DVs.
Fig. 2: Cleanup outcomes by complexity level. Simple DVs achieve 100% first-shot acceptance; complex DVs show higher revision and failure rates but still achieve 85% overall cleanup.
Complexity
n
Avg. time
Med. time
Avg. cost
Med. cost
Simple
6
7.5 min
8.2 min
$2.69
$2.50
Medium
18
10.4 min
9.9 min
$3.46
$3.42
Complex
26
17.7 min
14.4 min
$6.20
$4.50
TABLE II: Time and cost by DV complexity.
Fig. 3: Agent cost vs. wall-clock time for each DV, colored by complexity. Failed DVs are marked with × . Simple and medium DVs cluster in the low-cost region; complex DVs show higher variance.