Skip to content

[wrangler] Restrict name-ownership guard to Pages-to-Workers delegation#14616

Merged
penalosa merged 1 commit into
mainfrom
rollback-action
Jul 9, 2026
Merged

[wrangler] Restrict name-ownership guard to Pages-to-Workers delegation#14616
penalosa merged 1 commit into
mainfrom
rollback-action

Conversation

@penalosa

@penalosa penalosa commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Fixes a CI regression introduced by #14312.

The non-interactive name-ownership guard added in #14312 fired for any config-less CI deploy without --name:

const nameOwnershipUnverified =
    !config.configPath &&
    isNonInteractiveOrCI() &&
    (pagesToWorkersDelegation || !args.name);

The || !args.name clause meant a plain wrangler deploy in CI, with no config file and no --name (exactly what an autoconfigured project looks like when its generated config PR hasn't been merged yet), would abort with "A Worker named ... already exists in your account". This broke the intended repeat-autoconfig-in-CI flow.

This change limits the guard to the Pages-to-Workers delegation, where the target name is a Pages project name that must not clobber an unrelated Worker. Plain deploys once again deploy normally.

const nameOwnershipUnverified =
    !config.configPath && isNonInteractiveOrCI() && pagesToWorkersDelegation;

  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: the affected redirect behaviour is gated behind agent detection and remains experimental; this only restores prior deploy behaviour for autoconfigured CI projects.

The non-interactive name-ownership guard fired for any config-less CI deploy
without --name, which broke plain `wrangler deploy` for autoconfigured
projects (e.g. when the generated config PR has not been merged). Limit the
guard to the Pages-to-Workers delegation, where the target name is a Pages
project name that must not clobber an unrelated Worker.
@changeset-bot

changeset-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 974a023

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
wrangler Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-pool-workers Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

✅ All changesets look good

@ask-bonk

ask-bonk Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

The change is a clean, well-scoped rollback. The logic is sound:

  1. Before: guarded when pagesToWorkersDelegation || !args.name (too broad — caught plain CI deploys without --name).
  2. After: guards only pagesToWorkersDelegation.

The two existing tests (auto-generated name and carried-across --name) still pass pagesToWorkersDelegation: true and expect the abort. The new test exercises the previously-broken path (pagesToWorkersDelegation: false, no config, no name) and asserts a successful deploy. The comments are updated accurately, and a changeset is included with the correct patch bump.

I checked the consumer in validate-worker-props.tsfailIfWorkerNameTaken is only set from nameOwnershipUnverified, so narrowing the condition correctly disables the guard for plain deploys while keeping it for delegation. No backward-compat, security, or logic issues found. The test correctly mocks the subdomain/upload/deployments requests needed for the success path.

LGTM

github run

@pkg-pr-new

pkg-pr-new Bot commented Jul 8, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@14616

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@14616

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@14616

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@14616

miniflare

npm i https://pkg.pr.new/miniflare@14616

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@14616

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@14616

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@14616

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@14616

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@14616

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@14616

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@14616

wrangler

npm i https://pkg.pr.new/wrangler@14616

commit: 974a023

@penalosa penalosa marked this pull request as ready for review July 9, 2026 10:05
@penalosa penalosa requested a review from workers-devprod as a code owner July 9, 2026 10:05
@workers-devprod workers-devprod requested review from a team and jamesopstad and removed request for a team July 9, 2026 10:06
@workers-devprod

workers-devprod commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@emily-shen emily-shen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

argh. sorry about missing this the first time round

@workers-devprod workers-devprod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codeowners reviews satisfied

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Jul 9, 2026
@penalosa penalosa merged commit c782e2a into main Jul 9, 2026
75 of 77 checks passed
@penalosa penalosa deleted the rollback-action branch July 9, 2026 11:11
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants