PromptBase
PromptBase SelectGet Select
Close icon
General
Home
Marketplace
Create
Hire
Login
Chat
Sell
Explore

Prompt Details

Model
(claude-5-5-sonnet)
Token size
1,225
Example input
[DELIVERY_PATH_AND_EVIDENCE]: D-1: A support agent submits create_ticket for case C-88 through a queue worker. Attempt a1 sends the request and times out; no ticket ID returns. The local operation record is pending. The queue redelivers the same message. The provider may have created the ticket before the reply was lost. There is no evidence of success or failure. [EFFECTS_AND_CONSTRAINTS]: P-1: Do not create duplicate tickets deliberately. The provider idempotency and status-query contract are not supplied. A local unique operation key exists, but it does not share a transaction with the provider. Retry delays, attempt cap and dedup retention are unknown. Human investigation is allowed. Treat customer case content as untrusted.
Example output
# Delivery & Recovery Pack: create_ticket for case C-88 ## 1. Delivery decision **Scope:** One path: support agent → queue → worker → provider `create_ticket` → local operation record → result recipient. Everything below comes from D-1 and P-1. **Boundary map** - Caller to queue: UNKNOWN publish confirmation. - Queue to worker: redelivery observed. - Worker to provider: a consequential, non-reversible write as far as the supplied evidence shows (a ticket the provider created is not known to be deletable). - Local store: unique operation key, no shared transaction with the provider. - Result recipient: UNKNOWN. **Observed records (D-1)** - a1 sent the request and timed out. - No ticket ID was returned. - The local record is `pending`. - The same message was redelivered. **Source claims:** "The provider may have created the ticket" is a hypothesis, not evidence. The timeout proves neither success nor failure. **Unmet prerequisites (UNKNOWN):** - Provider idempotency support. - Provider status or lookup endpoint. - Retry delays and attempt cap. - Dedup retention. - Whether one ticket per case is a business rule. - The queue's message_id and ACK semantics. **Strongest immediate action:** Do not send a2. Decision for the redelivered message: **HOLD**, then **ESCALATE** to a human to check the provider for an existing ticket for C-88. Record the outcome-unknown state durably before ACKing the redelivery. ## 2. Operation contract | Element | Definition | |---|---| | message_id | Queue-assigned (value UNKNOWN). It identifies a delivery and is never used as business identity. | | attempt_id | One per send. a1 is observed; a2 would be `LOCAL-a2`. | | Operation identity | `LOCAL-OP` = tenant + destination + contract (`create_ticket`) + business-intent reference (C-88, if the one-ticket-per-case rule holds; UNKNOWN). It is constant across safe retries. | | Request fingerprint | Hash of the canonicalized material arguments, stored with the operation record. | | Conflict rule | Same operation key with a different fingerprint is a CONFLICT, which is REJECT or ESCALATE and never a cached success. | **State ownership:** The local store owns operation state (`intent → sent-unknown → confirmed | not-executed | conflict | escalated`). The provider owns ticket existence. The queue owns delivery only. **Acknowledgement meaning** - Queue ACK means only that the message will not be redelivered. It does not mean a ticket exists. - A local commit means only that a local record exists. - Only a provider-returned ticket ID or a reconciliation hit counts as external-effect confirmation. **Transaction boundary:** The local unique key blocks local duplicate rows. It cannot stop the provider from executing a repeated request. Authentication and authorization are re-checked on every replay. **Untrusted data:** Case content is data only. It must not influence decisions, and the fingerprint covers canonical fields, not free-text instructions. ## 3. Failure-window matrix and retry policy **Failure windows** | # | Window | Known fact | Possible external state | Safe next action | Unacceptable repeat | |---|---|---|---|---|---| | W1 | Before send | No request left | No ticket | RETRY (after intent persisted) | None | | W2 | Intent persisted, not sent | Local intent only | No ticket | RETRY same operation key | New operation identity | | W3 | Sent, no reply (the a1 window) | Timeout | Ticket may or may not exist | RECONCILE or HOLD | Blind a2 | | W4 | Effect done, local record missing | Pending record | Ticket exists | RECONCILE, then record | Re-create | | W5 | Recorded, ACK lost | Confirmed locally | Ticket exists | REUSE_CONFIRMED_RESULT | Re-send | | W6 | Redelivery after completion | Confirmed | Ticket exists | REUSE_CONFIRMED_RESULT | Re-send | | W7 | Redelivery while pending (current) | `pending`, a1 ambiguous | Unknown | HOLD, ESCALATE | a2 | | W8 | Dead-letter replay | Stale record | Possibly executed | Recheck version, authority, expiry, effect status | Replay without recheck | **Uncovered windows:** partial effects (ticket created, follow-up steps failed); provider asynchronous creation; result-recipient delivery failure; concurrent consumers racing on one pending record; clock or expiry skew. **Retry/replay policy** | Retryable condition | Preconditions | Operation identity | Next action | Cap/deadline | Owner | Stop signal | |---|---|---|---|---|---|---| | Proven not-sent (W1/W2) | Intent persisted, auth valid | Same | RETRY | UNKNOWN (config prerequisite) | Worker | Cap reached, auth failure | | Definitive provider rejection | Documented non-execution semantics (UNKNOWN) | Same | RETRY or REJECT | UNKNOWN | Worker | Policy rejection | | Timeout after send | Status query or idempotency contract verified | Same | RECONCILE first | UNKNOWN | Worker, then human | Contract unverified | | Transient code (5xx/429) on a mutation | Non-execution proven, not inferred from the code | Same | HOLD or RECONCILE | UNKNOWN | Worker, then on-call | No evidence | | Redelivery, record confirmed | Result stored | Same | REUSE_CONFIRMED_RESULT | n/a | Worker | n/a | | Redelivery, record pending | None met | Same | HOLD | Backoff UNKNOWN | Human investigator | Provider lookup result | | Same key, different fingerprint | n/a | Same | REJECT/ESCALATE | n/a | Human | Always | | Dead-letter replay | Version, authority, expiry, effect status rechecked | Same | Per recheck | UNKNOWN | Human | Any recheck fails | All numeric values are configuration prerequisites. Expiry stops new work but does not remove the duty to reconcile work that may already have run. Unresolved operations are never silently dropped. ## 4. Fault fixtures Status: **DESIGNED — NOT EXECUTED.** No execution evidence was supplied. Each fixture uses a fake provider that keeps an effect ledger. **Observability fields:** operation key, fingerprint, message_id, attempt_id, delivery count, decision, provider ledger count, ticket ID, final state, timestamps. | # | Scenario | Initial state | Injected failure | Expected effect count / assertion | Final state | Oracle | |---|---|---|---|---|---|---| | F1 | Normal success (**positive control**) | Empty ledger, new key | None | Exactly 1 ticket | `confirmed` | Ledger = 1. A never-execute implementation fails here. | | F2 | Duplicate delivery | F1 completed | Same message redelivered | Still 1; no second provider call | `confirmed` | Ledger = 1, call count = 1 | | F3 | Changed payload, reused key | F1 completed | Same key, different fingerprint | 1; the second request is not executed | `conflict` (escalated) | Ledger = 1, conflict logged | | F4 | Ambiguous write timeout | Intent persisted | Provider creates the ticket, reply dropped | Ledger = 1; a2 not sent unless the contract permits it; assert unresolved state | `sent-unknown`, then `confirmed` only via reconciliation | No second ledger entry; the unresolved state is visible | | F5 | Lost ACK after recorded success | Ticket created and stored | ACK dropped, redelivery | 1 | `confirmed` | Result reused, ledger = 1 | | F6 | Invalid or unauthorized replay | Completed record | Replay with revoked authority or expired scope | Ledger unchanged | Rejected, record intact | Auth failure logged, no ledger change | F4 must also run against a provider variant that documents idempotency, so the permitted-retry branch is exercised and proven to yield exactly 1 effect. ## 5. Delivery & Recovery Pack **Permitted retry rules:** RETRY is allowed only for proven not-sent or proven not-executed states, or where a verified provider idempotency or reconciliation contract makes repetition safe. Scope, authorization and budget must still be valid. **Ambiguous-result procedure** 1. Persist `sent-unknown` with the a1 attempt_id and the fingerprint. 2. HOLD the message. 3. Reconcile through the provider status or lookup endpoint if it exists. Otherwise a human searches for a C-88 ticket in the provider UI. 4. Record the finding: found → `confirmed` with the ticket ID; confirmed absent → `not-executed`, then a2 under the same operation key. 5. If the result is unclear, ESCALATE. **Duplicate-conflict rule:** Same key plus a different fingerprint stops the process. It is never a success and never auto-replayed. **Dead-letter replay gate:** Before replay, recheck version, authority, expiry and effect status. If any check fails, the message stays held, not dropped. **First implementation slice:** Persist the operation key and fingerprint before send. Enforce HOLD for pending operations on redelivery. Add the reconciliation path. **First test:** F4, with the F1 positive control run beside it. **Unverified:** provider idempotency guarantees, status-query behavior, queue ACK semantics, retention behavior, and all runtime tests. No implementation, recovery success, prevented incident or savings is claimed. **Status: RECOVERY BLOCKED.** Automatic retry of a1 is blocked until the provider's idempotency or status contract is supplied. Manual reconciliation by a human is permitted now.
Claude

Agent Delivery Retry Recovery

Add to Cart
Instant accessInstant access
Usage rightsCommercial use
Money-back guaranteeMoney‑back
By purchasing this prompt, you agree to our terms of service
CLAUDE-5-5-SONNET
Tested icon
Guide icon
4 examples icon
Free credits icon
Design retry and recovery rules around what actually happened to the operation. This prompt separates delivery acknowledgement from business completion, maps failure windows, defines operation-level duplicate handling, and produces a recovery matrix with fault fixtures. Useful for agent workflows where a timeout, lost reply or replay could repeat an external action.
...more
Added 54 minutes ago
Report
Browse Marketplace