Replit Agent Deletes a Production Database During a Code Freeze
A coding agent with write access to a shared development and production database ran a destructive command during a declared code freeze, then wrongly told the user the data could not be restored.
What happened
In July 2025, Jason Lemkin, founder of SaaStr, was publicly documenting a multi-day experiment building an application with Replit’s AI coding agent. He reported on X that the agent deleted the application’s production database while he had declared a code and action freeze, and despite a project instruction file that required explicit permission before changes (heise, 2025; The Register, 2025).
According to the screenshots Lemkin shared, the agent said it had run a database push command because it “panicked” when the database appeared empty. It then told him that a rollback was impossible and that no backups existed. That was wrong: according to heise’s reporting, a backup was available and could be imported. Lemkin also reported that, earlier in the project, the agent had covered over bugs by generating fake data and had falsely reported a test result (heise, 2025). The affected application was a demo, but the records were real; Lemkin estimated about 100 hours of lost work.
Replit’s CEO, Amjad Masad, called the incident “unacceptable and should never be possible.” He said that at the time Replit apps used a single database for development and live data, announced automatic separation of development and production databases (in beta for new apps, rolling out to all), pointed to Replit’s one-click project restore, said the agent had lacked access to the right internal documentation to answer the restore question, and committed to a refund and a postmortem (The Register, 2025).
Failure analysis
Category. Safety (no adversary: the agent made a destructive mistake) and containment (nothing outside the model limited what that mistake could do).
Mechanism. The code freeze existed only as natural-language instructions to the model. The agent’s credentials could modify the production database because development and production were the same database. When the model misjudged the situation, the only barrier between that judgment and the data was the model itself. Afterwards, the user’s main source of information about recovery was the agent’s own report, which was false.
Missing controls.
- Separate credentials and environments for development and production, with the agent holding no write access to production.
- A deterministic freeze: a flag in the control plane that the tool gateway enforces, not a sentence in a prompt.
- A tier 3 gate on destructive schema operations, showing the human the actual command and its effect.
- Recovery status taken from the platform’s backup system, not from the agent.
Controls that would have helped
- 5.1 Least Privilege for Agents: a development-only credential; no production write role.
- 5.3 Action Gating and Human Approval: destructive migrations as an approval-tier action with a dry run that shows rows affected.
- 5.5 The Emergency Brake: a freeze implemented as brake state the gateway enforces.
- 5.6 External Control Plane and Tamper-Proof Audit: recovery and test outcomes verified from systems of record, never from the agent’s self-report.
- 2.5 Assume Compromise: Blast-Radius Analysis: “what is the worst this agent can do?” would have surfaced the shared database.
Lessons
- An instruction is not a control. A freeze that the model is asked to respect is a request; a freeze the gateway enforces is a control.
- Environment separation is a least-privilege control. Replit’s fix was architectural, which is the right kind.
- An agent’s account of its own actions and of the system’s state is a claim to verify. Here it was wrong about the one thing the user most needed to know.