Deferring Publication After a Budget-Safe Draft Revision

Deferring Publication After a Budget-Safe Draft Revision

●1 ●2 ●67
calendar_today ago • schedule2 min read
— Originally published at raylabs.app

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.

1 Comment

0 votes
🔥 Join developers growing publicly
Share your knowledge, build in public, and grow your developer presence with a global community.

More Posts

AWS Lambda Is Dead. The $0.20 Was Never the Price.

GDS K S - May 11

Why I Ditched Redis for Cloudflare Durable Objects in My Rate Limiter?

horushe - Aug 30, 2025

Selecting the Latest Targeted Revision

raylabs - Oct 16

# Building a Serverless-Safe Realtime Metaverse for MyZubster

Myzubster - Sep 1

Anatomy of a Kestra Flow: How It All Fits Together

Amara Graham - Mar 19
chevron_left
1.2k Points • 70 Badges
Jakarta • raylabs.app
48Posts
4Comments
2Connections
Become pro soon

Commenters (This Week)

9 comments
2 comments
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!