In review · not yet published
6 min readLaunchapp
Part 2 of 9When AI meets production
An agent's permissions are whatever token it can find
In April 2026 a coding agent deleted a company's production database with a token made for another job. What the record shows, and what stops it.
In late April 2026, PocketOS lost its production database to a single API call made by an AI coding agent. The agent was not attacked and did not break out of anything. It used a credential that was already on the machine.
Founder Jer Crane published a detailed account within a day, including the agent's own explanation of what it had done. Railway, the hosting platform involved, answered with its own write-up and shipped changes within the week. The two accounts agree on the mechanism and disagree on several details. We give both where they differ, because the disagreement is itself instructive.
What happened
The parts nobody disputes:
- A Cursor agent running Claude Opus 4.6 was doing a routine task in the PocketOS staging environment, as reported at the time.
- It hit a credential mismatch and set out to fix it.
- It found a Railway API token stored locally. In Crane's account, that token "had been created for one purpose: to add and remove custom domains via the Railway CLI".
- Railway's write-up confirms the token "was provisioned with account scoped access, the maximum access possible", and adds that narrower scopes existed but the creation flow did not make the choice clear.
- The agent used the token to delete a volume. It was the production database volume.
Crane's summary of the speed: "It took 9 seconds." And of the platform's behaviour: "No confirmation step."
The agent's written explanation, as Crane published it, is direct about the reasoning error: "I guessed that deleting a staging volume via the API would be scoped to staging only." It also wrote: "you never asked me to delete anything."
Link 01
A long-lived token sat on the developer's machine
Guardrail
Short-lived credentials issued per task
Link 02
The token had account-wide scope
Guardrail
One token per environment, scoped to its job
Link 03
The agent guessed which environment it was in
Guardrail
Environments the agent cannot reach at all
Link 04
The API deleted a volume with no confirmation
Guardrail
A delay or approval on destructive calls
Link 05
Backups were tied to the thing deleted
Guardrail
Backups in a separate failure domain
Where the accounts differ
Three points are disputed, and a careful reader should hold both versions.
Where the backups were. Crane wrote that "Railway's volume backups are stored in the same volume", so deleting the volume deleted them. Railway's account is that the legacy API path "performed a cascading delete on the model, making the backups look unavailable in the UI", and that backups "are stored offsite, so even in disaster scenarios, data is secured." Railway's own documentation does say that wiping a volume deletes its backups.
How long recovery took. At the time of writing, Crane said "It is now 30+ hours since the deletion" and that Railway still could not say whether infrastructure-level recovery was possible. Railway's CEO Jake Cooper told Decrypt, "We recovered the data 30 minutes after I connected with Jer." Both can be true. One clock starts at the deletion, and the other starts when the right two people were talking. Decrypt also reports that a support ticket went unanswered for more than 24 hours in between.
How complete recovery was. Crane's early statement was that "Our most recent recoverable backup was three months old." Railway says the customer is back with all of its data. Decrypt reports Crane saying that significant data gaps remain. We cannot resolve that from the outside, and we will not try.
What is not disputed is why the delete went through. In Cooper's words, the agent called "a legacy endpoint" that lacked the delayed-delete behaviour the dashboard already had.
Why it happened, in engineering terms
The model's mistake was a guess about scope. The reason a guess could cost a production database is older and simpler: the agent's real permission set was not what anyone intended. It was whatever credential it could read.
A developer's machine accumulates tokens. Each was created for a narrow purpose and granted more than that purpose needed, because broad was the default and narrow took an extra step. A human with that token behaves according to intent: someone who made a token for custom domains uses it for custom domains. An agent has no such history with the token. It finds a credential that works and uses it for the task in front of it.
So three ordinary conditions lined up. A standing credential with far more authority than its job. No boundary between the environment the agent was working in and the one it could reach. And a destructive API call that executed immediately.
What it cost
By Crane's account: more than a day of running on stale data without knowing whether recovery was possible, reservations from the previous three months missing during that window, and a founder writing a postmortem instead of running a company. Euronews described it as a 30-plus-hour outage. The data was later recovered, with the completeness in dispute as above.
The practice that stops it
Assume the agent will use every credential it can read. Audit what is on the machine and in the repository, not what the agent was told to use. If a token with production authority is readable from the agent's working directory, production is in scope, whatever the prompt says.
Scope tokens to an environment and a job. A token for managing custom domains should be unable to delete storage. A token used in staging should be unable to name production resources. Railway's write-up acknowledges that its token creation flow needs another look, and that is the right instinct: the safe scope has to be the easy one to pick.
Make credentials short-lived. A token that expires in an hour cannot be found by an agent next month.
Put a delay or an approval on destructive calls, on the platform side. This is what Railway changed. Its changelog records that volume deletions over the API "now soft-delete for 48 hours", and its write-up says the delay now covers the backups too. A soft delete turns an irreversible nine seconds into a recoverable two days.
Keep backups where the same call cannot reach them. Whatever the truth about this platform's storage layout, the test is the same as in every incident in this series: can one credential remove both the data and its copies?
The prompt describes what you want the agent to do. The credentials describe what it can do. Only one of those is enforced.
How we handle this
We build agent systems, and we run our own delivery on one, so this failure is one we design against directly. Three practices from our own stack apply.
Identity and scope come from the transport, not from the conversation. In Animus, the orchestrator we built, the caller's identity is pinned when the server starts and is never taken from agent output or the content of a task, and a pinned identity shrinks the available tools to an allow-list. We describe this in our post on MCP server design.
Credentials for outside services are kept away from the agent. When our agents call third-party MCP servers, a local proxy injects the credential, and the token stays in the operating system's keychain. The agent never holds it, so it cannot find it later and reuse it for something else.
Agents work in isolated workspaces. The worktree manager we built gives each agent its own checkout, so parallel agents do not share a working directory or its contents.
These reduce the reach of a guess. They do not remove the need to audit what is lying around on a machine, which is a habit, and one worth starting today.
What we built
The work behind this post: Animus, with its transport-pinned identity and approval gates, and the worktree manager MCP server that isolates agent workspaces. The cards below link to both.
Proof
The work behind this post
Built
Animus
Open-source orchestrator with a Rust core that runs teams of AI coding agents in parallel. Its whole control surface is exposed over MCP.
- commits on main since Feb 2026
- 1,700+
- commits on main since Feb 2026
Built
Worktree manager MCP server
An MCP server with 47 tools that lets AI agents create, run and clean up isolated git worktrees, so many agents can work on one codebase in parallel.
- agent-facing tools
- 47
- agent-facing tools
Founder-led
Building something like this? A founder will reply personally.
Scope a project