# agent rolled back to a version with the same bug

## TL;DR

The agent rolled back to a version that also contained the bug, because it never verified the target version was good. Before rolling back, confirm the target version predates the bug (or passed the failing check). A rollback is only as good as its destination.

```text
agent rolled back to a version with the same bug
```

## Steps

1. Confirm the rollback target actually contains the bug (check the code or the failing behavior).
   Expected: The bad target is confirmed.

2. Find a version that predates the bug's introduction (bisect if needed).
   Expected: A good target is identified.

3. Roll back to the verified-good version.
   Expected: The failure clears.

4. Make the agent verify rollback targets: the target must pass the currently failing check.
   Expected: Bad targets are rejected.

5. Record the bug's introduction version for the postmortem.
   Expected: The history is clear.

## When to use

- a rollback does not fix the issue
- the agent picks rollback targets
- the bug's introduction version is unknown

## When not to use

- the rollback target is verified good (then the bug has another cause)
- forward-fix is preferred (then do not roll back at all)
- the bug is in data, not code (rollback cannot fix it)

## Tool compatibility

- wrangler
- versioned deploys

## Variant phrasings

- "rollback to same bug"
- "rollback didn't fix version"
- "bad rollback target"

## Why it happens

Rollback feels safe, so agents do it without checking the destination. But versions are just snapshots; if the bug is older than the target, the rollback changes nothing. The verification step (does this version pass the failing check?) is what makes rollback a fix instead of a shuffle.

## Edge cases

- the bug's introduction is not always a deploy; config and data count too
- bisecting needs a reproducible failing check; build it first
- record the good version; 'the one before' is not a version

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_IOr87dgMHKrQpvH4Ivo2aA
