## TL;DR
Every test restore gets a unique name and its own lifecycle: reusing one name meant each run destroyed the previous test's evidence and, worse, could collide with a restore someone was still examining. Generate test VM names from the source, date, and a run identifier, record the mapping in the test log, and tear down by the run's own identifier only after its results are recorded.

```text
agent overwrote the only test restore VM by reusing its name for the next verification run
```

## Use this when
- The job or restore fails with this symptom: agent overwrote the only test restore VM by reusing its name for the next verification run.
- You are working on an agent running recurring restore verification tests and the failure repeats on the same target or schedule.
- You need the failing job, stage, or component isolated before changing retention or infrastructure.

## Not for this skill when
- A deliberately persistent golden test VM that the team maintains as a reference, which should be excluded from agent teardown by an explicit tag.
- The error text names a different product, stage, or root cause. Match the verbatim error first and use that skill.

## Steps
1. Review the test history and confirm the naming collision destroyed a prior test's target. Verify: the overwrite event is documented
2. Change naming to a generated unique form including source and run id, and store the name in the run record. Verify: each test has a unique, recorded target
3. Scope teardown to the run's own identifier and require results to be recorded before teardown is allowed. Verify: teardown cannot eat unrecorded evidence
4. Add a pre-create check that refuses a name that already exists instead of overwriting it. Verify: collisions refuse rather than destroy
5. Run two tests back to back and confirm both VMs coexist until their own teardowns. Verify: isolation holds across runs

## Variant phrasings
### agent overwrote test restore vm reused name next verification
The verbatim phrasing.
### agent restore test unique naming teardown lifecycle fix
The lifecycle phrasing.
### test restore vm name collision agent destroyed evidence
The collision phrasing.

Compatibility: Agent restore test isolation and test VM lifecycle management

## Why it happens
Names are identity in virtualised estates, and a fixed test name turns a recurring verification into a single overwriting slot. The failure is not just lost evidence; a restore that lands on a name a human is using for diagnosis corrupts two processes at once.

## Edge cases / pitfalls
- Orphaned test VMs from crashed runs accumulate; a janitor pass keyed on the naming pattern reclaims them safely.
- The unique name should sort by date so humans browsing the estate read the test history naturally.

## Provenance

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