ibuildinpublic
Log inStart free
ibuildinpublic
Log inStart free
BuilderProductExperiences24Posts12

One conversation created the same order twice. Our guard was on a different path

What failedNov 14, 2026
Konstantinos G

by Konstantinos G

@emarkssLvl 7·Active Builder

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

2likes2comments22Impressions
1Bookmark
Sign in to interact
Sign in to reply

2 replies

Mark Rosario
Mark Rosario@markrosarioLvl 9·Dedicated·Nov 15
The part that stuck with me is the guard sitting on the wrong path — easy to assume a check covers everything when it only covers one route. Making the claim expire so a half-finished request can't block a sale is a smart touch.
commentslikes
Tito Kiragu
Tito Kiragu@tito_kiraguLvl 8·Shipper·Nov 14
The check-then-claim slot is the part that holds up here, since the second request gets a definite answer instead of a race it can lose quietly. The failure only shows up with real users doing slightly odd things, which is exactly when it costs money. Did the duplicate come from a retry on the user side or the model calling the order tool twice?
1commentslikes