A support agent sends a reply. The helpdesk saves it, but the request times out before the agent gets a receipt. A retry sends the same message again. The customer sees two replies. If the evaluation grades only the agent’s last message, both runs can look like successes.
While rebuilding a support platform, I had to account for what a worker had already done before an operator took over. I use a smaller version of that problem to test a retry: one ticket, one reply that commits before a timeout, and a count of what reaches the ticket.
Run the committed-timeout case
The bundled Fakeplane demo uses a synthetic helpdesk. In a disposable project with Node.js 18 or later, run:
npx --yes fakeplane@0.1.1 demo
Look for the duplicate-reply scenario in the output. The naïve agent retries after the timeout and leaves two customer replies. The guarded example leaves one reply and passes the same assertion. The recording also shows the demo’s two refund scenarios. All three use fictional records.
Save the reply before returning the error
A stub that returns 504 before saving anything tells you whether the agent can retry an ordinary failure. To catch the duplicate, the fake must actually save the first reply before returning the timeout. Then the test can count the replies from outside the agent.
This is the fault and assertion excerpt. The seeded ticket and simulated inbound message belong in the same scenario file.
faults:
- op: zendesk.ticket.update
kind: timeout
committed: true
assert:
- name: customer gets exactly one reply
effects: zendesk.ticket.reply
where: { ticket_id: 1 }
count: 1
Run a second case in which the provider times out before saving. A worker that suppresses all uncertain retries might pass the first test and leave the customer unanswered in the second. The two cases need different handling and the same customer outcome.
| What happened at the provider? | What should the worker do? |
|---|---|
| Reply exists | Record that the original write succeeded. |
| Reply is confirmed absent | Retry under the same operation identity. |
| The result is still unknown | Look up the write or hand it to someone who can resolve it. Avoid a blind retry. |
Keep the operation identity stable
An operation identity belongs to the business event, such as replying to inbound message 123 on ticket 1. It should survive a second model call or worker run. If the provider supports idempotency keys, reuse the same key for the same write. If it can reliably expose the original effect, reconcile against the provider record. A row marked “pending” in your database can tell you a write was attempted. It cannot tell you whether the remote helpdesk saved it.
Start by testing whatever your agent sends most often. Seed one committed timeout and count what the customer receives. Make sure the test fails when a worker sends the same message twice. If your workflow also changes ticket status, give that change its own assertion.
If you’re trying to find tickets that never got a reply, start with what the help desk accepted. The SQLite shift-report example shows how to keep unanswered tickets in the count.
Fakeplane scenario reference · AWS Builders’ Library on safe retries · The support platform case
AI helped draft and edit this tutorial using the original project and its public demonstration.

Top comments (0)