Menu

Human-in-the-Loop AI Drafts in n8n Without the Mess: One Pending Draft per Customer, Stale Expiry and Out-of-Order Webhooks (2026)
📰

Human-in-the-Loop AI Drafts in n8n Without the Mess: One Pending Draft per Customer, Stale Expiry and Out-of-Order Webhooks (2026)

DEV Community: postgres·Viet Automation·16 days ago
#iT25CSe7
#devtopostgresql#devto#dev#draft#draft_key
Reading 0:00
15s threshold

Short answer: give every draft a deterministic draft_key (hash of the customer or record plus the action type), keep at most one pending draft per key with a partial unique index, ignore webhook events that are older than the draft you already hold, expire drafts nobody reviewed after 48 hours, and only send from an approval webhook that flips pending to approved atomically.

Why this keeps happening

A common pattern in automation communities: teams add a human review step for safety, then the next run stacks a second and third draft on top of the first, a retried webhook creates a duplicate, an older event arrives late and overwrites a newer draft, and a reviewer approves something stale.

The four failure modes and the fix

Failure What the reviewer sees Fix

Rerun stacks drafts 3 drafts for the same customer draft_key + partial unique index WHERE status='pending' , upsert instead of insert

Webhook retried Duplicate draft and duplicate Slack ping seen_events table keyed by a hash of the raw payload, ON…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.