An AI agent database deletion wiped a production database and every backup stored beside it in under a second in a new lab replay of the PocketOS incident. The test also shows what kept data alive: backups held in a separate store that the agent’s credentials could not touch.
The PocketOS outage
PocketOS, a SaaS company serving car rental firms, lost its production database in late April 2026. Founder Jer Crane said the trigger was a Cursor agent powered by Claude Opus 4.6. It was handling a routine staging task, ran into a credential mismatch, and went hunting for an API token. It turned up a token in an unrelated file. The token had been created to add and remove custom domains through the Railway CLI, but Railway says it carried account-scoped access, the maximum possible.
The agent then sent a single volumeDelete GraphQL call for what it took to be a staging volume. It was production’s. Crane puts the whole thing at roughly nine seconds, and nothing asked for confirmation. The volume-level backups lived on that same volume. When asked why, the agent said it had guessed instead of checking.
The accounts of the recovery differ. Crane wrote more than 30 hours in that the newest restorable backup was three months old. Railway later said a cascading delete in its legacy API made backups “look unavailable,” that it keeps disaster backups offsite, and that the customer’s data came back. Railway has since added a 48-hour soft delete to all API deletions.
A second case followed the same pattern. In February, Claude Code ran terraform destroy and wiped the RDS database and automated snapshots behind the DataTalks.Club course platform. AWS support found a snapshot the owner couldn’t see and restored it 24 hours later. Both recoveries depended on the provider holding a copy the customer didn’t know about.
Rebuilding the AI agent database deletion on a throwaway server
The lab recreated three conditions. An account-wide token sat in a stray file, a staging config named the production volume, and the backups were stored on that volume. The seeded database had 60,000 customers, 400 vehicles, and 600,000 each of reservations and payments, then 24 simulated hours of writes, with a backup taken after every batch.
One DELETE call removed the production database, four volume backups and 24 hourly dumps. The call came back 674 ms into the run, and no copy of the data remained.
What survived when backups lived elsewhere
In the second scenario, the hourly backup moved out of that blast radius. Plakar copied data out of Postgres into an encrypted store owned by a different Unix user. Access needed a server token and passphrase that the agent’s account couldn’t see. The agent’s calls still deleted the volume, yet every one of the 24 snapshots survived. The store’s log showed only 401 rejections for that minute.
The newest snapshot restored into a fresh Postgres in 8.6 seconds. Across 30 repeat restores the median came to 9.3 seconds, ranging from 8.0 to 13.1, and each one matched the original on row counts and an md5 check of each table. Those timings come from 111 MB of dump data on a local store. A store reached over a network wasn’t tested.
Storage also dropped. Twenty-four hourly pg_dump files added up to 770 MB, against 126 MB for the Plakar store with the same 24 snapshots.
What a restore can’t bring back
Recovery still has a price. Every restore lost the 500 bookings and status changes made after the final hourly backup. That gap is the recovery point objective, and a shorter backup interval or WAL archiving would shrink it.
A narrower token helped too. Given a staging-only token, the same delete drew a 403 and nothing was touched.
How a real agent behaved
The test also ran Claude Code with Opus 4.6, the model from the incident, on the same task 10 times. It used the account token it found in all 10 runs. When the project carried a CLAUDE.md instruction forbidding destructive production commands, none of 6 runs deleted anything. Without the rule, 1 of 4 runs deleted all four production volume backups, knowing they were production’s. No run deleted a volume.
A rule file lowers the odds of an AI agent database deletion but doesn’t remove them. Credentials remain the stronger control.
What teams should change after this AI agent database deletion test
- Keep at least one backup outside any account or credential an agent can reach.
- Scope tokens to the environment they serve, and keep them out of unrelated files.
- Check staging configs for production IDs left over from copying.
- Test restores and measure the gap between the last backup and now.
The lab platform was written for the test and is harsher than what Railway describes, so the exact timings won’t carry over. The design lesson does: a backup that shares a failure with its source isn’t a backup.
Source: devops-daily.com