What a rollback plan looks like for AI-written features

AI-generated code is production ready when it has passed tests written from the specification, a review of the parts no check can judge, security scans that block the merge, and one more thing that this post is about: a way to turn the feature off and undo what it did once it is live. Reveneau writes all of its code with AI and releases a change only when it passes an eval suite written from the specification, and the rollback plan is the part of that discipline this post covers.
"We can just roll it back" is said often and tested seldom. Reverting the code is the easy half. One command, and it works. That part has been solved for twenty years.
What causes the problems is everything the feature did while it was live. Rows it wrote in a format the previous version cannot read. Emails it sent. Webhooks that other companies' systems have already processed and will not process again. A cache full of values computed under the new logic. A migration that dropped a column and is now the reason the old code will not start.
The code can be reverted. Its effects stay. A rollback plan that only addresses the first half is a plan for the easy half.
How do I make AI-generated code production ready?
Run it through the same gates as any other change, plus two that generated code needs more than hand-written code: a check that every package it names exists, and a way to turn the feature off once it is live. The table gives the gates, what each one catches in generated code, and where the rule comes from. The first five are covered in detail in how many tests AI-generated code needs, why AI-generated code fails code review and what good code review looks like. The last row is the rest of this post.
| Gate | What it catches in generated code | Where the rule comes from |
|---|---|---|
| Tests written from the specification, before the code | Code that passes the tests the model wrote for itself and fails the requirement. OWASP lists test fabrication and test deletion as a risk of its own and says: "Write security-critical tests manually for authentication, authorization, input validation, and cryptographic operations." | OWASP Secure Coding with AI cheat sheet, read 21 November 2026 |
| A reviewer's approval for the parts no check can judge | Access rules and business logic that look right and are wrong. OWASP: "Require explicit developer approval before merging any AI-generated code." | OWASP, same page |
| A check on every package the model names | Packages that do not exist, whose names an attacker can register. OWASP: "Verify every AI-suggested package exists on the public registry before installing." | OWASP, same page |
| Secrets kept out of the code | Keys and passwords the model writes into source. OpenSSF: "Never include API keys, passwords, or secrets in code output." | OpenSSF guide for AI code assistant instructions, 1 August 2025, read 21 November 2026 |
| Static analysis and dependency scans that block the merge | Injection, weak cryptography and library versions with known vulnerabilities. OpenSSF tells teams to instruct the assistant to "prefer well-vetted, reputable libraries" and to lock versions. | OpenSSF, same guide |
| A flag, a log line with an identifier per request, and a practised rollback | A change you cannot turn off or trace once it is live. For agents acting in the pipeline, OWASP says: "Log CI agent action metadata, correlation identifiers, authorization decisions, and outcomes." | OWASP, same page; the four things below |
OWASP's page shows no publication date, so we give the date we read it. Neither document gives a figure for how much safer any one gate makes the code, so we give none.
Why this needs saying again now
The mechanics are the same as they were ten years ago. Two things around them have changed.
The first is volume. When more change reaches production every week, the chance that any given change is the wrong one goes up, and the time each one gets before it is released goes down. Google's announcement of the 2025 DORA report, drawing on survey responses from "nearly 5,000 technology professionals", says that AI adoption has a positive relationship with software delivery throughput and that it "does continue to have a negative relationship with software delivery stability" (read 21 November 2026). More changes, less stability. That combination is the case rollback plans exist for.
The second is confidence, and it is the more interesting one. A July 2025 study by METR followed 16 experienced open-source developers working on repositories they knew well. Using AI tools, they took 19 percent longer to complete issues. They had expected a 24 percent speedup, and afterwards they still believed AI had sped them up by 20 percent. METR's page now carries the notice "These results are out of date" and points to a February 2026 update in which METR says its newer data shows "some evidence for speedup" and calls that data an unreliable signal because of how developers were selected (both read 21 November 2026).
The plan has to be designed around the belief figure. The gap that matters is between the measured speed and what people believed after doing the work. Feeling fast changes behaviour: bigger increments, less checking, more confidence at the moment of deploy. Whatever the true productivity effect turns out to be, plan for a team that believes it is moving faster than it is.
The four things a real plan contains
1. A kill switch in configuration, with no deploy
The difference between turning a behaviour off in ten seconds and turning it off in twenty minutes is the difference between a short problem and an incident.
A configuration change takes effect immediately. A revert has to go through build, test, and deployment, which is the pipeline whose speed you cannot control at the moment you need it most. Build the switch when you build the feature. Adding one during an incident means releasing new code to fix code, under pressure, which is how the second outage starts.
Check what the switch can stop. A flag wrapped around a code path that includes a schema change or an outbound message looks like control but gives you none.
2. A written answer to "what did it write?"
Do this before launch, on one page, in plain sentences. Every feature that writes data falls into one of four states:
Compatible. The old code reads the new data correctly. Nothing to do, and this is worth designing for on purpose.
Ignorable. The new data exists and the old code does not look at it. Fine, as long as somebody remembers to clean it up later.
Needs repair. The old code will misread it, so a script has to fix the rows or move them where the code will not read them. Write that script alongside the feature, while nobody is under pressure. It takes an hour then.
Cannot be undone. Money moved, a message was sent, an external system was told something. This state is a reason the feature should have been behind an approval step instead of a flag, which is the decision covered in when a human must stay in the loop.
The pattern that makes the first state achievable is expand and contract. Add the new column, have both paths write both formats for a period, and only remove the old format once the change has proved it works. During that period the rollback option is real.
3. An on-call engineer who can turn it off alone
Write down who is allowed to trigger a rollback, before the incident, and give them the authority to do it without a meeting.
Requiring everyone to agree turns a two-minute action into a forty-minute discussion, and the discussion happens while the system is broken. The cost of one unnecessary rollback is small. The cost of a delayed one grows every minute.
The related decision is when to roll back and when to fix forward. Our rule: roll back when you do not yet understand the cause, fix forward only when you do and the fix is small. Debugging live under pressure produces its own defects, and a system in a known state is worth more than a system that might be fixed.
4. A practice run, in production, before you need it
This is the one that gets skipped and it is the only one that proves the other three.
Pick a real feature. Roll it back on purpose, at a time you chose, with everyone awake. Time the whole thing from decision to verified recovery. Write down what broke that nobody predicted, because something always does: a dashboard that reads a column the revert removed, a downstream service holding a cached response, an alert nobody had connected to the flag.
An untested rollback plan is a paragraph in a document. A practised one is a capability the team has, and the difference only becomes visible on the day something goes seriously wrong.
What people forget every time
Anything that left your system. Emails and notifications are gone. Webhooks were received and processed by parties who will not reprocess them because you changed your mind. Any partner who read your API during that period has the answer from the new behaviour stored somewhere.
Downstream caches. Yours and other people's. Reverting the code does not revert a value another service computed and kept.
The monitoring gap. Metrics and logs that only the new code produces stop when the new code stops, which is when you most want to see what is happening.
How long the rollback period needs to be. Failures that produce errors appear in minutes. Failures that produce no error appear in a monthly report. Keeping the old path readable for a full release cycle costs little and covers the case where the problem is a wrong number and no error rate moves. The related mistake of testing this in an environment that does not behave like production is covered in why your staging environment is lying to you.
Where verification fits
A rollback plan is what you do when the checks did not catch it. The cheaper choice is catching more of it earlier.
Automated checks written from the specification, running in the pipeline and able to block a merge, are what let a team accept generated work at volume without reading every line. The mechanics are in evals in CI for coding agents. They will not catch everything, and a suite that has never failed is telling you nothing, which is the failure described in when evals give false confidence.
So both. Verification reduces how often you need the plan. The plan handles the cases verification could not have anticipated, and those cases are permanent, because a check tests a rule somebody thought of.
The short version to put in a template
Before any feature that writes data or connects to an external system goes live, four lines: how it is turned off, what it wrote and whether the old code can read it, who can turn it off, and the date of the last practice run.
The fourth line is the hardest to fill in, and it is the one that makes the other three true.
You do not have a rollback plan until you have used it once on purpose.
Related guide: Vibe coding production risks.
Sources
- METR, Early 2025 AI experienced open-source developer study, July 2025: 16 experienced developers took 19 percent longer with AI tools, expected a 24 percent speedup, and believed afterwards they had been sped up by 20 percent. The page now says "These results are out of date." Read 21 November 2026.
- METR, We are changing our developer productivity experiment design, 24 February 2026: "some evidence for speedup" in newer data that METR calls an unreliable signal. Read 21 November 2026.
- 2025 DORA report announcement, Google Cloud, 23 September 2025: "nearly 5,000 technology professionals"; AI adoption has a positive relationship with throughput and "does continue to have a negative relationship with software delivery stability". Read 21 November 2026.
- OWASP, Secure Coding with AI cheat sheet: developer approval before merging, security-critical tests written by hand, package verification, logging for agents in the pipeline. No publication date shown. Read 21 November 2026.
- OpenSSF, Security-focused guide for AI code assistant instructions, 1 August 2025: no secrets in code output, well-vetted libraries, locked versions. Read 21 November 2026.


