fix(codex): preserve proxy env when creating OpenAI client#12008
Closed
ikumiyo wants to merge 1 commit into
Closed
fix(codex): preserve proxy env when creating OpenAI client#12008ikumiyo wants to merge 1 commit into
ikumiyo wants to merge 1 commit into
Conversation
Contributor
|
Thanks @ikumiyo — the diagnosis here was correct: the custom httpx transport from #11277 suppresses env-proxy handling. Fixed on main via #12657 using an alternative approach that forwards the proxy env explicitly to Closing as superseded. Appreciate the detailed test case. |
This was referenced Apr 20, 2026
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
Fixes a regression where Codex requests can time out for users who rely on
http_proxy/https_proxy._create_openai_client()injects a customhttpx.ClientwithHTTPTransport(socket_options=...)for TCP keepalives. When proxy environment variables are configured, passing a custom transportbypasses httpx's default environment proxy handling. This causes Codex requests to
https://chatgpt.com/backend-api/codexto attempt direct connection instead of using the configured proxy.Root Cause
With proxy env vars configured, the default httpx client can reach the Codex endpoint through the proxy, but the custom transport path times out: