Tolerate previews of Workers that cannot have preview URLs - #39
Conversation
Cloudflare never generates preview URLs for Workers that implement a Durable Object, Containers included — `versions upload` succeeds with a Version ID and no URL. The metadata step treated the missing URL as missing metadata and failed the whole preview, which makes cloudflare-pr unusable for any DO/Container consumer (first hit: burnt-labs/ai-gateway PR #9, whose Worker hosts two Container classes). A preview with no URL now falls back to the target URL and carries an explanatory note: a new preview-note output travels through cloudflare-version.yml to the PR comment and the step summary, so the link is never mistaken for an isolated preview. Deploys are unchanged, and a missing Version ID still fails.
There was a problem hiding this comment.
2xburnt has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
There was a problem hiding this comment.
Pull request overview
This PR updates the Cloudflare reusable workflow stack to handle operation: preview runs where Wrangler succeeds but emits no preview URL (notably for Durable Object / Container Workers), ensuring previews don’t fail and callers can communicate the fallback clearly.
Changes:
- Add a
preview-noteworkflow output and propagate it throughcloudflare-version.yml→cloudflare-pr.ymlso PR comments/summaries can explain when a preview URL is unavailable. - Update the metadata extraction logic in
cloudflare-version.ymlto fall back to the target URL for previews that produce no preview URL, while keeping deploy behavior strict. - Add a regression test asserting the fallback behavior and output plumbing.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/workflows.test.mjs | Adds a regression test to assert the preview-URL-missing fallback and that preview-note is wired through to cloudflare-pr.yml. |
| .github/workflows/cloudflare-version.yml | Implements preview URL fallback behavior and adds a new preview-note output (plus step summary surfacing). |
| .github/workflows/cloudflare-pr.yml | Threads preview-note into the sticky PR comment content. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | ||
| env: | ||
| PREVIEW_URL: ${{ needs.preview-candidate.outputs.deployment-url }} | ||
| PREVIEW_NOTE: ${{ needs.preview-candidate.outputs.preview-note }} | ||
| RELEASE_PREFIX: ${{ fromJSON(needs.quality.outputs.deployment-policy).releasePrefix }} |
There was a problem hiding this comment.
2xburnt has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
There was a problem hiding this comment.
2xburnt has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
There was a problem hiding this comment.
2xburnt has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a5ca8e0d6c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| DEPLOYMENT_URL="$TARGET_URL" | ||
| PREVIEW_NOTE="no preview URL: Cloudflare does not generate them for Durable Object Workers; the version is uploaded at 0% traffic and the URL above is the live target" |
There was a problem hiding this comment.
Propagate fallback notes to main-flow release notes
When a Durable Object consumer runs cloudflare-main.yml, both the single-topology deploy-candidate preview and the default preview-release job can take this fallback, but only cloudflare-pr.yml consumes preview-note. The create-releases step at lines 131-143 therefore records the live target URL as either “Candidate deployment” or “Release preview” without the warning, making the generated release notes claim that a 0%-traffic version is reachable there. Pass preview-note into create-releases and surface it or relabel the fallback URL.
AGENTS.md reference: AGENTS.md:L615-L628
Useful? React with 👍 / 👎.
| jobs: | ||
| quality: | ||
| uses: burnt-labs/github-workflows/.github/workflows/required-quality.yml@46ae18b0f5ff1735e07601e41a6044b358379853 # v1.4.0 | ||
| uses: burnt-labs/github-workflows/.github/workflows/required-quality.yml@ffc9220f81438c2537163f041f117d3097738fed # v1.4.1 |
There was a problem hiding this comment.
Split the internal pin advance into its own commit
This commit combines the preview implementation and its regression test with repository-wide updates from v1.4.0 to ffc9220f..., so the implementation and pin transition cannot be reviewed or reverted independently. Move the uses: and checkout ref: changes into the explicitly required separate pin-advance commit.
AGENTS.md reference: AGENTS.md:L683-L688
Useful? React with 👍 / 👎.
| preview-note: | ||
| value: ${{ jobs.version.outputs.preview-note }} |
There was a problem hiding this comment.
Sign this commit before merging
The raw object for c4996ee8cb5ef710a2adea3021817d04b9b174f4 contains no gpgsig header, so this proposed commit is unsigned and violates the repository's mandatory signing invariant. Recreate the commit with a valid signature before it is merged.
AGENTS.md reference: AGENTS.md:L52-L56
Useful? React with 👍 / 👎.
| # GitHub Environment and the PR comment point somewhere real, | ||
| # and carry a note so nobody mistakes it for the preview. | ||
| DEPLOYMENT_URL="$TARGET_URL" | ||
| PREVIEW_NOTE="no preview URL: Cloudflare does not generate them for Durable Object Workers; the version is uploaded at 0% traffic and the URL above is the live target" |
There was a problem hiding this comment.
Avoid attributing every missing URL to Durable Objects
A preview can lack a URL simply because the consumer has preview_urls disabled, even when its Worker has no Durable Objects. In that configuration this fallback still runs, but the PR comment and job summary falsely state that Cloudflare withheld the URL because this is a Durable Object Worker. Use a reason-neutral note unless the workflow can actually distinguish the Worker limitation from disabled preview URLs.
AGENTS.md reference: AGENTS.md:L620-L624
Useful? React with 👍 / 👎.
Problem
cloudflare-version.yml's metadata step requires a deployment URL for every operation. Foroperation: previewthat URL comes from wrangler's output — but Cloudflare never generates preview URLs for Workers that implement a Durable Object, Containers included.versions uploadsucceeds (Version ID and all), no URL is printed, and the step fails with "Cloudflare output did not contain version metadata" — socloudflare-pr.ymlis unusable for any DO/Container consumer.First hit in the wild: burnt-labs/ai-gateway#9, whose Worker hosts two Container classes.
Change
preview-noteoutput explaining that Cloudflare issues no preview URLs for Durable Object Workers and the version sits at 0% traffic.cloudflare-pr.ymlsticky comment and the step summary, so the fallback link is never mistaken for an isolated preview.Verification
pnpm lint(prettier),pnpm test(82 pass, including a new regression test asserting the fallback, the output plumbing, and the PR-comment wiring), andactionlintall clean.