vscode codex 插件启动慢?一次从排查到解决完成的记录

vscode codex 插件启动慢?一次从排查到解决完成的记录
vscode codex 插件启动慢?一次从排查到解决完成的记录

在vscode上打开codex插件时,每次都要看着这图标等很久,今天实在忍不了了决定找出问题。

一开始以为是我开了很多mcp的问题,但是我把mcp全关了打开速度并没有多少提升,故排除mcp因素。

然后开始排查日志

+0.000s   Codex extension 激活
+0.000s   Spawning codex app-server
+0.000s   app-server initialize received
+0.000s   remote plugin catalog 立刻报 API key auth 不支持

+2.602s   WSL distro scan
+20.426s  curated plugins GitHub sync 失败
          日志里写明:Failed to connect to github.com port 443 after 21091 ms
+20.676s  GitHub HTTP fallback 失败
          api.github.com 返回 403 rate limit
+35.231s  Features enabled
+35.240s  app routes mounted after 34988ms
+35.817s  Unable to extract account id and plan from auth token
+40.551s  remote plugin sync 再次失败
          chatgpt authentication required; api key auth is not supported
+40.885s  featured plugin fetch 失败,401 Unauthorized
+43.258s  Playwright MCP list resources/templates 失败
+46.451s  ab.chatgpt.com 开始 fetch failed
+106.820s chatgpt.com 开始 fetch failed

curated plugins GitHub sync:约 21.1 秒
怀疑是这里的问题,于是在 config.toml里写上

[features]
plugins = false
  • 关闭 plugins 后,curated plugins / GitHub sync 相关日志消失。
  • 但 Codex 启动仍然稳定卡在 35 秒左右。

这个时候有一组关键日志:


2026-06-10 15:21:44.531 [info] Activating Codex extension

2026-06-10 15:21:44.532 [info] [CodexMcpConnection] Initialize received id=1

2026-06-10 15:21:46.745 [info] [wsl] eligible distro list listResult="Ubuntu\ndocker-desktop"

2026-06-10 15:22:19.356 [info] Features enabled enabledFeatures="..."

2026-06-10 15:22:19.365 [info] [startup][renderer] app routes mounted after 34827ms

2026-06-10 15:22:27.387 [warning] Failed to list resource templates for MCP server 'playwright'

2026-06-10 15:22:30.500 [error] Error fetching ... url=https://ab.chatgpt.com/v1/initialize...

换算成相对耗时:


0.000s    Activating Codex extension

0.001s    Initialize received

2.214s    WSL distro list

34.825s   Features enabled

34.834s   app routes mounted

42.856s   Playwright MCP warning

45.969s   ab.chatgpt.com fetch failed

多次重启codex插件,发现这个日志里下面这句显示的耗时都是差不多的35秒


app routes mounted after 35044ms

app routes mounted after 35257ms

app routes mounted after 35460ms

app routes mounted after 34827ms

这也看不出啥,直接让ai给我分析了,ai帮我追到了来源

扩展代码分析

查看 OpenAI/Codex VS Code 扩展安装目录:


C:\Users\yy\.vscode\extensions\openai.chatgpt-26.5602.71036-win32-x64

关键文件:


webview\assets\app-main-DWntxdWC.js

webview\assets\statsig-h8nIJFeq.js

out\extension.js

app-main-DWntxdWC.js 中找到了:


message:`[startup][renderer] app routes mounted after ${Math.round(performance.now())}ms`

这说明 app routes mounted after ...ms 是前端 React 路由真正挂载后的日志。

statsig-h8nIJFeq.js 中找到默认超时:


w=1e4

this._timeout=w

this._netConfig.networkTimeoutMs && (this._timeout=this._netConfig.networkTimeoutMs)

这里 1e4 就是:


10000ms = 10s

同时初始化请求带重试:


retries:2

也就是说:

  • 第 1 次请求:最多等 10 秒。
  • 第 2 次请求:最多等 10 秒。
  • 第 3 次请求:最多等 10 秒。
  • 中间还有退避等待。

这时间不就对上了

:thinking:如果是网络的问题,我本地是开了代理的,没理由访问不了。

最后ai告诉我是vscode 没走代理 :smiley:
我也是释怀的笑了,把vscode的代理设置了一下,就好了

1 个帖子 - 1 位参与者

阅读完整话题

来源: LinuxDo 最新话题查看原文