Legacy modernisation

The loud AI failures are the survivable ones

This year gave us two memorable stories about AI agents destroying things. Both are worth reading. Neither is the failure mode that will sink your legacy transformation.

The two stories everyone shared

In April, the founder of automotive SaaS platform PocketOS lost his production database to the company's own coding agent. Cursor, running Claude Opus 4.6, hit a credential mismatch in staging and decided to fix it by deleting a Railway volume. It found an API token in an unrelated file that was scoped for any operation, including destructive ones, and made a single call. The volume-level backups lived in the same volume, so they went too. Railway later said the agent had called a legacy endpoint missing the delayed-delete safeguard that the dashboard and CLI have, patched it, and restored the data.

In May, a developer accused Google's Gemini coding assistant of deleting close to 30,000 lines of working code and then producing a recovery report describing work it had not done. Those claims were not independently verified, and it is worth holding them loosely. But the shape of the allegation is the interesting part: not just destruction, but a confident account of a recovery that had not happened.

Two kinds of failure, and only one makes the news

Loud failures

  • An agent deletes a database or a directory
  • The build breaks, loudly and immediately
  • You know the exact moment it happened
  • Recovery is an engineering problem with a known scope
  • Someone writes a blog post about it

Quiet failures

  • A rounding rule changes in one of nine calculation paths
  • An edge case nobody documented stops being handled
  • Everything compiles, every test passes, the demo is fine
  • It surfaces in a reconciliation, an audit, or a customer complaint
  • Nobody can tell you which change caused it
Loud failures announce themselves. Quiet ones are discovered months later, usually by finance.

Why the quiet ones kill programmes

Gartner expects more than 70 percent of mainframe exit projects started in 2026 to fail to deliver their intended benefits, and points at the gap between what generative AI is marketed as being able to do with complex legacy code and what it actually does. That is not a prediction about agents deleting things. Those are rare, obvious and recoverable. It is a prediction about translation that looks right.

This is the failure mode I would call silent behavioural drift, and AI is unusually good at producing it. A translation tool that cannot understand your code produces something that does not compile, and you find out in minutes. A model that mostly understands your code produces something idiomatic, readable, plausible, and subtly different in the three cases that matter most. Reviewers approve it because it reads well. Tests pass because the tests were written from the same misunderstanding.

On a legacy system, that is the whole risk. The business rules are the asset. The code is just where they happen to be written down, often badly, by people who left a decade ago. If a migration preserves the architecture and loses two rules, it has failed, however good the new codebase looks.

The safeguards I apply

  • Parity is the acceptance criterion, not code quality. Before any translation starts, generate characterisation tests from the real system's actual inputs and outputs. The question at every review is not "is this good code?" but "does it do exactly what the old one did?"
  • Pin behaviour before changing it. Tests come first, from the legacy system, including the cases nobody documented. If behaviour cannot be captured, that slice is not ready to migrate.
  • Agents get read-only credentials. Nothing an AI holds should be able to delete anything. Tokens are scoped to the narrowest operation that does the job. PocketOS lost a database to a token that was lying around and could do everything.
  • Backups live outside the blast radius. If the backup can be destroyed by the same call that destroys the data, it is not a backup. Test the restore, on a schedule, before you need it.
  • Never trust the AI's own report. An agent's account of what it did is not evidence. Verify against the running system, the diff and the tests. The Gemini allegation is a warning about self-reporting, whatever its merits.
  • Migrate in slices, with both systems running. One module at a time behind a facade, old and new in parallel until each slice is proven. Big bang only where it is the deliberate strategic call, rehearsed, with rollback tested.
  • Measure rework, not output. Track the share of AI-assisted changes that need correcting after review. If that number is climbing, the tooling is costing you money however fast it generates.

What this is not

This is not an argument against using AI on legacy work. I use it on every engagement, and on the comprehension end - reading codebases, extracting rules, drafting tests - it is genuinely transformative. It is the single best tool I have ever had for the hardest part of this job.

But it changes the shape of the risk. The old failure mode was running out of time and money before you understood the system. The new one is believing you understood it because something fluent told you so. Those need different safeguards, and most programmes are still carrying the old ones.

Sources

What this is a response to

Next step

Disagree? Tell me where.

If this matches or contradicts what you are seeing in your own delivery, I would rather hear it than not. A 15-minute call costs you nothing.

Published

10 November 2026

Topic

Legacy modernisation