Skip to content

[wrangler] Add SQL example to the agent-facing observability query hint - #14918

Merged
NuroDev merged 5 commits into
cloudflare:mainfrom
nickpatt:local-explorer-query-hint-example
Jul 30, 2026
Merged

[wrangler] Add SQL example to the agent-facing observability query hint#14918
NuroDev merged 5 commits into
cloudflare:mainfrom
nickpatt:local-explorer-query-hint-example

Conversation

@nickpatt

@nickpatt nickpatt commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

When a wrangler dev session is detected as running inside an AI agent, Wrangler prints a hint pointing at the Local Explorer API. This improves the line for the observability query endpoint (POST /local/observability/query), which previously just said "query request traces and console logs" — giving an agent no idea how to actually call it.

The hint now:

  • explains the endpoint takes a read-only SQL query (SELECT/WITH only) over the captured spans and logs tables,
  • notes that attributes is JSON (read via json(attributes)), which agents can't infer from column names alone,
  • includes a copy-pasteable curl example that also documents the {"sql": "..."} request body shape,
  • demotes the full OpenAPI schema to a last-resort footer, so agents reach for the small, actionable example first instead of fetching the large (~23k token) schema.

The example conveys the endpoint usage, request envelope, table names, and the root-span filter (parent_id IS NULL) far more succinctly than embedding the whole schema.


  • 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: this only changes local dev CLI output (an agent-facing hint); there is no public API or documented surface change.

Open in Devin Review

@changeset-bot

changeset-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 072cbc9

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-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Jul 29, 2026
@workers-devprod
workers-devprod requested review from a team and petebacondarwin and removed request for a team July 29, 2026 17:52
@workers-devprod

workers-devprod commented Jul 29, 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

@pkg-pr-new

pkg-pr-new Bot commented Jul 29, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

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

@cloudflare/config

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

create-cloudflare

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

@cloudflare/deploy-helpers

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@14918

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-auth

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: 072cbc9

@petebacondarwin
petebacondarwin force-pushed the local-explorer-query-hint-example branch from 7ecf784 to 6ad6024 Compare July 30, 2026 09:31
devin-ai-integration[bot]

This comment was marked as resolved.

@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 30, 2026
@petebacondarwin petebacondarwin self-assigned this Jul 30, 2026
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration[bot]

This comment was marked as resolved.

NuroDev and others added 2 commits July 30, 2026 11:07
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@petebacondarwin
petebacondarwin force-pushed the local-explorer-query-hint-example branch 2 times, most recently from 0e05d90 to 9aa5902 Compare July 30, 2026 10:54
@NuroDev
NuroDev enabled auto-merge (squash) July 30, 2026 13:03
@NuroDev
NuroDev merged commit cc54478 into cloudflare:main Jul 30, 2026
55 checks passed
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Jul 30, 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