A guide to understanding AutoClean, Uber's stale feature flag removal system, and adapting its transformation, CI, validation, and review controls.
Feature flags allow for gradually enabling or rolling back functionalities, but their conditional branches can linger in the codebase once a deployment is complete. Uber reports that its AutoClean system has removed more than 16,000 flags and over a million lines of code across its monorepos. In this guide, we break down the workflow described in the InfoQ news item so we can evaluate which controls to port into our own process. This isn't a recipe for running AutoClean: it's a working pattern that requires the right tooling, policies, and code review practices suitable for your repository.
What You Need
Before touching any code, we need a source that identifies flags eligible for removal, a tool capable of applying structural changes, and a continuous integration (CI) process featuring builds and tests. It is also necessary to define what each agent can modify and who will review the outcome. Uber describes the connection to its flag management system and the use of PolyglotPiranha, a structural transformation engine. To integrate tools with agents, their workflow uses the Model Context Protocol; however, that does not eliminate the need to scope permissions.
- A list of flags identified as safe for deletion, reviewed by the owning team.
- Reproducible rules to simplify conditions and propagate constant values.
- CI that runs the relevant checks on every change.
- Clear boundaries for repairers and a designated person responsible for the final review.
Sequence for Preparing a Cleanup
- Select a flag that the management system deems safe to remove. Confirm with the owning team that this decision can move forward to review; do not assume safety just because a branch appears inactive.
- Locate related usages: conditions, parameters, configuration fields, and tests. AutoClean automates this investigation, but the source does not detail a universal algorithm to find every single case.
- Set the definitive value of the flag and first apply any available deterministic transformations. The agent can help propagate the value through calls and conditions, while a structural tool handles simplifications compatible with its rules.
- Submit the change to CI. If the build or tests fail, attempt limited repairs: for example, the test repairer described by Uber can edit tests, but not production code.
- Validate separately that no unexpected additions were made, semantics are preserved, intent hasn't drifted, and no agent artifacts remain. If any check fails, discard the change and only refer it back to the owning team once it passes these controls.


We can summarize this sequence as a flow rather than a list of executable commands. In the described system, structural tools handle deterministic rewrites, and agents help decide how to propagate changes; CI acts as the baseline to check the outcome. The article also notes that subsequent validation considers distinct properties. To read the account from the team that built the tool, check out Uber's explanation of AutoClean.
flag apta para retirar
→ localizar usos
→ transformar con reglas deterministas
→ ejecutar CI
→ reparar dentro de límites
→ validar propiedades por separado
→ revisión humana del equipo propietarioWhat to Review Before Adopting It
The key takeaway isn't that an agent can delete code, but rather how work is divided between automation and controls. If CI fails, the described workflow repeats repairs until the changes pass or an attempt limit is reached. If an independent validation fails, the change is abandoned; it is not forced through just because it cleared a previous stage. The news report does not specify configuration values or universal criteria for choosing flags, so each organization must establish its own for their respective repositories.
When testing this pattern, it's wise to observe how much manual work is saved versus the cost of running CI and reviewing exceptions, as well as verifying that boundaries do not permit out-of-scope changes. The owning team retains the final decision on removal. If you are evaluating agents for production systems, QCon AI Boston showcases decisions and tradeoffs of production AI systems; it can serve as additional context, not as a substitute for validating the workflow in your own environment.
Original source: infoq.com
Article generated with AI.larebelion



Comments (0)
No comments yet. You can be the first.
Write a comment