fix(core): respect NO_PROXY in global fetch dispatcher#27216
Conversation
|
/gemini review |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request improves the global fetch dispatcher by transitioning to EnvHttpProxyAgent. This change allows the application to respect the NO_PROXY environment variable, ensuring that requests to local addresses are not routed through configured proxies. The update includes necessary adjustments to utility functions and comprehensive integration tests to validate the bypass behavior. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request replaces the ProxyAgent with EnvHttpProxyAgent from the undici library to better support proxy bypass configurations via NO_PROXY and no_proxy environment variables. It also includes a new integration test suite to verify that local requests correctly bypass the proxy. The reviewer identified that createSafeProxyAgent is missing explicit timeout configurations, which could lead to premature timeouts during long-running requests, and recommended trimming input strings for better robustness.
There was a problem hiding this comment.
Code Review
This pull request replaces the ProxyAgent with EnvHttpProxyAgent in the core fetch utilities to support proxy bypassing via the NO_PROXY and no_proxy environment variables. It includes updates to existing tests and a new integration test suite for proxy bypass logic. The reviewer suggested awaiting the asynchronous server.close() call in the integration tests to prevent potential flakiness and resource leaks.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request replaces the ProxyAgent with EnvHttpProxyAgent from the undici library to improve proxy management. The changes include support for the NO_PROXY and no_proxy environment variables in both createSafeProxyAgent and setGlobalProxy, along with automatic trimming of proxy URLs. A new test suite, proxy_bypass.test.ts, has been added to verify that proxy bypass logic works correctly for local addresses. I have no feedback to provide as there were no review comments.
70729ed to
e9abd47
Compare
🛑 Action Required: Evaluation ApprovalSteering changes have been detected in this PR. To prevent regressions, a maintainer must approve the evaluation run before this PR can be merged. Maintainers:
Once approved, the evaluation results will be posted here automatically. |
38db941 to
df26857
Compare
Summary
Fix global fetch dispatcher to respect NO_PROXY by using EnvHttpProxyAgent.
Details
Modified
packages/core/src/utils/fetch.tsto switch fromProxyAgenttoEnvHttpProxyAgent. This ensures that local traffic (localhost, 127.0.0.1) bypasses the proxy whenNO_PROXYis configured. Also updatedsetGlobalProxyandcreateSafeProxyAgentto usehttpProxyandhttpsProxyoptions for consistency.Related Issues
Fixes #23372
How to Validate
npm test -w @google/gemini-cli-core -- src/utils/fetch.test.tsnpm test -w @google/gemini-cli-core -- src/utils/proxy_bypass.test.tsHTTPS_PROXYto a dummy value andNO_PROXYtolocalhost, then attempt a local request. It should bypass the proxy and succeed.Pre-Merge Checklist