On 7 August, one conversation created the same order twice in a real Shopify store. Then it happened again.
We had a guard. It guarded one path, and the AI's own order tool took another.
Two fixes:
The "order done" marker is written only after Shopify returns a real order, with its real name.
Two requests can arrive at once: a double tap, two tabs. Both read "no order yet." So one database transaction checks for a finished order, checks for a live claim, and stamps a claim, in a single step. The claim expires, so a request that dies halfway can't block a sale for good. And if the database itself fails, the order goes through and the failure is logged loudly. A duplicate costs a refund. A blocked purchase costs the sale.
Then the incident became a rule the build enforces: call an order-write function without await, and CI fails.
What I took from it: a guard protects the path it sits on, not the path the money takes. When an AI gets its own tool for an action, check that every guard on the old path is on the new one too.
The code, the CI rule and the other walls behind our Shopify agent, in the X Article: https://x.com/con_golias/status/2121352219635159234
