futuctual.it

TLDR; of actual future news

Softwarefutuctual.it

Uber removes 1M lines of stale code with AI system

AutoClean uses agents and strict validation to clean up feature flag residue across monorepos without human intervention until final review.

Uber removes 1M lines of stale code with AI system

Uber has deployed a new AI-driven cleanup tool called AutoClean that has successfully removed more than 1 million lines of stale code and over 16,000 unused feature flags from its internal codebases. The system operates on Uber's monorepo architecture by combining artificial intelligence agents with deterministic code transformations, continuous integration (CI) pipelines, and independent validation layers to prepare changes for human approval.

Feature flags are essential tools that allow development teams to gradually enable new functionality or quickly roll back changes if issues arise. However, once a feature is fully deployed, the conditional branches, configuration fields, function parameters, and tests associated with those flags often remain in the codebase as residue. Uber notes that this leftover code complicates ongoing maintenance and testing while forcing AI agents to inspect unnecessary logic when working on related tasks.

The AutoClean system connects directly to Uber's feature flag management platform to identify which flags are safe to remove. Its cleanup agent then searches through the code, edits it using PolyglotPiranha—Uber's structural code transformation engine—and operates via the Model Context Protocol. During this process, the agent replaces a flag with its permanent value and traces that value through all callers, parameters, and conditionals to ensure accuracy.

Uber describes how the system divides labor between traditional tools and AI capabilities:

Static tools handle deterministic rewrites well; AI is most useful for propagation decisions.

In this workflow, PolyglotPiranha takes charge of boolean and conditional simplification deterministically, rather than leaving potentially behavior-changing rewrites entirely to the language model.

The resulting code changes enter Uber's continuous integration pipeline. When builds or tests fail, AutoClean automatically routes these failures through specialized fixers that attempt deterministic repairs before resorting to agent-based solutions. These fixers have strictly restricted scopes; for example, a test fixer can only edit test files and cannot touch production code. Uber explains this restriction prevents an agent from making a failing test pass by altering the actual behavior the test was designed to verify. The system repeats the repair and CI cycle until the change passes or reaches its attempt limit, with Uber describing CI as the source of truth for any modification.

CI success is not considered the final safety check. After AutoClean completes its work, it runs static checks followed by CodeCourt, an agentic validation layer that employs separate reviewers to inspect specific properties such as no additions, semantic preservation, no intent drift, and no leftover agent artifacts. Each reviewer examines one property independently. If any single check fails, the change is abandoned; only changes that pass all validations are sent to the owning team for human review.

Muhammad Ali Akbar, a software engineer at Uber, shared his perspective on the approach:

The CI-as-source-of-truth part is what sold me.

Deepanshu Udhwani, another software engineer, highlighted the nuance between passing tests and maintaining scope integrity:

No intent drift is a different check than no regression.

Uber maintains that a human reviewer makes the final decision on whether a flag is ready to be removed. AutoClean handles the investigation, rewrite, repair, and validation stages automatically, while leaving the ultimate approval with the team responsible for the code.

More news