Skip to content
>devspeak
← glossary
patternCommunication Patterns

Roll back if verification fails

Tell the agent that if its change doesn't pass the checks, it should undo it and return to the last working state, rather than piling on more fixes.

a bit more technical

Define the failure condition up front: if tests, the build, or other checks fail after a change, revert to the known-good checkpoint and report, instead of layering guesswork fixes. This prevents a cascade of patches on top of a broken change.

picture it

A climbing team agreeing before they start: if the weather turns, we go back to base camp. The decision is made while everyone is calm, not halfway up the mountain.

✗ instead of
upgrade the chart library and just keep fixing stuff until it works
✓ try
Commit the current state, then upgrade the chart library. Run the tests and the build. If verification fails, roll back to that commit and report what failed rather than attempting more fixes.
why it matters

When a change fails, agents tend to try fix after fix. Each attempt adds more changes, and soon the code is further from working than when it started. A rule set in advance keeps things recoverable.

what your agent might say
agent
Verification failed: 2 chart tests broke after the upgrade. As instructed, I rolled back to the checkpoint, and everything passes again. Here are the failures.
how you might use it
you → your agent
Upgrade the chart library, then run the tests and the build. If verification fails, roll back to the last commit and report what broke instead of trying more fixes.
common mistake

Thinking a rollback means failure. It's a safe return to a known-good state, so you can decide what to do next with a clear head.

builds on