Skip to content

fix OpenAI body already red#1969

Merged
Cedric / ViaDézo1er (viadezo1er) merged 4 commits intomainfrom
cedric/fix-openai-body-already-red
May 8, 2026
Merged

fix OpenAI body already red#1969
Cedric / ViaDézo1er (viadezo1er) merged 4 commits intomainfrom
cedric/fix-openai-body-already-red

Conversation

@viadezo1er
Copy link
Copy Markdown
Contributor

@viadezo1er Cedric / ViaDézo1er (viadezo1er) commented May 8, 2026

OpenAI's chat.completions.parse() calls create()._thenUnwrap(...), which produces two APIPromise instances sharing the same responsePromise.

Our SDK called .then() on each of them, triggered a parseResponse, which calls response.json() on the HTTP response body. However a Response body can only be read once.

Might fix a customer issue https://braintrustdata.slack.com/archives/C0B27UX9UDR/p1778223683547239

@viadezo1er Cedric / ViaDézo1er (viadezo1er) force-pushed the cedric/fix-openai-body-already-red branch from 4875bad to 8ebbac5 Compare May 8, 2026 18:27
@viadezo1er
Copy link
Copy Markdown
Contributor Author

Cedric / ViaDézo1er (viadezo1er) commented May 8, 2026

CI e2e fails due to invalid COPILOT_API_KEY/BRAINTRUST_E2E_MODEL_BASE_URL in github secrets.
e2e-canary also happens on the main branch.

Copy link
Copy Markdown
Contributor

@Qard Stephen Belanger (Qard) left a comment

Choose a reason for hiding this comment

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

This feels a bit hack-ish, but the APIPromise stuff has been a pain...I'm not sure if there's a non-hacky solution. 😐

@viadezo1er Cedric / ViaDézo1er (viadezo1er) merged commit 987b14c into main May 8, 2026
50 of 54 checks passed
@viadezo1er Cedric / ViaDézo1er (viadezo1er) deleted the cedric/fix-openai-body-already-red branch May 8, 2026 22:02
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.

2 participants