When using OpenAI Codex Desktop or the CLI, many users experience a long delay during startup or when sending their first message, accompanied by the message "Reconnecting 1/5 ... 5/5".
This document explains the root cause of this issue and provides a step-by-step fix by updating your configuration file (config.toml), along with a detailed comparison of the changes made.
Root Cause Analysis
Protocol Interference (WebSocket Timeout)
By default, Codex attempts to establish a real-time connection using the WebSocket (WSS) protocol. In many local network environments or when using local proxy tools (e.g., Clash, v2rayN), WebSocket handshake requests get blocked or dropped.
Timeout & Protocol Fallback
After retrying 5 times (waiting ~20 seconds per attempt, taking 1 to 2 minutes total), Codex automatically falls back to standard HTTP / SSE requests. This is why Codex eventually starts working after the 5 retries, but wastes time every single launch.
Ignored System Proxy
In certain Windows environments, Codex Desktop may not automatically inherit system proxy settings unless explicitly told to do so.
Solution Strategy
Force HTTP Transport: Explicitly set the model_provider to openai_http to bypass the fragile WebSocket handshake process altogether.
Enable System Proxy Support: Add respect_system_proxy = true in the configuration file to ensure requests properly pass through your local network setup.
Configuration Changes (Diff)
Below are the exact changes made to your C:\Users\your name.codex\config.toml file:
A. Transport & Provider Settings
- disable_response_storage = true
- model_reasoning_effort = "medium"
- notify = [ "C:\\Users\\your name\\AppData\\Local\\OpenAI\\Codex\\runtimes\\cua_node\\cfb32733c877621e\\bin\\node_modules\\@oai\\sky\\bin\\windows\\codex-computer-use.exe", "turn-ended" ]
- model = "gpt-6-luna"
+ # ----------------------------------------------------
+ # 1. Core Model & Transport Settings (Fixes Reconnecting 5/5)
+ # ----------------------------------------------------
+ model_provider = "openai_http"
+ disable_response_storage = true
+ model_reasoning_effort = "medium"
+ model = "gpt-6-luna"
+
+ [model_providers.openai_http]
+ name = "OpenAI HTTP Direct"
+ base_url = "https://chatgpt.com/backend-api/codex"
+ wire_api = "responses"
B. System Proxy Support
+ # ----------------------------------------------------
+ # 2. General & Desktop Settings
+ # ----------------------------------------------------
+ notify = [
+ "C:\\Users\\your name\\AppData\\Local\\OpenAI\\Codex\\runtimes\\cua_node\\cfb32733c877621e\\bin\\node_modules\\@oai\\sky\\bin\\windows\\codex-computer-use.exe",
+ "turn-ended"
+ ]
+
+ [features]
+ respect_system_proxy = true # Enables system proxy inheritance
Complete Updated config.toml File
Edit your entire C:\Users\your name.codex\config.toml file with the following content.
- Applying the Fix
Open config.toml in Notepad or VS Code.
Edit the contents with the updated code block above and save the file.
Completely restart Codex.
Once restarted, Codex will directly connect over HTTP without going through the 5/5 reconnection delay.