arXiv:2610.31351cs.SEOct 2026

Manuscript Offprint

arXiv:2610.31351

Automating Feature Flag Cleanup at Scale with Multi-Agent LLM Systems: An Industrial Experience at DoorDash

Atharv Chandratre, Jai Datar

Atharv Chandratre

DoorDash, Inc.

San Francisco, CA, USA

atharv.chandratre@doordash.com

Jai Datar

DoorDash, Inc.

San Francisco, CA, USA

jai.datar@doordash.com

Abstract—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.

I. INTRODUCTION

Feature flags (also known as feature toggles) are a fundamental practice in modern software delivery, enabling safe gradual rollouts, A/B testing, and kill switches [1]–[3]. However, once a feature flag has been fully rolled out, the flag becomes stale. Its conditional logic no longer serves a purpose and constitutes technical debt. Stale flags also pose a direct operational risk: they preserve dormant code paths that can be inadvertently reactivated. In one well-documented incident, a trading firm repurposed a stale feature flag during deployment, triggering $460M in unintended trades within 45 minutes [4]. Despite these risks, prior work has found that approximately 25% of feature flags persist for over eight years in open-source projects [2], and practitioners consistently report that flag cleanup is burdensome and frequently deferred [3], [5].

At DoorDash, the problem manifests at a significantly large scale. Our experimentation platform manages over 56,000 Dynamic Values (DVs), the company's feature flag abstraction, across approximately 623 repositories, with 1,659 currently stale. Approximately 2,300 new DVs are created every month. With internal estimates of one to two hours per manual cleanup, the backlog grows faster than teams can address it.

Throughout this paper, we will be using the abbreviation DV to refer to Dynamic Values, the term for feature flags at DoorDash.

The most prominent automated approach, Piranha [6] and its polyglot successor [7], simplifies conditional expressions by matching AST patterns. As we detail in Section II-A and quantify in Section II-B, DoorDash's dependency-injected wrapper pattern, non-boolean DVs, and cross-file cleanup requirements make these tools structurally inapplicable in our setting.

To address these challenges, we designed and deployed a multi-agent LLM system built on Google ADK [8] that automates the full lifecycle of feature flag cleanup at DoorDash. An orchestrator agent analyzes each stale flag, queries the experimentation platform for its live production rollout state via MCP (Model Context Protocol) [9], and formulates a cleanup strategy. It then spawns specialized removal agents that execute code changes in parallel, each operating in an isolated git worktree [10] to prevent interference between concurrent cleanups. The pipeline autonomously handles Jira ticket processing, code modification, test validation, and pull request creation, producing merge-ready PRs requiring zero manual intervention between the initial engineer confirming the inferred target value and final PR creation.

Our contributions are:

  • The design and deployment of a multi-agent architecture at scale for feature flag cleanup, where an orchestrator coordinates parallel removal agents operating in isolated git worktrees.

  • An end-to-end automated pipeline performed by each cleanup agent that autonomously bridges issue tracking, querying the experimentation platform using MCP, code modification, test validation, and pull request creation for every stale feature flag.

  • A detailed industrial evaluation of our LLM-based feature flag cleanup system, reporting success rates, cost, time, complexity breakdown, and failure analysis, along with an analysis of why rule-based tools such as Piranha do not

Accepted for publication in the 2026 IEEE International Conference on Software Maintenance and Evolution (ICSME), Industry Track.

© 2026 IEEE. Personal use of this material is permitted. Permission from IEEE must be obtained for all other uses, in any current or future media, including reprinting/republishing this material for advertising or promotional purposes, creating new collective works, for resale or redistribution to servers or lists, or reuse of any copyrighted component of this work in other works.

Listing 1. Example three-layer DV access pattern (simplified). // Layer 1: RuntimeKeys.kt - string constant object RuntimeKeys { const val ENABLE_X = "enable_feature_x" } // Layer 2: FeatureFlags.kt - wrapper function @Singleton class FeatureFlags @Inject constructor( private val dvClient: DynamicValuesClient ) { fun shouldEnableX(userId: String): Boolean = dvClient.getBoolean(ENABLE_X, withContext("user_id" to userId), false) } // Layer 3: Business logic - usage via DI class MyService @Inject constructor( private val featureFlags: FeatureFlags ) { fun process(userId: String) { if (featureFlags.shouldEnableX(userId)) { handleNewPath() } else { handleOldPath() } } }

apply to DoorDash's DV access pattern (Section II-A). This evidence is absent from literature we reviewed [11]–[16].