fix: update dispatcher handling for undici v8.3.0+ compatibility#1927
fix: update dispatcher handling for undici v8.3.0+ compatibility#1927Oxygen56 wants to merge 1 commit into
Conversation
Fixes fetchOptions.dispatcher not working with newer undici versions. Fixes openai#1886
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3e06aed95f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| dispatcher: _dispatcher, | ||
| agent: _agent, | ||
| client: _client, | ||
| proxy: _proxy, | ||
| ...fetchInitOptions |
There was a problem hiding this comment.
Preserve runtime fetch options when calling compatible fetches
When users follow the documented proxy setup, e.g. new OpenAI({ fetch, fetchOptions: { dispatcher: proxyAgent } }), or the Bun/Deno proxy/client examples, these properties are removed before this.fetch is invoked, so the request silently bypasses the configured proxy/dispatcher even though the caller supplied a compatible fetch implementation. This should only strip or guard incompatible options for the problematic global-undici mismatch case, not unconditionally drop every runtime-specific fetch option.
Useful? React with 👍 / 👎.
Fixes fetchOptions.dispatcher compatibility with undici v8.3.0+.
Fixes #1886