
The import stopped answering after it saved the stock movements. From the agent's side of the connection, the only thing that arrived was a timeout. Sending the file again would look like progress until someone compared the ledger with the shelf. An importer that adds stock movements can add the same delivery twice, with a clean success response on the second attempt.
Take a fictional warehouse receiving eight washers and three shelf brackets. The importer appends a movement for each line of the file. The receiving clerk authorizes one import of that delivery. Before the agent calls the importer, its runner saves an operation label, batch-41, with a fingerprint of the two rows and the destination. The label stays with the import through a worker restart. The fingerprint gives the runner a way to detect a changed request when it reads the result or considers a replay.
The HTTP standard gives clients a rule for automatically retrying requests that use a non-idempotent method. The client should have a way to know that repeating the request has the same intended effect as sending it once, or a way to determine that the original request never took effect. A timeout leaves both questions open. The next useful operation in the warehouse is a lookup by batch label. HTTP Semantics, section 9.2.2
Give that lookup a place in an outcome ledger. One operation gets one entry, with the label, destination, fingerprint and owner. Keep the time of each attempt and the observation it returned. The first observation for batch-41 is “reply timed out” and the disposition is unknown. The permitted action is to look for a final receipt at the inventory system that owns the write. A worker log that says “sent” establishes that the worker tried. The destination can tell you what landed.
When the destination returns a committed receipt for the same label and fingerprint, mark the import succeeded and retain the receipt. In the warehouse example the receipt accounts for both rows, and the import is closed. A current stock count of eight washers would be weaker evidence. Another delivery or an adjustment could have produced that count. The receipt gives the clerk something to tie to this delivery.
Discussion Topic:
After a timeout, can your importer show you a committed receipt, a confirmed rollback, or only that the client tried?
The failed branch needs evidence about the effect too. Give a second delivery its own label, batch-42, and interrupt the importer after it inserts the first row but before it commits. The importer confirms that it rolled back both the pending receipt and the row, and that the attempt is over. That result supports a failed disposition. If the original authorization still covers a retry and the transient fault has cleared, send the same request with the same label. Otherwise the receiving clerk decides what happens next.
A lookup that times out, an absent receipt while the importer could still be processing, or a receipt with the wrong fingerprint all leave the outcome unknown. Hold the write and record which check would resolve it. The clerk may need to inspect the destination's transaction records or ask the inventory system's owner which receipt counts as final. Even a read against the right database can be stale. In SQLite, an existing read transaction can keep seeing its earlier snapshot after another connection commits. SQLite transaction documentation
I would make lookup the default for this workflow. A documented idempotency contract can also let the client recover the result through an identical replay, within the scope and lifetime of the guarantee. A label that lives only in an agent's notes gives the importer nothing to enforce. A hash alone loses a distinction the warehouse cares about. Two approved deliveries can contain exactly the same rows. Amazon's published design uses a caller-supplied request identifier and checks for changed parameters under the same identifier. Amazon Builders' Library on making retries safe
In a disposable SQLite exercise, the destination gives the operation label a uniqueness constraint and saves the receipt and movements in one transaction. Putting the receipt in the same transaction matters when the importer fails between writes. SQLite commits the unit together or rolls it back together, so a receipt cannot survive without the rows it describes under this design. SQLite constraints · SQLite transactions
If the importer has already seen the label, it checks the fingerprint before returning the stored receipt. A changed quantity with the old label raises a mismatch. Suppose the clerk finds a ninth washer after the import commits. The clerk now has a stock correction to authorize, and can record the new operation against the original receipt. The imported file still tells the team what produced the current ledger entry.
The local replay exercise drops the reply immediately after the first commit. A lookup for batch-41 finds the receipt. A separate test deliberately sends the identical request again and receives that same receipt. The database still has one accepted import and two movements, for eight washers and three brackets. The rollback case for batch-42 leaves the first import's rows intact and adds neither a receipt nor a movement until the authorized retry. Those observations cover an in-memory database and a simulated lost response. An external queue, a remote inventory service or a downstream notification would need evidence for its own effects.
Waiting on an unknown import can stall a receiving desk. Backoff can space subsequent calls, and the clerk still needs a way to see what happened to the original batch. If the destination offers lookup by operation, keep the receipt available for as long as the batch can remain unresolved. If it offers a replay guarantee, check what the guarantee covers and when it expires before letting the client use it. The receiving clerk decides whether the available evidence settles the batch in front of them.
Give an AI agent the label, the allowed lookup and a place to record what it finds. It can point out that the receipt's fingerprint differs or draft a note naming the missing evidence. Put the retry condition in the runner that holds the write permission, and check the network client's retry settings as part of the same review. The owner can rehearse a lost reply, a confirmed rollback and an unavailable lookup before handing the workflow a live batch. Give the person on call a batch they can find before you give the agent permission to send it twice.
If this was useful, forward it to one engineer who needs less noise in their feed.

