Codex Desktop does not use the Windows system proxy for the codex process it launches inside WSL2
Summary
When Windows system proxy is enabled, Codex Desktop does not appear to pass that proxy configuration through to the codex process it launches inside WSL2.
In my testing, the WSL2-side codex process also did not start using the proxy path even after I manually set proxy environment variables inside WSL.
Expected behavior
If Codex Desktop launches codex inside WSL2, and Windows system proxy is enabled, the WSL-side codex process should be able to use that proxy path for outbound network access.
At minimum, I would expect one of these behaviors:
- Codex Desktop propagates effective proxy settings into the WSL environment
- Codex running under WSL uses explicit
HTTP_PROXY/HTTPS_PROXYwhen they are manually set - Codex running under WSL falls back to Windows system proxy settings
- This setup is clearly documented if manual WSL proxy configuration is required
Actual behavior
Windows-side browser traffic works with system proxy enabled, but the codex process launched inside WSL2 does not use that proxy automatically.
Inside WSL2, proxy env vars were empty by default:
HTTP_PROXY=HTTPS_PROXY=NO_PROXY=
I then manually set proxy env vars inside WSL to the Windows-reachable proxy address, but Codex still did not behave as expected.
Environment
- Codex Desktop on Windows
codexlaunched inside WSL2- Windows system proxy enabled
- WSL2
Concrete observation
The WSL-side process did not automatically use the Windows proxy configuration.
The Windows-reachable proxy address from WSL in my setup is:
http://172.31.224.1:7890
I also manually exported:
export HTTP_PROXY=http://172.31.224.1:7890
export HTTPS_PROXY=http://172.31.224.1:7890
export NO_PROXY=localhost,127.0.0.1,::1
However, that still did not make the WSL-side Codex networking behave correctly.
Reproduction
- Enable Windows system proxy
- Launch Codex Desktop
- Open or run a workspace through WSL2
- Let Codex Desktop launch
codexinside WSL2 - Observe that the WSL-side
codexprocess does not inherit usable proxy settings - Manually set
HTTP_PROXY/HTTPS_PROXYinside WSL - Observe that Codex still does not behave correctly
Result
codex inside WSL2 does not use the Windows system proxy automatically, and manual proxy env configuration inside WSL also does not solve the issue.
Suggested direction
- Propagate effective Windows proxy settings into the WSL environment when launching
codex - Verify that the WSL-side
codexprocess actually honors explicit proxy env vars in Desktop-managed sessions - Add logging / diagnostics for which proxy settings Codex actually sees and uses under WSL2
3 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I am hitting the same class of issue, and in this case the failure mode is very concrete.
Environment:
My Windows network uses a local proxy. On Windows, this kind of configuration is valid and works:
For WSL, the usable proxy path is different. WSL cannot use Windows
127.0.0.1as-is; it must use a WSL-reachable Windows host/gateway address, for example:So the WSL-side environment should be something like:
This is exactly how the WSL CLI is configured, and plain WSL CLI usage works. A direct WSL-side
curl -x http://<wsl-windows-host-gateway>:<wsl-reachable-proxy-port> https://chatgpt.com/backend-api/codex/responsesreaches the endpoint and returns the expected405 Allow: POST.The problem is Codex Desktop. When Desktop launches the WSL app-server, it appears to bypass the normal WSL shell/login environment and starts the Desktop-managed binary directly under a Windows
.codex/bin/wsl/<hash>/codex app-server ...path.The process environment I observed for that WSL app-server contained Windows-side values like:
That is wrong for WSL:
127.0.0.1inside WSL is WSL localhost, not Windows localhost..codexdirectory also mixes Windows and Linux Codex configuration/state, which should be separate.The visible user-facing failure is:
Codex Desktop logs also showed remote-control refresh failures like:
This is very frustrating because the user can have both sides configured correctly:
127.0.0.1I do not think users should have to patch Desktop-managed binaries or create fragile wrappers under
.codex/bin/wsl/<hash>/codex. That file is managed by Codex Desktop and gets restored/replaced, so it is not a reliable configuration surface.What Codex Desktop should do when launching a WSL app-server:
HTTP_PROXY/HTTPS_PROXYvalues containing127.0.0.1orlocalhostinto WSL.CODEX_HOMEto the Windows home.codexpath by default. WSL should use the Linux-side home, e.g./home/<wsl-user>/.codex, unless the user explicitly opts into sharing state.CODEX_HOME, because right now the failure looks like a generic stream disconnect.This is not a missing WSL proxy setup problem. It is a Desktop WSL launch-environment problem.
You can add the environment variables to /DISK/Users/username/.codex/.env