Define what counts as a repeated action

An AI assistant can prepare a tool call to create a work order. The application sends it to the executing service, waits for a response, and encounters a timeout. If processing happens again, the operational register may contain two work orders for one instruction. A useful way to test this application is to examine record counts, their contents, and their connection to the original operation.

Microsoft warns in its Azure Service Bus documentation that a send operation which times out may have succeeded. Missing confirmation therefore leaves the outcome uncertain. Redelivery becomes a separate test scenario even when an ordinary request works correctly.

Idempotency means that repeating one operation preserves the same intended effect. The responses can differ, as Microsoft separately notes in its API implementation guidance. Our acceptance criterion is straightforward: one accepted instruction should create one work order, however many times the executor receives its redelivery.

Prepare a record for one operation

Consider this original illustrative example. A fictional workshop receives a desktop fan with a damaged guard. The user asks it to create a work order for guard replacement without delivery. The expected outcome is one record containing the correct item, work, and handover method. All subsequent scenarios concern this example; no actual tests were conducted here.

Before execution, the application assigns an operation key to the accepted instruction. In the test record, include this key, the workshop identifier, action type, agreed parameters, processing state, and created work order number. Keep the association with a particular model call separately, so generating another response does not automatically imply a new instruction.

Establish two rules for the example. Redelivery retains the original key and parameters. A new independent instruction receives a new key, even when the user requests the same work again. The request text alone cannot reliably distinguish these situations: two identical fans may legitimately require two work orders.

Examine where the record is created

Microsoft's Idempotent Consumer guidance connects duplicate protection to a stable logical operation identifier. For changes within one database, it recommends committing the processing marker and the change in one transaction, with a uniqueness constraint protecting against concurrent duplicates.

Apply this to the workshop test: locate where the work order is created and where its association with the key is stored. Ask the developer to demonstrate two concurrent requests. Both handlers could observe that no record exists; the test should confirm that only one ultimately creates the work order and the other receives its stored number.

If an external system creates work orders, separately establish whether it supports an operation key for retries or lookup by your identifier. Record the documented reconciliation method. An application's local marker alone does not confirm that the external executor completed the action and retained the required association.

Investigate missing confirmation

In the illustrative example, the executor created a work order, but the response containing its number was lost. The application's operation record still says processing is underway. Define the expected continuation beforehand: the application checks the original operation with the executor and associates the discovered work order with the existing instruction.

If the executor confirms creation, the application returns the discovered number. If the absence of an action is confirmed and the API contract permits a safe retry, it uses the original operation. When the outcome cannot be established, retain an explicit uncertain state and a manual investigation path. Automatically issuing a new key in this scenario would require separate justification.

Prepare corresponding assistant messages. A creation confirmation is appropriate after verification. Before reconciliation, a message explaining that verification is continuing is suitable. In the test scenario, the operator should see which instruction is being checked, where to look for its result, and why another creation attempt is currently blocked.

Build redelivery scenarios

Start with an empty test register and ordinary creation: one correct work order should appear. Then separately test two sequential deliveries of one instruction. Expect one record and the same result number. Repeat the scenario after restarting the application to check that the key-to-order association survives.

The next scenario involves two concurrent deliveries. Count the records after both finish. Then simulate a lost response after work order creation and perform the defined reconciliation. For each scenario, record the expected operation state, work order count, and user-facing message beforehand. Restore the test environment's initial state between independent scenarios.

Add two boundary checks. Retain the original key but change the delivery parameter: expect a detected conflict without silently altering the work order. Then submit two independent instructions with identical contents and different keys: two work orders should appear. This checks both duplicate protection and the preservation of legitimate new actions.

Accept results against the operational register

Anthropic recommends pairing tool evaluation tasks with a verifiable response or outcome. Here, the workshop register provides that outcome. After each scenario, verify record counts, work parameters, and stored numbers; a polished assistant message provides insufficient evidence for acceptance.

Keep the original instruction, delivery sequence, artificial failure point, expected outcome, and observed discrepancy in the test log. These checks can use prepared calls, replacing the model with test data. This allows investigation of the handler without generations. In the SeaGenera API, the client application executes functions, so this protection is tested within that application.

Include limitations in the release decision. Testing work order creation does not establish that a subsequent notification is sent only once: that needs its own scenario. Record how long operation associations are retained and test a late redelivery around that boundary. If the external executor cannot establish the outcome, uncertainty should remain visible until investigated.

Sources