The Codex Changelog
All Episodes
Fixing Codex GUI Hangs with System Proxy Support

Fixing Codex GUI Hangs with System Proxy Support

0:00|0:00

Learn how Codex CLI 0.167.0 introduces system proxy support on macOS and Windows to fix GUI launch hangs, along with its route-aware client pool and config traps to avoid.


Chapter 1

System proxy in Codex CLI 0.167.0

James Turner

Your terminal probably has a proxy set, but your Dock launched apps don't, and that gap is behind a lot of weird Codex hangs. Quick thanks to Jellypod AI for sponsoring this episode. Now, the Codex CLI 0.167.0 change that fixes the gap, and the traps that come with it.

James Turner

Here's what changed. Pull request 58157 exposes system proxy support as an experimental setting. On macOS and Windows, Codex can now follow the operating system's proxy configuration, not just shell environment variables. We touched on this briefly in an earlier episode, when it showed up in experimental. Today is the transport underneath it.

James Turner

Inside the codex-http-client crate, there's an outbound proxy policy with two modes. The old one is called ReqwestDefault. That's the legacy behavior, and in practice it means HTTP_PROXY and HTTPS_PROXY from the environment. The new one is RespectSystemProxy. In that mode, Codex resolves the route for the complete request URL. Platform system settings and PAC or WPAD scripts come first. Then explicit proxy environment variables. Then a direct connection.

James Turner

Why does this matter? Because GUI launches don't inherit your shell. Launch from the Dock, the Start menu, or a desktop app, and the app server process never sees the variables you exported in your terminal. A GitHub issue, number 39237, shows the cost. A user on macOS, with a local proxy listening on 127.0.0.1 port 7897, saw Codex connect directly to hosts the proxy rules didn't cover. Connections sat in SYN_SENT, and new sessions took around two minutes, retrying about five times. The workaround was launchctl setenv, which injects proxy variables for every GUI app on the machine. Blunt instrument.

James Turner

There's another detail in the crate README that's worth knowing. Proxy choice can depend on the full URL, not only the origin. So Codex uses a route aware client pool, which caches up to 16 transport clients by resolved route. And redirects get handled by the pool itself, resolving every hop, so a redirect target can't quietly skip your proxy rules. It also strips sensitive headers when the origin changes.

Chapter 2

Setup and traps

James Turner

How do you turn it on? Two ways. Open the TUI, run slash experimental, and toggle System proxy. Or put this in your config dot toml under home dot codex: a features table, with respect underscore system underscore proxy equals true. Then you can check with codex doctor, or codex doctor with the network only flag, to confirm it's active.

James Turner

Now the traps. First, naming. The key is singular. respect underscore system underscore proxy. The features table is a free form map of keys to booleans, so if you type the plural, respect system proxies, it parses without error and does nothing. Codex stays on ReqwestDefault. That exact mistake is what happened in issue 39237. The reporter saw timeouts over 120 seconds, and a commenter spotted the plural key. After switching to singular, the same test exited cleanly in about eleven seconds, with connections established to the local proxy.

James Turner

Second, the process boundary. This only governs Codex's own Rust HTTP and WebSocket client. If the model runs a bare curl in your terminal, curl doesn't read the macOS system proxy. It needs a dash x flag or environment variables. So a curl timing out inside a session doesn't mean the feature is broken.

James Turner

Third, loopback. Issue 56919, still open as of the source, reports that on macOS, with a custom provider on 127.0.0.1, requests went through the system proxy anyway and came back 502 Bad Gateway. The reporter suspects, and flags as unverified, that the exceptions list isn't consulted. Their workaround: set NO_PROXY to 127.0.0.1, localhost, and ::1 in whatever environment launches Codex. If you run local models, do that.

James Turner

A few smaller things in 0.167.0. Ctrl+L now clears the display but keeps earlier messages reachable through Ctrl+T. Deleting text that exposes a leading bang keeps your draft in chat mode, so it won't be treated as a raw shell command. And on terminals with Kitty graphics, you get local image thumbnails while composing, plus clickable image paths in the transcript.

James Turner

So, the takeaway: if Codex hangs only when launched from a GUI, enable the singular key, run codex doctor, and keep NO_PROXY handy for localhost.