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.
Table of Contents4 sections

A Cloudflare Workflow can spend most of its bounded external request budget before publication begins, risking partial failures when generation and publishing share a single run.
Quick solution:
if (!hasPublicationBudget) {
await commitDraftOnly(revisionData);
return { promotionDeferred: true, readyPath: revisionData.path };
}
Reserving candidate commit, promotion preflight, live checks, site writes, and vault finalization before model calls prevents generation from creating a draft that the same run cannot safely publish. When an explicit revision-only run cannot reserve the full tail, retain only the five-request draft commit reserve.
Understanding the Request Budget Conflict
Cloudflare documents strict subrequest ceilings on its free plan, while GitHub documents base tree writes for atomic tree changes via REST API endpoints for Git trees as outlined in the GitHub REST API Git trees documentation. When a workflow handles candidate commits, promotion preflights, and final vault writes, it can exhaust its budget before publishing.
For more details on platform limits, consult the Cloudflare Workflows limits documentation. The five-request commit budget and the later publish-only step are application safeguards rather than limits specified by either provider. For related architectural guidance, you can also review Managing Concurrent Git Commits During Automated Publishing.
Implementing a Deferred Publication Fallback
When a revision-only repair occurs, you have a different recovery option available. Instead of failing the entire run, commit the reviewed revision and promote that exact ready draft in a later run.
- Keep the full publication reserve unchanged for normal candidates and same-run promotion.
- When an explicit revision-only run cannot reserve the full tail, retain only the five-request draft commit reserve.
- Generate and review the revision, commit its Markdown, quality record, and raster metadata, then return the resulting ready-draft path with an explicit deferred publication result.
- Skip publication selection in that run. After it completes, use a separate publish-only run scoped to the exact ready-draft path.
- Keep manual live runs serial so a second workflow cannot race the vault SHA guard.
Verification and Execution Checklist
- Verify the five-request reserve constraint during low-budget execution.
- Confirm generation and commit succeed after the full publication reserve fails.
- Validate that the exact-path deferred result is correctly returned.
- Ensure manual live runs remain serial to prevent race conditions on the vault SHA guard.
Continue Exploring
You Might Also Like

Secure Public Receipt Link with Access Token
Learn how to build a privacy-safe public receipt link using high-entropy bearer tokens, SHA-256 hashing at rest, constant-time verification, no-store caching, and an explicit allowlisted response DTO.

Gating Cloudflare Worker Deployments With CI
Learn how to separate CI validation from Cloudflare Worker deployments by enforcing branch protection, required status checks, and quality gates.

Fix Cloudflare Workers Fetch Illegal Invocation
Learn how to resolve illegal invocation errors caused by detached fetch calls losing their receiver context inside the Cloudflare Workers runtime.