Skip to content

fix: Preserve OpenAI return values#1618

Open
Luca Forstner (lforst) wants to merge 4 commits intomainfrom
lforst/fix-issue-1591
Open

fix: Preserve OpenAI return values#1618
Luca Forstner (lforst) wants to merge 4 commits intomainfrom
lforst/fix-issue-1591

Conversation

@lforst
Copy link
Member

@lforst Luca Forstner (lforst) commented Mar 20, 2026

OpenAI methods that return helper promise objects are now instrumented without collapsing them into plain promises.
The hook now preserves the original OpenAI helper behavior while still tracing the eventual result.
The openai auto-hook e2e scenario was switched back to the real helper APIs instead of falling back to lower-level create calls.

Why

The previous hook path broke API compatibility by stripping OpenAI helper behavior in auto-instrumented mode.
That made valid OpenAI code fail only when Braintrust auto-instrumentation was enabled.

Fixes #1592

# Conflicts:
#	e2e/scenarios/openai-auto-instrumentation-node-hook/__snapshots__/scenario.test.ts.snap
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.

Auto-instrumentation via node hook breaks Anthropic messages.stream()

1 participant