Learn from the dual-writer data-loss incident
Status: Ready
Article ID: 111
Truth label: Historical
Audience: Control-plane engineer
Reader outcome: Explain why local JSON state failed under two Central processes.
Related articles: 004, 055, 056
Target week: 45
Last verified: 2026-09-13
Technical reviewer: Codex incident evidence audit
Editorial reviewer: Codex editorial audit
Problem
Two Forge Central processes wrote the same local JSON task state. Each process held an in-memory view, so a later save could replace work written by the other. The incident produced confirmed task-state loss.
Misleading success signal
Each process could start, serve requests, and write a valid JSON file. Local tests and successful API responses did not prove there was one active writer or that a read-modify-write cycle preserved another process's update.
Evidence
The changelog records the first confirmed dual-writer loss and the affected urgent task state. The state-transaction design traces the failure to separate process views and non-transactional file replacement.
Correction
Forge moved authoritative task state to transactional SQLite and added a process-level writer lock. Central rejects a second active writer for the same native data root.
Mechanical prevention
Test two Central startups against one scratch root and require the second to fail. Exercise concurrent claims and terminal writes under transaction. Keep the store on a native filesystem and verify backup and restore separately.
Current status
One active Central writer per native data root is the supported design. This protects authoritative state. It does not provide distributed leader election across hosts. Checkout collision, which this incident did not address, was closed separately: Central now admits one run per registered working tree, skipping a held tree at routing time and refusing it inside the claim transaction.
Current limits
Historical evidence explains the design change, not every possible storage failure. Filesystem corruption, incomplete backup, and checkout collision still need their own controls.
Next lesson
Continue with The wrong data-root migration lesson.
Derivative map
- Weekly package: WEEK-45
- Long video: VIDEO-W45-LONG
- Shorts: SHORT-W45-PROBLEM, SHORT-W45-MECHANISM, SHORT-W45-WARNING
- Email: EMAIL-W45
- LinkedIn: LI-W45-A, LI-W45-B
- X: X-W45-A, X-W45-B
- Visual: VISUAL-W45
Review record
- Past JSON behavior and current SQLite correction remain distinct.
- Incident evidence and misleading green signals are named.
- Two-writer prevention has a mechanical scratch-root test.
- Checkout and distributed-leader limits remain explicit.
Review completed: 2026-08-27
Re-audited against the running product: 2026-09-13