Publishing Workflow Recover After Duplicate Draft
Learn how to recover a publishing workflow when its selected draft is archived as a duplicate before any public write occurs, utilizing child budget reservations and architectural option analysis.
Table of Contents4 sections

A scheduled publication may first select a revision, while a later exact duplicate check archives that draft and finds zero publishable output, requiring explicit recovery steps.
Quick solution:
curl -X PATCH -H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/owner/repo/git/refs/heads/main \
-d '{"sha":"NEW_COMMIT_SHA","force":false}'
Prerequisite: Ensure that no public write has been committed before updating the reference, as detailed in the official GitHub REST API update a reference docs.
When a publishing run treats any archive write as a completed publication, it wastes a slot that still has its candidate phase available. By adhering to the operational rules of Workflows, engineers can prevent silent failures during automated runs.
Understanding Duplicate Draft Archival
When automated pipelines evaluate incoming content, exact duplicate detection routines may flag and archive a selected draft. If this happens prior to any public write or deployment step, the workflow must be able to switch execution tracks. Continuing to treat an archived duplicate as a success leaves the slot underutilized and prevents valid content from reaching production. For instance, developers can Target a Cloudflare Workflow Run to One Source to isolate state transitions and avoid overlapping concurrency issues.
Architectural Options for Duplicate Recovery
When evaluating how to handle duplicate draft archival without public writes, several patterns emerge. Each option carries distinct failure modes and trade-offs.
| Option | When to Use It | Trade-Off or Failure Mode | Recommendation |
|---|---|---|---|
| Immediate Force Overwrite | When pipeline speed is prioritized above history verification. | Risks overwriting valid intervening commits if state checks fail. | Avoid in high-concurrency environments. |
| Bounded Replacement Run | When duplicate checks yield zero public output and budget remains. | Consumes child request slots and requires strict budget reservation. | Recommended for controlled publishing pipelines. |
| Manual Intervention Queue | When automated recovery confidence is low. | Introduces human latency into the publishing lifecycle. | Use only as a fallback for anomalous failures. |
Budget Reservation and Execution Logic
To prevent replacement runs from failing due to exhausted resources, pipelines must account for request prefixes and child budget constraints. Below is the pseudocode illustrating the 10+10-request prefix and child budget reservation logic for duplicate recovery scenarios:
function evaluateDuplicateRecovery(parentWorkflow, archiveReceipt, childBudget):
prefixRequests = parentWorkflow.fetchPrefix(10)
replacementBuffer = parentWorkflow.fetchBuffer(10)
if archiveReceipt.publicWrites == 0 and archiveReceipt.status == "archived_duplicate":
requiredBudget = prefixRequests.length + replacementBuffer.length + 2
if childBudget.remaining >= requiredBudget:
childBudget.reserve(2)
return executeReplacementCandidate()
else:
raise BudgetExhaustionError("Insufficient child budget for safe replacement")
else:
return terminateWorkflowCleanly()
end function
Execution Verification Checklist
- Confirm that the initial draft status reads as archived due to duplication with zero public writes.
- Verify that the 10+10 request prefix and child budget reservation logic successfully lock the required two slots.
- Inspect the child budget to ensure sufficient request capacity remains before triggering a replacement.
- Execute the Git reference update with force set to false to protect existing history.
You Might Also Like
View all articles
Reconcile a Git Ref Update After a Timeout
Learn how to safely recover from ambiguous Git reference update timeouts by implementing a three-way verification check to prevent duplicate work.

Retry Scheduled Publishing After Failure
Learn how to retry scheduled publishing after failures without double-publishing by separating attempt status, success streaks, and trial admission with source cooldowns and expiry bounds.

Deferring Publication After a Budget-Safe Draft Revision
Learn how to preserve a serverless publishing workflow draft when request limits prevent same-run publication by deferring publication.