A Peer-Reviewed Paper Says AI Repair of Infrastructure Code Sometimes Breaks Passing Security Checks

A paper in the ESEM 2026 proceedings followed AI models as they repaired code that manages cloud infrastructure, round after round. The repairs sometimes broke security checks that had been passing, and a score that records only the best result so far hides it.

An AI model writes some code. A checking tool finds what is wrong with it. The errors go back to the model, and it tries again.

A peer-reviewed paper in the proceedings of ESEM 2026, a software engineering symposium, calls that loop the dominant way to improve AI-generated infrastructure as code, the code that manages cloud infrastructure. Its two authors, at Colorado State University, asked what the loop does to the security checks that were already passing.

Sometimes it breaks them.

Illustration

The Score That Could Only Go Up

Earlier work on these loops, the paper says, reported a cumulative best: the highest compliance reached so far. That kind of score cannot fall. It rises or stays level, by construction. So it may mask what happens from one round to the next.

In the paper's own data, the best-so-far pass rate climbs across the rounds. The raw pass rate dips a little at the fifth repair iteration.

A score that can only go up says nothing about the round that went backwards.

Two Ways to Count a Failure

The authors followed 5,968 scenario timelines. Each is one scenario, run through one setup, for up to five repair iterations. They call it a regression when a security check passes in one iteration and fails in the next.

They counted in two ways. Under standard detection, 13.8% of scenarios showed at least one regression. That count includes a check that fails for one resource in the code while still passing for another.

Strict detection counts only a check that passed outright and then failed outright. Under it, the rate is 3.3% of scenarios.

The authors call the strict figure the conservative, defensible rate, and say it should be read as an order-of-magnitude estimate. They call the standard figure an inclusive upper bound. Strict detection has its own blind spot, they add. It can miss a real degradation that affects only some of a configuration's resources. So they recommend reporting both.

What Broke, What Came Back and When to Stop

The paper's automated classifier put 79.0% of the standard-mode regression steps down to resource restructuring. The model adds, removes or renames resource blocks while fixing validation errors, and the restructured code loses security configurations from the iteration before. That classifier was not validated against human judgment.

Some of the damage undoes itself. Of the standard-mode regressions, 36.6% corrected themselves in a later iteration of the same timeline. But 28.5% of all scenarios had checks that oscillate: they pass, fail and pass again, or the reverse.

The paper also looks for a place to stop. It calls the third repair iteration the best trade-off between compliance and regressions, and says tools should not blindly iterate to convergence. That stopping point, the authors note, rests on a subjective threshold.

The Limits of the Study

Each setup was run once, so the authors say run-to-run variance is unquantified. Security was measured with a static checking tool, which they call a proxy, and not on deployed systems. Their results are specific to one infrastructure tool and one validator, and their dataset covers one cloud provider.

The two AI models were publicly available in December 2024. The authors say more recent or reasoning-oriented models may restructure less aggressively or preserve passing checks more reliably, and that replication with newer models is needed.

What the data does support, they write, is a qualitative claim. This kind of repair sometimes degrades a security check that was passing, the effect is not negligible, and cumulative-best reporting "hides it entirely."

If a repair loop reports only its best score, who sees the rounds in between?