fix(core): avoid passing undici agent to Anthropic SDK#1663
Merged
tanzhenxin merged 2 commits intomainfrom Jan 30, 2026
Merged
Conversation
Anthropic's Node client uses node-fetch, which expects a Node http(s).Agent. Stop providing undici's Dispatcher as httpAgent; only set httpAgent when a proxy is configured (via https-proxy-agent), otherwise let the SDK use its default.
Contributor
📋 Review SummaryThis PR addresses an important compatibility issue between the Anthropic SDK and undici's Dispatcher. The fix correctly handles the fact that Anthropic SDK uses node-fetch internally (which expects Node http(s).Agent) rather than undici like the OpenAI SDK. The changes ensure proper proxy support for Anthropic while maintaining the existing OpenAI functionality. 🔍 General Feedback
🎯 Specific Feedback🟡 High
🟢 Medium
🔵 Low
✅ Highlights
|
Mingholy
approved these changes
Jan 30, 2026
Contributor
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR
Fix Anthropic Node runtime client configuration by avoiding passing undici's Dispatcher as
httpAgent(Anthropic usesnode-fetch, which expects Node http(s).Agent). When a proxy is configured, provide a Node-compatible proxy agent; otherwise let the SDK use its default agent.Dive Deeper
dispatcheris appropriate.node-fetchinternally, so undici'sAgent/Dispatcheris incompatible when provided ashttpAgent.httpAgent.httpAgenttoHttpsProxyAgent(proxyUrl).Reviewer Test Plan
packages/core, run:npx vitest run src/utils/runtimeFetchOptions.test.tsLinked issues / bugs
N/A