Postmortems and working notes from building and running AI-heavy products with a small team: shared Postgres on small instances, Next.js on Vercel, single sign-on across many internal apps, model spend, and fleets of coding agents that commit more often than people do.
Each note records something that actually went wrong or was actually slow, what the first diagnosis was, why it was wrong, and what fixed it. Company, client and people details are removed. The mechanisms, error messages, SQL and commands are real.
Written by Direk Sethi.
| What broke | The lesson in one line | |
|---|---|---|
| 01 | Per-role pooler pools oversubscribed the database | A limit that is "per something" needs the multiplication written down. |
| 02 | A session-level SET leaked through the transaction pooler | On a transaction pooler there is no such thing as "my session". |
| 03 | A test teardown stalled production authentication | A separate schema isolates names, not locks, disk or I/O. |
| 04 | Background work starved the shared database of I/O | The query that fails is usually the victim. Rank by blocks read first. |
| 05 | Prepaid AI credit reached zero | A prepaid balance is a single point of failure with a countdown. |
| 06 | Sessions dropped every fifteen minutes | A bug with a period equal to a configured lifetime is that lifetime. |
| 07 | A dev server took the whole machine, and the agents died first | The first process the OOM killer takes is the one with the worst score, not the most memory. |
| 08 | Refreshed tokens kept a dead session | A sign-in lives as long as the shortest thing it is bound to. |
Next.js
- Slow navigation is usually a missing loading boundary
- A server action can hang forever behind router.refresh()
Vercel
- A deployment can be blocked by the commit author, silently
- Cutting build minutes in a monorepo that agents push to
Security and auth
- Rotating an encryption key that you cannot read
- Do not cache the revocation check to make a page faster
AI engineering operations
- The failing component is usually the victim. Six of the eight postmortems started with a correct observation and a wrong suspect.
- Defaults nobody chose. Pool sizes, cache lifetimes, prefetch rules and build triggers were all defaults, so none of them appeared in a review.
- Shared things fail together. One database instance, one credit balance and one refresh token each turned a local problem into a platform problem.
- Agents change the numbers. Limits and workflows designed around human commit rates and human session counts need to be re-derived.
Several of these notes led to small tools that are open source:
- mcp-token-relay: one OAuth sign-in shared by many agent CLIs.
- evalbench: a benchmark harness for comparing LLM pipelines with confidence intervals.
- skills: agent skills for Claude Code and Codex.
Text is licensed under CC BY 4.0, code snippets under MIT. See LICENSE.