"In distributed work, 'it ran twice' isn't a rare bug. It's Tuesday. Design so twice equals once."
Retries are the normal weather
Connections drop mid-command. Workers restart and re-pick their queue. A human clicks the button again because the spinner looked stuck. None of these are edge cases — they're the ordinary conditions of any work that crosses a network. If your operation is only correct when it runs exactly once, it isn't correct.
Per-host locks: one mutation at a time on a machine
A per-host mutation lock ensures two operations can't act on the same Mac simultaneously — an update and a reboot shouldn't interleave on one machine. Crucially, the lock is scoped to the host, not the whole fleet, so independent machines keep running in parallel. You serialize contention, not the whole world.
Idempotency keys: the same request twice is one effect
Every mutating request carries an idempotency key. The executor remembers keys it has already applied, so a replayed request — from a reconnect, a retry, a double-click — returns the first result instead of doing the thing again. One key, one effect, no matter how many times the request arrives.
Prefer commands you can verify apart from their exit code
An exit code can lie: a command can time out after it already succeeded, or return zero while its real effect never landed. So prefer operations whose success you can check independently. After a restart, don't trust that SSH returned 0 — confirm the service is loaded and its last-run timestamp advanced. Verify the world, not the return value.