- Crash drill
- 22 / 22assertions, one run
- Restart in production
- Survivedwhile waiting for approval
- Duplicate writes
- Zeroone commit, after the kill
The problem
An agent that edits code is a long-running process with side effects. It writes files, commits, compiles, runs tests. If it is interrupted — a restart, a deploy, a container evicted — the naive implementation either loses everything it was doing or, far worse, comes back and does the destructive half of its work a second time.
A demo never meets this. A delivery pipeline meets it constantly.
The design decision
I built the workflow as an explicit state machine on LangGraph, with every transition checkpointed into PostgreSQL, and the human approval modelled as an interrupt rather than a blocking prompt. The part that took the real thinking was idempotency: on resume, how does the process know whether it already performed its side effect?
The answer could not be “look at a flag we wrote”, because the crash can land between doing the work and recording that we did it. It had to be derivable from the work itself.
So the workspace path is a pure function of the workflow id, and the commit carries the approval's binding hash in its subject line. On resume, the process reads the real git history and asks whether that commit is already its own. That is a question the filesystem can answer truthfully no matter when the process died.
How I proved it
I wrote a drill that starts the real workflow in a child process and kills it — actually kills it, at a marker placed after the git commit and before the checkpoint. A fresh process then resumes and has to reach the right conclusion. Twenty-two assertions across four scenarios: killed after the commit, killed at a node boundary, interrupted before approval, and a deliberately corrupted checkpoint row.
Three real defects came out of that drill, and none of them would have been found by unit tests alone:
Workspace identityThe workspace path was not derivable after a mid-node kill, so a resumed process could not find its own work. It became a pure function of the workflow id.
Checkpoint durabilityLangGraph's default asynchronous durability lost a boundary checkpoint under a real kill. Every invocation now commits its checkpoint synchronously.
Corrupt stateThe checkpoint store trusted its decoder instead of raising on a malformed row. It now fails closed and reports the workflow as corrupt rather than resuming from nonsense.
What it does in production
- Approval
- Bound by hash to the exact path and content approved. The approve function is not present in the model's tool schema, so there is no code path for it to approve its own change.
- Authority
- The model proposes. A deterministic risk policy and the write boundary decide. Every model result is labelled advisory in code, not by convention.
- Restart evidence
- A workflow was left waiting for approval, the container was restarted for real, and the fresh container reported the same checkpoint still waiting. It was then approved over HTTP and the pipeline ran to completion.
- Audit
- Every state transition and every human decision is an append-only row in the event ledger.
The state machine
The checkpoint store
The crash drill
Honest limits
This is my own platform, which I built and operate. It is not an employer production system, and the traffic on it is mine. Three limits are worth stating plainly:
- The crash drill's kills were performed locally. On the production host, what has been demonstrated is a restart while the workflow was waiting for approval — not a kill in the middle of the pipeline, because the pipeline completes in about five seconds and there is no pause hook there.
- On an ephemeral filesystem, a workspace lost with the container makes the apply step fail safely rather than resume, because no durable remote is configured for the branch.
- Deployment is scripted but triggered by hand. There is no automated continuous delivery behind this.