Respect proxy env when constructing injected OpenAI clients#11943
Closed
wanghao-SunSky wants to merge 1 commit into
Closed
Respect proxy env when constructing injected OpenAI clients#11943wanghao-SunSky wants to merge 1 commit into
wanghao-SunSky wants to merge 1 commit into
Conversation
Contributor
|
Thanks @wanghao-SunSky for the report and the diagnosis — you correctly identified that the custom httpx transport from #11277 was suppressing env-proxy handling. Fixed on main via #12657 using an alternative approach: the keepalive-enabled transport is preserved, and the proxy env is forwarded explicitly to Closing as superseded. Thanks again for the well-scoped fix and test — your PR was the first to surface this on our end. |
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.
Summary
httpx.Clientcreation when standard proxy env vars are presentProblem
_create_openai_client()injects a customhttpx.Client(transport=HTTPTransport(...))to set TCP keepalive socket options. That transport path does not inherit environment proxy settings, so providers that rely onHTTP(S)_PROXYorALL_PROXYsilently bypass the user's proxy path.In practice this broke
openai-codexfor local proxy setups: Codex CLI requests succeeded, but Hermes requests tochatgpt.com/backend-api/codextimed out because Hermes was effectively direct-connecting.Validation
python -m pytest -q tests/run_agent/test_create_openai_client_kwargs_isolation.py tests/run_agent/test_create_openai_client_reuse.pyhermes -p memecoinscout chat -q "只回复 ok" -Q --provider openai-codex -m gpt-5.4now returnsok