Engineering

What a rollback plan looks like for AI-written features

Editorial · Reveneau · September 18, 2026 · Updated November 21, 2026

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

Common questions

How do I make AI-generated code production ready?

It is production ready when it passes tests written from the specification before the code existed, a reviewer's approval for the access rules and business logic no check can judge, a check that every package it names exists, secret and static analysis scans that block the merge, and the operability work in this post: a flag, logs that carry an identifier per request, and a rollback that has been practised. OWASP's Secure Coding with AI cheat sheet and the OpenSSF guide for AI code assistant instructions give the same list, and Reveneau releases a change only after it passes an eval suite written from the specification.

What does a rollback plan for an AI-written feature need to cover?

Four things: a kill switch that turns the behaviour off through configuration with no deploy, a written answer to what data the feature wrote and whether the old code can still read it, an on-call engineer with authority to turn it off without calling a meeting, and a practice run in production before the plan is needed. Reverting the code is the part that already works.

Why is reverting the commit not enough?

Because the code can be reverted and its effects stay. While the feature was live it may have written rows in a new format, sent messages, triggered webhooks that other systems already processed, filled caches with values computed under the new logic, and run a migration that dropped a column, and none of that is undone by a git revert.

What is the difference between a kill switch and a revert?

A kill switch changes behaviour through configuration in seconds without a build or a deploy, while a revert requires the full pipeline to run and is therefore slower at the exact moment speed matters. Build the switch when you build the feature, because adding one during an incident means releasing new code to fix code.

How do you handle data written by a feature you are rolling back?

Decide before launch which of four states applies: the data is compatible with the old code, it is ignorable, it needs a repair script, or it cannot be undone at all. Write a repair script alongside the feature for the third case, and treat the fourth as a reason to require an approval step for the feature instead of a flag.

Does AI-assisted development change rollback planning?

It changes the volume and the confidence around each change. More change reaching production per week raises the chance that any one of them is the wrong one, and the METR study from July 2025 found developers believed they were twenty percent faster while measuring nineteen percent slower, which means felt speed is a poor guide to how carefully a change was checked. METR now marks that result as out of date and calls its February 2026 data weak evidence of a speedup, so plan for the belief and measure the speed.

What is an expand and contract migration?

A pattern where the new column or table is added first, both old and new code paths write to both formats for a period, and only after the change has proved stable is the old format removed. It makes the rollback period real, because during the overlap the previous version of the code can still read everything the new version wrote.

Who should be allowed to trigger a rollback?

The on-call engineer, with the authority written down before the incident. Requiring consensus or a manager's approval turns a two-minute action into a forty-minute discussion, and the cost of an unnecessary rollback is lower than the cost of a delayed one.

How do you know when to roll back or fix forward?

Roll back when you do not yet understand the cause, and fix forward only when you do and the fix is small. Debugging a live incident under pressure produces its own defects, so the default should be to stop the damage first and find the cause afterwards with the system in a known state.

What should you rehearse before launch?

The actual rollback, in production, on a real feature, at a time you chose. Measure how long it takes from start to finish and what breaks that nobody predicted, because an untested rollback plan is only a paragraph in a document.

How do feature flags fit into this?

A flag is the mechanism that makes the kill switch instant, and it is only useful if the code path behind it is optional. A flag wrapped around a schema change or a message that has already been sent looks like control but gives you none, so check what the flag can stop.

What breaks in a rollback that people forget?

Anything that left your system. Emails and notifications are gone, webhooks have been processed by third parties who will not reprocess them, and downstream services may have cached results from the new behaviour. List every outbound effect a feature has before you write the plan.

How long should the rollback period last?

At least as long as it takes for the failure to be discovered, which for defects that show no error is often days. Keeping the old code path readable for a full release cycle costs little and covers the case where the problem first appears in a monthly report and no dashboard ever shows it.

Start a project