[bot] Cloudflare Workers AI `queueRequest` (batch) inference is explicitly excluded from tracing
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 30/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- typescript
調査の方向性
Start in js/src/instrumentation/plugins/workers-ai-plugin.ts: the shouldTrace predicate at lines 111-116 currently rejects queueRequest, while DECISION_MODELS and the extraction check define the already-supported models. Read js/src/vendor-sdk-types/workers-ai.ts for the typed options and js/src/instrumentation/plugins/workers-ai-interceptors.ts for the run channel, then compare how existing traced run calls create spans. Done means queued submissions and later request_id polling produce trace spans with request/response and usage, aligned with the documented Cloudflare batch flow.
索引モデルが issue の本文から書いたものです。
説明
Summary
Cloudflare Workers AI's env.AI.run() binding supports an official asynchronous/batch inference mode via queueRequest: true (submit returns {status: "queued", request_id}; the same request shape is later resubmitted with only {request_id} to poll/retrieve results). This repo's Workers AI instrumentation explicitly detects this option and skips tracing whenever it is set — the exclusion is coded and typed, not an oversight, and it is also the one case in this audit where Braintrust's own published docs state outright that these calls are not traced.
What's missing
In js/src/instrumentation/plugins/workers-ai-plugin.ts, the shouldTrace predicate for the single run channel (lines 111-116) is:
shouldTrace: () =>
(extraction || DECISION_MODELS.has(args[0])) &&
!args[1]?.stream &&
!args[2]?.returnRawResponse &&
!args[2]?.websocket &&
!args[2]?.queueRequest,
with the adjacent comment (lines 109-110): "These models return JSON directly. Do not consume raw bodies or claim to trace an asynchronous submission or unsupported stream." So:
- Any call with
queueRequest: true(the initial async submission, and the later polling call) is unconditionally skipped — no span, no request/response capture, no usage metrics — even though the predicate's other condition (DECISION_MODELS/extractionmodel allow-list, lines 12-16 and line 101) is already satisfied. WorkersAIOptionsinjs/src/vendor-sdk-types/workers-ai.ts(lines 30-35) explicitly typesqueueRequest?: booleanalongsidereturnRawResponse?: booleanandwebsocket?: boolean, confirming this is a deliberately recognized, typed option rather than an unknown/unsupported shape.js/src/wrappers/workers-ai.ts(JSDoc, lines 6-18) documents the behavior directly: "Trace Clef and Clairic calls on a Workers AI binding. Other models and raw-response/streaming modes pass through unchanged." — batch/queued calls pass through completely untraced.
Note: Workers AI tracing in this repo is already narrowly scoped to the DECISION_MODELS set (@cf/cloudflare/clef, clef-flash, clef-omni) plus the clairic extraction model — this gap is specifically about those same already-in-scope models losing all tracing the moment a caller uses the batch/queue submission mode that Cloudflare officially supports for Workers AI inference generally.
Braintrust docs status
Explicitly documented as excluded (stronger than not_found). https://www.braintrust.dev/docs/integrations/sdk-integrations/cloudflare.md states: "Calls to other models, and calls that stream, return a raw response, use a WebSocket, or queue the request, pass through unchanged," and instructs users to "wrap the AI binding with wrapWorkersAI() and call run() on the wrapped binding." Braintrust's own docs affirmatively tell users that queued (batch) Workers AI calls will not be traced.
Upstream sources
- https://developers.cloudflare.com/workers-ai/features/batch-api/ — overview of the Workers AI Batch API.
- https://developers.cloudflare.com/workers-ai/features/batch-api/workers-binding/ — exact binding usage:
env.AI.run(model, { requests: [...] }, { queueRequest: true })returns{ status: "queued", request_id, model }; poll/retrieve by resubmittingenv.AI.run(model, { request_id: "..." }); documents a 10 MB payload constraint. - https://developers.cloudflare.com/workers-ai/features/batch-api/rest-api/ — equivalent REST shape (
queueRequest=truequery param; final response contains aresponsesarray withid,result,success,external_reference, plus ausageobject).
Braintrust docs sources checked
- https://www.braintrust.dev/docs/integrations/sdk-integrations/cloudflare.md
- https://www.braintrust.dev/docs/guides/tracing/integrations
Local repo files inspected
js/src/instrumentation/plugins/workers-ai-plugin.ts—DECISION_MODELS(lines 12-16),shouldTracepredicate (lines 111-116), extraction model check (line 101)js/src/vendor-sdk-types/workers-ai.ts—WorkersAIOptions(lines 30-35), including the typedqueueRequest?: booleanfieldjs/src/wrappers/workers-ai.ts— JSDoc (lines 6-18) andwrapWorkersAI()implementationjs/src/instrumentation/plugins/workers-ai-interceptors.ts—workersAIChannels.runchannel definition
- 主要言語
- TypeScript
- スター
- 29
- フォーク
- 21
- 平均マージ
- 1日 15時間
- マージ済み PR(30日)
- 76
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
braintrustdata/braintrust-sdk-javascript のほかの issue
-
typescript
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
braintrustdata/braintrust-sdk-javascript#2686 ·
メンテナーはふだん 1 日以内に返信
-
typescript
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
braintrustdata/braintrust-sdk-javascript#2685 ·
メンテナーはふだん 1 日以内に返信
-
High TypeScript checking cost from generated Zod 3 schemas対応中かも @lforst が 14 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
braintrustdata/braintrust-sdk-javascript#2624 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
[bot] Instrument Luma AI (17,324 weekly downloads)再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンtypescript
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
braintrustdata/braintrust-sdk-javascript#2578 ·
メンテナーはふだん 1 日以内に返信
-
[bot] Instrument Letta Agent SDK (87,205 weekly downloads)再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンtypescript
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
braintrustdata/braintrust-sdk-javascript#2577 ·
メンテナーはふだん 1 日以内に返信
braintrustdata/braintrust-sdk-javascript の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
lichess-org/lila#22324 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Feature Request] [Web] Expose kvCacheQuantizationBits in the onnxruntime-web WebGPU EP optionsオープンep:WebGPU platform:web quantization
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
microsoft/onnxruntime#33752 ·
メンテナーはふだん 2 日以内に返信
-
[Skill Bug]: entra-agent-id: inaccurate blueprint permission inheritance and parent token sub claimオープンbug entra-agent-id
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
microsoft/GitHub-Copilot-for-Azure#3467 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
fix(worker): keep normal prepare waiting states failure-free対応中かも @LichKing-2234 が今日担当しました。 オープンagent:codex priority:P1
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
AgoraIO-Extensions/agent-infra#3745 ·
メンテナーはふだん 1 日以内に返信
-
The five-line work window can drop its oldest line: the per-line byte share ignores the JSON framing対応中かも @Eapp1e が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
makecindy/cindy#7973 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信