Skip to content

feat(wrangler): surface Local Explorer API to headless agents#14688

Merged
NuroDev merged 12 commits into
mainfrom
NuroDev/le-agent-prompt
Jul 20, 2026
Merged

feat(wrangler): surface Local Explorer API to headless agents#14688
NuroDev merged 12 commits into
mainfrom
NuroDev/le-agent-prompt

Conversation

@NuroDev

@NuroDev NuroDev commented Jul 14, 2026

Copy link
Copy Markdown
Member

Fixes N/A.

This change updates the Wrangler CLI to make it so when an agent starts the dev server with wrangler dev it will print a message to the console informing the agent that the Local Explorer API exists and some endpoints it can use.


  • 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: Undocumented feature for agents

A picture of a cute animal (not mandatory, but encouraged)

🪼

@NuroDev NuroDev self-assigned this Jul 14, 2026
@changeset-bot

changeset-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 01750c1

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

This PR includes changesets to release 3 packages
Name Type
wrangler Minor
@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

@ask-bonk

ask-bonk Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Confirmed: logger.once history is NOT globally reset between tests, and this test file does not call logger.clearHistory(). The positive assertion test relies on running before any other test logs the identical message. Since Vitest may run/order tests and restoreMocks doesn't clear the singleton, this is a real test-robustness bug: if the test order changed or the file were split, the positive test could fail because the message was already cached. This is a legitimate, concrete issue with a concrete fix (add logger.clearHistory() to beforeEach).

Now let me consider whether this is truly a risk here. All negative tests assert .not.toContain. Only one test prints. So within this file, only one once.log call ever succeeds regardless of order — and it's the positive test. Order doesn't matter for correctness here since the other three never log. So actually it works reliably in the current file. It's a latent fragility, not a current failure. I'll note it as low severity.

Let me verify one final real concern: does getBooleanEnvironmentVariableFactory with defaultValue: true mean the hint prints even when X_LOCAL_EXPLORER is unset — which is the intended default (explorer enabled by default). Consistent. Good.

Let me do a final check: is detectAgent called unconditionally on every ready, potentially expensive? It's guarded behind cheaper checks (showLocalExplorerAgentHint, isHeadless, remote, env) due to short-circuit || with !detectAgent().isAgent last. Good ordering — cheap checks first.

The implementation is correct. The routes are accurate, gating logic is sound, env checks correct, URL construction correct. The only observations are minor test-robustness (latent, not currently failing) and a redundant once. Neither is actionable per the "be pragmatic, don't nitpick" guidance.

Let me do one last verification that X_LOCAL_EXPLORER default and the gating make sense — if a user disables the explorer via env, the hint correctly won't print. And if remote, won't print. All correct.

The code is correct, well-tested, and follows repo conventions. No logic bugs, security issues, backward-compat violations, or incorrect API behavior found. The routes match the actual explorer worker endpoints exactly.

LGTM

github run

@pkg-pr-new

pkg-pr-new Bot commented Jul 14, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

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

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@14688

create-cloudflare

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

@cloudflare/deploy-helpers

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-auth

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: c1c0a74

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

⚠️ Issues found

  • .changeset/fuzzy-tails-listen.md: Adding support for testing Streaming Tail Workers is a new feature, so the version bump should be minor rather than patch.

Comment thread packages/wrangler/src/dev.ts Outdated
@NuroDev
NuroDev requested a review from dario-piotrowicz July 20, 2026 12:42
@NuroDev
NuroDev marked this pull request as ready for review July 20, 2026 13:19
@NuroDev
NuroDev requested a review from workers-devprod as a code owner July 20, 2026 13:19
@workers-devprod

workers-devprod commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

devin-ai-integration[bot]

This comment was marked as resolved.

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@NuroDev
NuroDev enabled auto-merge (squash) July 20, 2026 13:23

@dario-piotrowicz dario-piotrowicz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM 😄 Thanks @NuroDev! 🙏

Comment thread packages/wrangler/src/dev/start-dev.ts Outdated
Comment thread packages/wrangler/src/__tests__/dev/start-dev.test.ts

@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 20, 2026
devin-ai-integration[bot]

This comment was marked as resolved.

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@NuroDev
NuroDev merged commit a0c8bb1 into main Jul 20, 2026
66 of 68 checks passed
@NuroDev
NuroDev deleted the NuroDev/le-agent-prompt branch July 20, 2026 17:54
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Jul 20, 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.

3 participants