Reliability
Keep a skill’s write safe to retry
Give each user-intended operation an identity that survives a timeout or repeated delivery.
The same user-intended operation can arrive twice. A client can lose the response, a queue can redeliver the job, or a user can resume a chat after a connection drops. The downstream service should be able to recognize the original intent and return its recorded outcome.
Bind identity to the intended action
Have the application create an operation key before the first attempt. Reuse it across retries of that action. Scope it to the authenticated caller and operation, and persist the request signature and outcome for an explicit retention period. A second request carrying the key and different parameters should receive a conflict rather than reuse a result from another action.
A hash of the request alone can confuse two legitimate requests that happen to share content. Conversely, generating a new key on each retry defeats deduplication. The boundary between a retry and a new user decision belongs in the application state.
Protect the write and the result together
Persist deduplication state and the business write atomically when they share a database. When the downstream service provides the idempotency contract, forward the same key and record the corresponding status identifier. For a timeout with no confirmed result, use an authoritative lookup and present the unknown outcome honestly if the service cannot resolve it.
Exercise concurrency explicitly
Send the same operation in parallel and induce a timeout after commit. Assert that both callers receive compatible results and that the durable state changed once. Verify that a deliberately new action with a new key behaves independently.