Skip to content

feat(cloudflare): Trace Clef calls in Workers AI as evaluate spans - #25027

Open
JPeer264 wants to merge 4 commits into
developfrom
jp/cloudflare-workers-ai-clef-test
Open

JPeer264 wants to merge 4 commits into
developfrom
jp/cloudflare-workers-ai-clef-test

Conversation

@JPeer264

@JPeer264 JPeer264 commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Cloudflare documents Clef (@cf/cloudflare/clef) as a drop-in for Jev with the same state + questions request shape. Released versions trace Clef as evaluate only because of that shape. #25033 now finds evaluation models by model ID, so without this change Clef calls would become chat spans. This adds the Clef model ID to the evaluate detection, plus a Clef integration test and a real-Worker E2E test.

The integration mock returns the documented Clef response, which has no { state, result } wrapper (the Jev binding response has one). That makes it cover the unwrapped branch of the evaluate response handling, which the Jev test does not reach. The E2E test calls the real model, so it is the one that confirms what the binding actually returns. The docs do not give a model value for the response, so it only asserts that it contains clef.

Fixes #25011

🤖 Generated with Claude Code

Cloudflare documents Clef as compatible with the Jev API, but only Jev
calls had tracing tests. The integration test mock returns the documented
Clef response, which has no `{ state, result }` wrapper, so it also covers
that branch of the evaluate response handling. The E2E test calls the real
model to verify the response shape that the binding returns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JPeer264
JPeer264 marked this pull request as ready for review October 5, 2026 06:24
@JPeer264
JPeer264 requested a review from a team as a code owner October 5, 2026 06:24
@JPeer264
JPeer264 requested review from andreiborza and mydea and removed request for a team October 5, 2026 06:24
@JPeer264 JPeer264 self-assigned this Oct 5, 2026
status: 'ok',
is_segment: false,
attributes: {
'sentry.origin': { value: 'auto.ai.cloudflare.workers_ai', type: 'string' },

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.

l: sentry.origin / sentry.op / sentry.is_localhost should all be in conventions so we could use the consts from there directly

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JPeer264
JPeer264 enabled auto-merge (squash) October 5, 2026 09:34
JPeer264 and others added 2 commits October 6, 2026 09:17
Trace `@cf/cloudflare/clef` calls as `evaluate` spans. Since evaluation
models are detected by model ID instead of the `state` + `questions`
input shape, Clef calls became `chat` spans.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JPeer264 JPeer264 changed the title test(cloudflare): Add Workers AI tracing tests for Clef feat(cloudflare): Trace Clef calls in Workers AI as evaluate spans Oct 6, 2026
@JPeer264
JPeer264 requested a review from nicohrubec October 6, 2026 07:24
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 29.6 kB - -
@sentry/browser - with treeshaking flags 27.75 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.65 kB - -
@sentry/browser (incl. Tracing) 51.52 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 51.52 kB - -
@sentry/browser (incl. Tracing, Profiling) 54.5 kB - -
@sentry/browser (incl. Tracing, Replay) 91.14 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 80.12 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 95.83 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 108.83 kB - -
@sentry/browser (incl. Feedback) 47.12 kB - -
@sentry/browser (incl. sendFeedback) 34.65 kB - -
@sentry/browser (incl. FeedbackAsync) 39.76 kB - -
@sentry/browser (incl. Metrics) 30.61 kB - -
@sentry/browser (incl. Logs) 30.89 kB - -
@sentry/browser (incl. Metrics & Logs) 31.55 kB - -
@sentry/react 31.43 kB - -
@sentry/react (incl. Tracing) 53.84 kB - -
@sentry/vue 37.55 kB - -
@sentry/vue (incl. Tracing) 54.4 kB - -
@sentry/svelte 29.63 kB - -
@sentry/remix (Remix 3 client bundle) 55.85 kB - -
CDN Bundle 31.33 kB - -
CDN Bundle (incl. Tracing) 52.07 kB - -
CDN Bundle (incl. Logs, Metrics) 33.56 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 54.03 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 74.3 kB - -
CDN Bundle (incl. Tracing, Replay) 89.67 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 91.62 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 95.83 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 97.8 kB - -
CDN Bundle - uncompressed 92.46 kB - -
CDN Bundle (incl. Tracing) - uncompressed 154.77 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 99.04 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 160.72 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 228.66 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 274.58 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 280.52 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 288.28 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 294.21 kB - -
@sentry/nextjs (client) 56.19 kB - -
@sentry/sveltekit (client) 51.9 kB - -
@sentry/core/server 40.52 kB - -
@sentry/core/browser 13.51 kB - -
@sentry/node 145.02 kB +0.01% +4 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.22 kB - -
@sentry/node - without tracing 93.46 kB +0.01% +4 B 🔺
@sentry/node - without channel injection 123.17 kB +0.01% +5 B 🔺
@sentry/aws-serverless 101.69 kB +0.01% +1 B 🔺
@sentry/cloudflare (withSentry) - minified 209.08 kB +0.02% +41 B 🔺
@sentry/cloudflare (withSentry) 517.86 kB +0.03% +105 B 🔺

View base workflow run

andreiborza added a commit that referenced this pull request Oct 6, 2026
…s constant (#25070)

## What

Bugbot now flags attribute names and span ops written as strings (e.g.
`'sentry.origin'`) when `@sentry/conventions` has a constant for them.
The rule applies to SDK source and to tests.

## Why

Reviewers often have to point this out by hand, for example in
#25027 (comment).

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Workers AI tracing test for Clef

3 participants