By Orch8 Engineering · Editorial policy
Retry AI Generation Without Duplicate Drafts
Use a stable request ID for the draft and a different ID for each generation attempt. Record attempts separately and publish or supersede draft revisions through an explicit state change. A retry can produce new content without creating a second draft record.
What is the practical answer?
Use a stable request ID for the draft and a different ID for each generation attempt. Record attempts separately and publish or supersede draft revisions through an explicit state change. A retry can produce new content without creating a second draft record. For report request R-51, reserve draft D-51 before calling the model. An attempt represents one provider call with its own timing, model, and error. A draft represents the work the user intends to review. If a 503 or timeout creates another attempt, both still belong to D-51 unless a user expressly requested a different draft. Decide whether the first successful or latest authorized attempt wins. Two workers racing on one request can generate valid responses in different orders. Use a claim or conditional state change to prevent a late result from replacing an approved version.
Evidence: AWS Builders’ Library on making retries safe · Reddit retry and editorial review workflow discussion
- Reserve draft by request IDInput
- Log generation attemptsProcess
- Accept one authorized revisionDecision
- Send accepted draft to reviewExternal action
Give drafts and attempts different lifetimes#
Decide whether the first successful or latest authorized attempt wins. Two workers racing on one request can generate valid responses in different orders. Use a claim or conditional state change to prevent a late result from replacing an approved version. Keep a record of candidate outputs only as long as privacy and review requirements warrant.
| What you find | What to do |
|---|---|
| Provider returns a transient error | create another attempt under the existing draft. |
| Late result appears after a revision was accepted | retain it only if policy permits and leave the accepted revision unchanged. |
| User explicitly requests another draft | reserve a different request identity. |
Keep the review and publication boundaries separate#
Mark which revision is ready for review, then route approval to that revision. A later attempt can produce a candidate without reopening an already approved draft. Keep publishing outside the generation retry loop so a retry of text generation never independently repeats a CMS action. Use receipts to verify the latest accepted write.
Separate retry policy from revision policy#
Use an attempt log for provider timeouts, rate limits, and retry schedules. Keep draft state in a different record so operations can see whether the request is unstarted, generating, ready for review, or already accepted. A manual rerun may intentionally create another candidate, but only a version transition should make it the review subject.
If attempts run concurrently, bind each attempt to an expected draft version and accept a result under a conditional update. Keep a decision about which candidate wins, such as the first valid response for an open request. A publishing step should only read the approved version and can carry a separate receipt, keeping model retries out of the publication logic.
Verify it with a failure drill#
Make a model stub return 503 on attempt one and valid content on attempt two. Deliver the same request again after the draft has been accepted.
- Verify one draft record, multiple attempts, and one accepted revision. Return a late successful result from the first path and confirm it cannot overwrite the accepted version.
Sources and further reading
Official references support technical claims; community discussions are used only as problem signals.