Skip to content

[BOT ISSUE] OpenAI Responses API retrieve() and cancel() not instrumented #1727

@braintrust-bot

Description

@braintrust-bot

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

Local files inspected

  • js/src/wrappers/oai_responses.ts — lines 27–47: proxy get trap
  • js/src/instrumentation/plugins/openai-channels.ts — lines 78–106: responses channel definitions
  • js/src/vendor-sdk-types/openai-common.ts — lines 206–219: OpenAIResponses interface
  • js/src/wrappers/oai.ts — references responsesProxy

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions