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

Cloudflare Worker Image Download Stream Error Recovery
Learn how to keep a Cloudflare Worker image selection pipeline running when an HTTP response stream fails after headers return successfully.

Monitor Serverless Publishing Without Triggering It
Learn how to build a read-only operator dashboard for serverless publishing workflows on Cloudflare Workers without risking duplicate runs.

SonarCloud LCOV Imports Fail When Paths Drift
Fix SonarCloud LCOV import failures when report paths drift in monorepos by aligning working directories, root resolution, and source file references.