-
Notifications
You must be signed in to change notification settings - Fork 3
[BOT ISSUE] OpenAI Responses API retrieve() and cancel() not instrumented #1727
Description
Summary
The OpenAI Responses API wrapper only instruments create(), stream(), and parse(). The retrieve() and cancel() methods pass through the proxy uninstrumented, producing no Braintrust spans. This matters for the background/stored responses workflow (store: true), where create() returns immediately and retrieve() is used to poll for the completed response.
What instrumentation is missing
Wrapper (js/src/wrappers/oai_responses.ts, lines 27–47): The proxy get trap only intercepts create, stream, and parse. Any other property (including retrieve and cancel) falls through to Reflect.get(target, name, receiver), returning the raw uninstrumented method.
Channels (js/src/instrumentation/plugins/openai-channels.ts): Only three responses channels are defined: responsesCreate, responsesStream, and responsesParse. No channels for retrieve or cancel.
Vendor types (js/src/vendor-sdk-types/openai-common.ts, lines 206–219): The OpenAIResponses interface only declares create, parse, and stream. No type definitions for retrieve or cancel.
Background mode: When store: true is passed to responses.create(), the response is stored server-side and can be retrieved later. The current instrumentation traces the initial create() call but cannot trace the retrieve() call that fetches the completed result, leaving a gap in the trace for async/background workflows.
Braintrust docs status
not_found — The Braintrust docs at https://www.braintrust.dev/docs/instrument/wrap-providers list OpenAI as a supported provider but do not mention retrieve(), cancel(), or background response handling.
Upstream reference
- OpenAI Responses API:
responses.retrieve(responseId)retrieves a stored response by ID. - OpenAI Responses API:
responses.cancel(responseId)cancels an in-progress response. - Background mode:
responses.create({ store: true, ... })stores the response for later retrieval. - OpenAI Node SDK
Responsesclass methods:create,retrieve,cancel,del,stream,parse. - OpenAI API reference: https://platform.openai.com/docs/api-reference/responses
- Equivalent Python SDK gap: [BOT ISSUE] OpenAI: Responses API
retrieve(),cancel(), and background mode not instrumented braintrust-sdk-python#187
Local files inspected
js/src/wrappers/oai_responses.ts— lines 27–47: proxy get trapjs/src/instrumentation/plugins/openai-channels.ts— lines 78–106: responses channel definitionsjs/src/vendor-sdk-types/openai-common.ts— lines 206–219:OpenAIResponsesinterfacejs/src/wrappers/oai.ts— referencesresponsesProxy