为什么新版 codexapp 在回复前总是执行 5 次 Reconnecting... 才开始回答,之前旧的版本就不会
Resolved 💬 52 comments Opened Mar 11, 2026 by yaowenlei-go Closed Mar 11, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
What version of the Codex App are you using (From “About Codex” dialog)?
26.305.950 (863)
What subscription do you have?
no
What platform is your computer?
mocos arm
What issue are you seeing?
<img width="770" height="199" alt="Image" src="https://github.com/user-attachments/assets/59852390-56e2-48cf-b599-2d19e0f6f509" />
What steps can reproduce the bug?
直接使用
What is the expected behavior?
_No response_
Additional information
_No response_
52 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
same here, this always happens during the first conversation.
<img width="421" height="584" alt="Image" src="https://github.com/user-attachments/assets/a6098779-ea88-49e9-b588-330d5c20c800" />
<img width="247" height="306" alt="Image" src="https://github.com/user-attachments/assets/b2e3fcec-73aa-4ef5-bae1-c7e3dc6c1ee1" />
same here
请问你解决了吗
俺也一样
<img width="1276" height="251" alt="Image" src="https://github.com/user-attachments/assets/969aed6b-96b7-4c09-90f7-e71804ec9eaf" />
我也是,而且我在vscode插件中发消息,直接报错“开启对话时出错”;在cli中,会reconnecting五次
我也是,节点似乎没发现问题
我不知道为什么就自己好了哈哈哈,不管是插件、cli还是app,都完全没问题了
+1
@zmy-seu 老哥咋解决的? 我还是这个情况
我也是,蹲一个好心人
我开香槟开早了,问题恢复了,哈哈哈
codex.app端走的可能是终端的代理。试着从命令行启动。
Cli也有这个症状🥹
---- 回复的原邮件 ----
| 发件人 | @.*> |
| 发送日期 | 2026年03月27日 18:49 |
| 收件人 | openai/codex @.*> |
| 抄送人 | 大白白 @.*>,
Comment @.*> |
| 主题 | Re: [openai/codex] 为什么新版 codexapp 在回复前总是执行 5 次 Reconnecting... 才开始回答,之前旧的版本就不会 (Issue #14297) |
lomoyi left a comment (openai/codex#14297)
codex.app端走的可能是终端的代理。试着从命令行启动。
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: @.***>
@lomoyi @Sheng-Charles @C-a-r-r-y @hikki1998
简单粗糙的解法:
在 ~/.codex/config.toml中加入以下几行:
``` toml
model_provider = "openai_http"
[model_providers.openai_http]
name = "OpenAI HTTP only"
wire_api = "responses"
supports_websockets = false
谢谢,明早试试
---- 回复的原邮件 ----
| 发件人 | @.*> |
| 发送日期 | 2026年03月27日 23:58 |
| 收件人 | openai/codex @.*> |
| 抄送人 | 大白白 @.*>,
Mention @.*> |
| 主题 | Re: [openai/codex] 为什么新版 codexapp 在回复前总是执行 5 次 Reconnecting... 才开始回答,之前旧的版本就不会 (Issue #14297) |
tkchips left a comment (openai/codex#14297)
@@.@@.
简单粗糙的解法:
在 ~/.codex/config.toml中加入以下几行:
model_provider = "openai_http"
[model_providers.openai_http]
name = "OpenAI HTTP only"wire_api = "responses"supports_websockets = false
ps : model_provider="openai_http"要放在配置文件开头,保证层级在最外侧,其余部分放在最后即可
pps : 我在codex vscode插件中验证有效,但是在26.5325.21211的版本中,会有一些预料之外的副作用: 如图,上面的方法会导致中间的的 select reasoning effort 选项消失
image.png (view on web)
ppps : 原因: 默认是使用websocket协议,在websocket重连等待五次(并且每次的超时时间足足有20s)之后才会切换到可以正常通信的HTTP协议,至于websocket协议为什么不通,可能是代理不支持websocket协议;
pppps: 代理使用TUN模式可以websocket直接访问;
2026-03-25T17:36:55.024290Z INFO session_loop{ ... model=gpt-5.4}:model_client.stream_responses_websocket{model=gpt-5.4 wire_api=responses transport="responses_websocket" api.path="responses" turn.has_metadata_header=true websocket.warmup=false}: codex_core::client: new
2026-03-25T17:36:55.024450Z INFO session_loop{ ... model=gpt-5.4}:model_client.stream_responses_websocket{model=gpt-5.4 wire_api=responses transport="responses_websocket" api.path="responses" turn.has_metadata_header=true websocket.warmup=false}:model_client.websocket_connection{provider=OpenAI wire_api=responses transport="responses_websocket" api.path="responses" turn.has_metadata_header=true}: codex_core::client: new
2026-03-25T17:37:16.154181Z INFO session_loop{ ... model=gpt-5.4}:model_client.stream_responses_websocket{model=gpt-5.4 wire_api=responses transport="responses_websocket" api.path="responses" turn.has_metadata_header=true websocket.warmup=false}:model_client.websocket_connection{provider=OpenAI wire_api=responses transport="responses_websocket" api.path="responses" turn.has_metadata_header=true}: codex_core::client: close time.busy=16.2ms time.idle=21.1s
2026-03-25T17:37:16.154242Z INFO session_loop{ ... model=gpt-5.4}:model_client.stream_responses_websocket{model=gpt-5.4 wire_api=responses transport="responses_websocket" api.path="responses" turn.has_metadata_header=true websocket.warmup=false}: codex_core::client: close time.busy=16.5ms time.idle=21.1s
2026-03-25T17:37:16.154263Z WARN session_loop{ ... model=gpt-5.4}: codex_core::codex: stream disconnected - retrying sampling request (1/5 in 207ms)...
2026-03-25T17:37:37.457304Z WARN session_loop{ ... model=gpt-5.4}: codex_core::codex: stream disconnected - retrying sampling request (2/5 in 376ms)...
2026-03-25T17:37:58.883401Z WARN session_loop{ ... model=gpt-5.4}: codex_core::codex: stream disconnected - retrying sampling request (3/5 in 845ms)...
2026-03-25T17:38:20.787056Z WARN session_loop{ ... model=gpt-5.4}: codex_core::codex: stream disconnected - retrying sampling request (4/5 in 1.679s)...
2026-03-25T17:38:43.525159Z WARN session_loop{ ... model=gpt-5.4}: codex_core::codex: stream disconnected - retrying sampling request (5/5 in 3.428s)...
2026-03-25T17:39:08.043164Z WARN session_loop{ ... model=gpt-5.4}: codex_core::client: falling back to HTTP
2026-03-25T17:39:08.043236Z INFO session_loop{ ... model=gpt-5.4}:model_client.stream_responses_api{model=gpt-5.4 wire_api=responses transport="responses_http" http.method="POST" api.path="responses" turn.has_metadata_header=true}: codex_core::client: new
2026-03-25T17:39:10.673175Z INFO session_loop{ ... model=gpt-5.4}:model_client.stream_responses_api{model=gpt-5.4 wire_api=responses transport="responses_http" http.method="POST" api.path="responses" turn.has_metadata_header=true}: codex_core::client: close time.busy=6.20ms time.idle=2.62s
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: @.***>
成功解决了问题
Nice~切tun后就好了。还是因为代理问题。
https://linux.do/t/topic/1707720我找的这个也可以解决
我也根据这个方法解决了,感谢
我成功解决了,感谢!!!
感谢,亲测有效!
开了TUN模式就好了!
解决不展示剩余额度等信息的问题,需要添加
requires_openai_auth = true另外“线程” 是根据model_provider 进行过滤的,model_provider 更改后会导致旧的线程不展示
有没有开TUN也不work的...
感谢大佬已解决
I hit what looks like the same problem on macOS: a new conversation would show
Reconnecting...several times at the beginning and only start responding after those retries.A workaround that consistently fixed it for me was to create
~/.codex/.envand set proxy environment variables there.For example:
or even just:
After restarting Codex, the repeated
Reconnecting...loop at the start of a conversation stopped for me.This may not be the root cause for every report here, but it is a practical workaround worth testing, especially in environments where websocket / transport routing may be affected by local proxy settings.
解决,感谢
提供一个新思路:
我的也是开tun模式就好了,但是开tun模式很多其他软件也不能用了。
因此用了proxifier解决了。
强制让codex.exe;Codex.exe走v2rayN的socks5代理即可。
这样不用专门开tun模式,别的国内软件也能正常用了。
<img width="2290" height="1638" alt="Image" src="https://github.com/user-attachments/assets/cd4c640d-dc13-4c09-9ff3-aaf55a0aff0f" />
可以尝试打开tun和把这个端口也打开,我的现在很流畅
按照上边修改配置文件的方法改了之后,界面信息变了好多,不显示当前使用额度和刷新时间了..
<img width="908" height="264" alt="Image" src="https://github.com/user-attachments/assets/c0b86a2d-03ad-4ecb-8f5d-064fc3700183" />
这个可行,改了后非常流畅
这方法之前还好,现在不行了,更新之后副作用太多,bug满天飞了。
我现在连账户配置都显示不了,连不上,也无法log_out
<img width="616" height="637" alt="Image" src="https://github.com/user-attachments/assets/7a5c13a2-da86-4c66-a4b7-e9732a6ca439" />
<img width="613" height="231" alt="Image" src="https://github.com/user-attachments/assets/78b32612-dcb1-4a95-8db4-78f93036ad46" />
<img width="1365" height="490" alt="Image" src="https://github.com/user-attachments/assets/88c16696-58fb-4f48-9b62-37695eaa4fd7" />
我也是,持续关注下
持续关注
持续关注
我也碰到了,很奇怪,调用image2的复杂任务就是链接不上,文本任务反倒是秒回复。。。
修改codex配置文件(config.toml)不可取,会让app端bug满天飞。
可以在系统终端配置网络,无需选择tun模式或socks5
写入:
export http_proxy=http://127.0.0.1:7890
export https_proxy=http://127.0.0.1:7890
export HTTP_PROXY=http://127.0.0.1:7890
export HTTPS_PROXY=http://127.0.0.1:7890
(7890切换为你自己vpn的端口)
这时候在终端里打开codex cli就不会出reconnecting了,之后使用
codex app指令打开codexapp,就不会出现重连五次的情况了。若是不想通过指令打开,ai提供了一种配置网络的方法,但我没有尝试。终端运行(mac系统):
launchctl setenv http_proxy http://127.0.0.1:7890launchctl setenv https_proxy http://127.0.0.1:7890
launchctl setenv HTTP_PROXY http://127.0.0.1:7890
launchctl setenv HTTPS_PROXY http://127.0.0.1:7890
直接在
%USERPROFILE%\.codex中创建文件名为.env的文本文件,写入:HTTP_PROXY=http://127.0.0.1:7897HTTPS_PROXY=http://127.0.0.1:7897其中7897端口必须修改为你本地计算机代理的端口,代理软件或者windows系统设置均可查看得到(如不清楚可询问AI):
<img width="3011" height="1390" alt="Image" src="https://github.com/user-attachments/assets/982d48a9-24a8-403e-a3fe-eed368c89bde" />
这样可以确保Codex 显式走 HTTP 代理
我是win11,今天凌晨试了我这边可以解决的方案
powershell:
[Environment]::SetEnvironmentVariable("http_proxy","http://127.0.0.1:10808","User")
[Environment]::SetEnvironmentVariable("https_proxy","http://127.0.0.1:10808","User")
注意:10808是本地监听端口,从代理软件设置中找到并改成你自己的
重启电脑重新打开codex再试一下
20260527, ubuntu vscode codex extension, ~/.codex/config.toml 修改好成功了, 十分感谢. model_provider = "openai_http" 放在第一行.
<img width="796" height="338" alt="Image" src="https://github.com/user-attachments/assets/aa79ae24-7f2c-425f-ac2c-c6fe5377a5fa" />
为什么我打开tun模式还是这样
谢谢大佬,成功解决了。你是怎么想到这个解决办法的,太强了
原来大家都跟我有一样的问题!!这个问题苦恼很久了,于是我找各种资料、问 AI ,
再根据自己的亲身实践,写了一篇内容,用于解决这个问题的。
大家可以看看,希望能帮助大家解决这个问题!!
https://mp.weixin.qq.com/s/5r3qIzu7rG8rhUvd3HWoGA
I was able to resolve a repeated
Reconnecting...loop without disabling WebSockets.In my case, the proxy could handle WebSocket traffic, but Codex did not consistently pick up the proxy across all network paths. The fix was to make the proxy available through the common Windows mechanisms that different network stacks may use.
Sanitized steps:
Use your own local proxy URL in place of the placeholder below:
Expected:
HTTP/1.1 101 Switching Protocols.Replace
<LOCAL_PROXY_URL>with your own local proxy URL:The main point is that this keeps WebSockets enabled. It only ensures Codex, child processes, and WinHTTP-based code paths use the same proxy configuration. If it still fails, a system-level tunnel/TUN setup may be needed, because some network path may be bypassing both environment variables and normal Windows proxy settings.
我使用了FlClash这个工具,他代理的本地端口是7890。
在C:\Users\Administrator\.codex下创建一个.env文件
内容如下:
HTTP_PROXY="http://127.0.0.1:7890"
HTTPS_PROXY="http://127.0.0.1:7890"
ALL_PROXY="socks5h://127.0.0.1:7890"
NO_PROXY="localhost,127.0.0.1,::1"
重启codex,就解决了该问题。
我通过codex修改好了
我用的是clash,我看了一下代理配置文件,其中有
port: 7890
socks-port: 7891
说明以上是代理端口
prompt是:
port: 7890
socks-port: 7891
这是代理配置,请按照这个修改吧
有用的,我这边重连以及自动审批超时的问题都通过这个解决了😂
那用了cc-switch 又该怎么配?
铁铁,你解决了不
现在上了.env文件,会导致沙盒错误。要按这个方法https://github.com/openai/codex/issues/29418#issuecomment-4831792926
手动修改config.toml和setup_marker.json,而CCS每次切换都会覆盖配置,导致修改还原。目前我的办法是让AI写了个py脚本,每次CCS 切换完,就运行这个脚本,又把这个config.toml和setup_marker.json里应该改的改回去。这也是没办法的办法了
亲测有效。造成原因应该是
.env的代理配置影响了沙盒的代理端口。需要改config.toml和沙盒的setup_marker.json。Codex所有进程%USERPROFILE%\.codex\.env里配置代理%USERPROFILE%\.codex\config.toml的[features]添加network_proxy配置config.toml的底部补充%USERPROFILE%\.codex\.sandbox\setup_marker.json的proxy_ports改成
大概率是沙盒的bug,不想将沙盒降级为unelevated的可以试试这个方案