Codex Reconnecting Timeout 解决方法
现象
Codex 对话时反复重连:
Reconnecting... 2/5
Reconnecting... 3/5
Reconnecting... 4/5
Reconnecting... 5/5
timeout waiting for child process to exit
原因
Codex 默认优先走 WebSocket。
如果 WebSocket 连接失败,会重试 5 次。5 次失败后,才会切换成 HTTP 连接。
解决方法
直接把 Codex 固定为 HTTP Responses API,跳过 WebSocket 重试。
配置文件:
%USERPROFILE%\.codex\config.toml
加入或确认以下配置:
model_provider = "openai_http"
[model_providers.openai_http]
name = "OpenAI"
wire_api = "responses"
requires_openai_auth = true
supports_websockets = false
[features]
responses_websockets = false
responses_websockets_v2 = false
代理配置
代理可以通过 ccSwitch 配置,也可以直接写在 Codex 配置里:
[shell_environment_policy]
set = { HTTP_PROXY = "http://127.0.0.1:7897", HTTPS_PROXY = "http://127.0.0.1:7897" }
代理只决定网络出口,不决定 Codex 使用 WebSocket 还是 HTTP。
生效方式
保存配置后,重启 Codex 客户端。
重新打开对话,确认不再出现 Reconnecting... 5/5。
2 个帖子 - 2 位参与者