Implement more versions with different languages, frameworks, libraries and AI agents. Then you can do differential execution for testing, which is easier than imagining testing scenarios from pure code. You can fuzz or use production data (shadow mode execution) to get notified early of divergences.
Keeping a population of diverse replicas might be the simplest way to derisk AI code. When 2 replicas diverge an agent can decide - was it a bug in one of them, or was the spec unclear? Either way, if you fix a bug or clarify the spec you come ahead.
A separate class of problems is related to intent divergence. For that my solution is to keep a full log of all user messages during the lifetime of the project. Even 10,000 messages collected over weeks and months can be read and summarized in a few minutes. That means you can check for intent divergence with agents, but you always start from the raw source (your human messages) not from intermediate summaries and diverged code.
Combining the 2 ideas would make each replica agent derive the user intent separately from the same log.