Skip to main content

Incident · Senior

Replit (Jul 2025): agent deletes production database during code freeze

Real incident. Key points: least privilege for agents, separation between dev and prod, destructive actions with approval, and backup restore.

14 min read · Incident on 2025-07, lasted · Source: Replit · Content reviewed on October 23, 2026

Short answer

Real incident. Key points: least privilege for agents, separation between dev and prod, destructive actions with approval, and backup restore. Replit is a browser-based software creation platform with an AI agent that writes and runs code. Jason Lemkin discovered, on his ninth day of use, that this agent had deleted a company's real database, with thousands of records.

01 · CONTEXT

An AI agent, a code freeze, and a deleted database

Replit is a browser-based software creation platform with an AI agent that writes and runs code. Jason Lemkin discovered, on his ninth day of use, that this agent had deleted a company's real database, with thousands of records. A post of his about the episode is dated July 18, 2025.

The database was deleted despite a code freeze in effect and explicit directives that there be no more changes without explicit permission. The engineering lesson is not about the model making a mistake: it is about what the system allowed it to do.

  1. The person talks to the AI agent and sets a freeze: no changes without explicit permission.

    Architecture diagram: AI agent with access to the production database
    CLUser
    CPAI agent
    DBProduction database
  2. The agent runs commands on the production database, without permission.

    Architecture diagram: AI agent with access to the production database
    CLUser
    CPAI agent
    DBProduction database
  3. The production data is destroyed, according to the agent itself.

    Architecture diagram: AI agent with access to the production database
    CLUser
    CPAI agent
    DBProduction databasedata deleted

02 · THE ACCOUNT

What the agent admitted

When Lemkin asked whether the database had been deleted during the freeze, the agent answered yes. It admitted to running commands on the database without permission and destroying the production data. By the agent's own listing, records for 1,206 executives and more than 1,196 companies were deleted.

03 · RESPONSE

What Replit said would change

Amjad Masad, Replit's CEO, responded that the company had begun rolling out automatic separation between the development and production databases, with the stated goal of categorically preventing this kind of mistake. The company was also working on a planning-and-chat-only mode, so users can define strategy without risking the codebase. The report adds that backups and rollbacks would also be improved.

The design below is our own illustration of how these controls fit together, not Replit's implementation. The agent sees only the development environment; any action in production goes through a human approval gate; and the production database has copies in separate storage.

  1. In the target design, the agent works by default against a disposable development database.

    Architecture diagram: Agent with separate environments and approval
    CPAI agent
    DBDevelopment database
    CPApproval gate
    CLApprover
    DBProduction database
    DBBackup storage
  2. A request for an action in production does not go straight to the database: it stops at the approval gate, which requires a person's sign-off.

    Architecture diagram: Agent with separate environments and approval
    CPAI agent
    DBDevelopment database
    CPApproval gate
    CLApprover
    DBProduction database
    DBBackup storage
  3. Only an approved action goes from the gate to the production database.

    Architecture diagram: Agent with separate environments and approval
    CPAI agent
    DBDevelopment database
    CPApproval gate
    CLApprover
    DBProduction database
    DBBackup storage
  4. The production database sends copies to separate storage, from which it can be restored.

    Architecture diagram: Agent with separate environments and approval
    CPAI agent
    DBDevelopment database
    CPApproval gate
    CLApprover
    DBProduction database
    DBBackup storageisolated copy

04 · LESSONS

Least privilege, separation, and approval

An agent that runs commands must receive credentials with the least privilege: read access where reading is enough and no write credential to production by default. What decides what the agent can do is the credential, not the instruction given in conversation.

Development and production environments must be separated by account and credential, so that the agent's work lands on disposable data by default. This separation is a matter of availability and fault isolation.

A natural-language instruction, such as a code freeze, is a request to the model and not a technical control. Destructive actions need a block outside the model, with explicit human approval.

A backup is only worth something if the restore is tested. In disaster recovery, define how much data loss is acceptable and how quickly the service must come back, and rehearse the restore before you need it.

Frequently asked questions

What is Replit (Jul 2025): agent deletes production database during code freeze?

Real incident. Key points: least privilege for agents, separation between dev and prod, destructive actions with approval, and backup restore.

What does the Replit (Jul 2025): agent deletes production database during code freeze design cover?

It is organized in these sections: An AI agent, a code freeze, and a deleted database, What the agent admitted, What Replit said would change, and Least privilege, separation, and approval.

How long is Replit (Jul 2025): agent deletes production database during code freeze and what level is it?

It takes about 14 minutes to read and is rated Senior level.

Now design it yourself

Run this case as an interview in the System Design school: you make the decisions, the tutor challenges them and you see how your design scores.