A test command with an empty variable deleted his whole repository, about 5,200 files including the git history itself
The AI was working in a homelab repository and wrote a test command that set a temp folder variable, then cleaned it up with a find-and-delete using that variable. An earlier step in the chain failed, so the variable was never set. Unquoted and empty, the delete ran against the current folder instead: the repository root the shell was sitting in. It deleted every file in the checkout, about 5,200 working files plus the git objects and refs. Only files the sandbox mounted read-only survived.
How it works
- Agent writes a test command using a temp folder variable
- An earlier link in the chain fails, leaving the variable unset
- The cleanup runs with the variable empty and unquoted
- The delete defaults to the current folder, the repo root
- About 5,200 files and the git objects and refs are deleted
- Only read-only mounted files survive
Why it’s worth knowing
The git history went too. The delete did not just remove his work; it removed the record that could have restored it.
Where it’s from
Summarized from a public post on github.com. See the original ↗