The TripleWriteOrchestrator (lib/triple-write-orchestrator.ts) is a Saga-pattern implementation that coordinates multi-step write operations with automatic rollback on failure.
Each step races against its own timeout via Promise.race. If a Convex mutation hangs due to a slow network, the timeout fires and the orchestrator skips to the rollback phase.
Steps are rolled back in reverse order. If Step 2 fails, Step 1’s compensating function runs. If a compensating function itself fails, the rollbackFailed flag is set, signaling HydrationSync to perform a full reconciliation on the next cycle.