Robert Ta says to write a test-strategy document before letting a coding agent run on its own. Define exit criteria and feed the agent a spec plus a detailed test matrix so it stops only when all required tests pass.
Chapters
If you're using Cloud Code or Codex or anything like that, one of these agents with a harness to do any sort of code generation and build apps or platforms, very easy thing is create a test strategy document that you read as the exit criteria that the agent has to uphold before it exits its autonomous goal loop. Like you feed it a spec, for example, like spec-driven development, but you make sure you read the test strategy and the test matrix of cases that you know to be the exit criteria. You confirm that, and that tells you the system is doing what you want it to do. But you have to, like, read that up front and make sure the agent is honoring that.