Playground
Replay the session. Find the turn. Roll it back.
Seven agent turns on an invoices app. Turn 4 added an unbounded in-memory cache to invoices.ts, memory climbed about 38 MB per sample for two turns, and the autopsy named the turn. Step through it, or roll the file back yourself.
Demo session · invoices app
7 turns recordedSampled from /api/health: cpu, rss, heap, uptime
Current step: t5
Timeline
shadow commits, HEAD untouchedCode city · height is churn, color is health
Memory
change per sample, two samples per turn| Turn | Sample | Change since previous sample |
|---|---|---|
| t1 | 1 | baseline |
| t1 | 2 | 0 MB |
| t2 | 1 | 0 MB |
| t2 | 2 | 0 MB |
| t3 | 1 | 0 MB |
| t3 | 2 | 0 MB |
| t4 | 1 | 38 MB |
| t4 | 2 | 38 MB |
| t5 | 1 | 38 MB |
| t5 | 2 | 38 MB |
Diff
change in t5| 1 | added | export async function renderInvoicePdf(invoice: Invoice) { | |
| 2 | added | const doc = new PDFDocument({ size: 'A4' }) | |
| 3 | added | doc.fontSize(18).text(`Invoice ${invoice.number}`) | |
| 4 | added | invoice.lines.forEach(line => doc.fontSize(11).text(line.label)) | |
| 5 | added | doc.end() | |
| 6 | added | return toBuffer(doc) | |
| 7 | added | } |
Renders an invoice to PDF behind a new download route.
Autopsy
Regression foundThe regression first appears at t4. lib/invoices.ts is the blamed file.
- Blamed turn
- t4 · Speed up invoice lookups.
- File
- lib/invoices.ts
- Cause
- Unbounded in-memory cache
- Threshold checkMemory crossed the session threshold during t5.
- Trend slopeAbout +38 MB per sample across t4 and t5.
- Per-turn bisectThe regression first appears at t4.
Preview the fix prompt
Fix prompt for your agent
Ghost autopsy: turn 4 ("Speed up invoice lookups") added an unbounded in-memory cache to lib/invoices.ts. The cache key includes Date.now(), so every request adds an entry and nothing is ever evicted. Memory climbed about 38 MB per sample for two turns, until lib/invoices.ts was rolled back to its t3 version. Re-apply the speed-up without the leak: use a stable cache key, cap the number of entries and expire old ones. Keep the signature of listInvoices unchanged, then re-run the health probe and confirm memory stays flat.