# Why AI-generated code passes review and breaks in production

URL: https://dailymind.eu/agent-ops/ai-generated-code-production-incidents/

**Short answer:** Review checks what code says; production tests what it does. AI-generated code is usually tidy, plausible, and wrong about things a reviewer cannot see in a diff: real data shapes, concurrency, retries, timeouts, permissions, and failure paths. You catch it with gates that exercise behaviour, such as tests on real schemas, staged rollouts, observability, and fast rollback, not with more reading.

## What the data says

In a June 2026 New Relic survey of 200 US technology decision-makers, 82% had at least one production failure tied to AI-generated code in the previous six months, and 78% reported more production incidents once AI-generated code shipped. 86% said senior engineers now spend more time fixing code.

The same respondents gave AI-generated code higher marks at review: 94% rated it as good as or better than human-written code at that stage. That gap between review and production is the problem to solve.

## Where AI-generated code breaks

- Hidden data assumptions: nulls, empty sets, encodings, time zones, and old records that never appear in examples.
- Missing failure handling: timeouts, retries without idempotency, partial writes, and queue messages processed twice.
- Concurrency: missing row locks, race conditions, and background jobs that overlap.
- Dependency drift: outdated or invented API parameters, wrong SDK versions, and deprecated endpoints.
- Silent green checks: tests and quality queries that cannot fail. One real example is a LEFT JOIN check whose filter removed exactly the missing rows it was meant to detect.
- Configuration and secrets: hard-coded keys, debug flags left on, and permissions wider than needed.

## How to catch it before release

- Run tests against real schemas and production-like data, including empty, malformed, and historical cases.
- Make every check able to fail: seed a known-bad case and confirm the check catches it.
- Ship behind staged rollouts or feature flags, with a rollback that takes minutes, not a new deploy.
- Instrument new code paths with metrics, traces, and error tracking before they take traffic.
- Track change failure rate and time to restore for AI-assisted changes separately, so you know whether the process is working.

## How DailyMind helps

We start with a fixed-scope readiness review of how your AI-assisted code reaches production, and hand you a ranked list of reliability, security, cost, and evidence gaps. Then we add the missing gates with your team and, if you want, run the operations with you until your engineers own them.

## Frequently asked questions

**Is AI-generated code worse than human-written code?** Not necessarily line by line. The risk comes from volume and trust: more code ships faster through the same review capacity, and reviewers tend to rate it highly. Behavioural gates matter more than who wrote the code.

**Will more code review fix it?** Only partly. Most failures come from runtime conditions a diff does not show. Tests on real data, staged rollouts, and observability catch what review misses.

**What should we measure?** Change failure rate, time to restore service, and incidents per release, split by AI-assisted versus other changes. If AI-assisted changes fail more often, tighten the gates for them.

## Sources

- [New Relic, State of AI Coding 2026 (press release, 10 June 2026)](https://newrelic.com/press-release/20260610)

Author: Katerina Bletsch, DailyMind LTD. Updated 2026-10-24. Contact: https://dailymind.eu/contact/
