Skip to content

fix(app-paths): support Codex desktop app renamed to ChatGPT.app (26.707+) — fixes startup on macOS (#1389)#1391

Closed
LeoLin990405 wants to merge 1 commit into
BigPizzaV3:mainfrom
LeoLin990405:fix/codex-renamed-to-chatgpt-app
Closed

fix(app-paths): support Codex desktop app renamed to ChatGPT.app (26.707+) — fixes startup on macOS (#1389)#1391
LeoLin990405 wants to merge 1 commit into
BigPizzaV3:mainfrom
LeoLin990405:fix/codex-renamed-to-chatgpt-app

Conversation

@LeoLin990405

Copy link
Copy Markdown
Contributor

根因 / Root cause

Codex 26.707 把桌面端 bundle 改名成 ChatGPT.app——但它还是同一个 app:

$ /usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" /Applications/ChatGPT.app/Contents/Info.plist
com.openai.codex                     ← bundle id 未变
$ /usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" ...
26.707.30751
$ ls /Applications/ChatGPT.app/Contents/MacOS/
ChatGPT                              ← 可执行文件也从 Codex 改成了 ChatGPT
$ ls -d /Applications/Codex.app
(不存在)

ChatGPT.app 内仍含 Codex Framework.frameworkResources/codex,以及 Codex++ 注入所依赖的 /webview/assets/*.js(含 app-initial~app-main~*)。mdfind kMDItemCFBundleIdentifier == 'com.openai.codex' 全机只命中它。

Codex 26.707 renamed the desktop bundle to ChatGPT.app. It is the same app — CFBundleIdentifier is still com.openai.codex — but CFBundleExecutable changed from Codex to ChatGPT, and /Applications/Codex.app no longer exists.

两处硬编码因此失效 / Two hardcoded assumptions break startup:

  1. app_paths.rs::macos_app_candidates() 只找 Codex.app / OpenAI Codex.app / OpenAI.Codex.app找不到 app
  2. app_paths.rs::build_codex_executable() 硬编码 Contents/MacOS/Codex即使找到 bundle,可执行路径也不存在

这解释了 #1389(「新版无法通过 codex++ 启动」)。

改动 / Change

  • macos_app_candidates:候选名单加入 ChatGPT.app,放在历史名字之后,保证已有 Codex.app 安装仍优先命中。
  • build_codex_executable:对 .app 从 bundle 的 CFBundleExecutable 解析可执行名(复用仓库里已有的 plist_string_value 助手,macos_app_version 也在用),读不到时回退 Codex。→ 以后再改名也不会断。

Only app_paths.rs + its tests. No behavior change for existing Codex.app installs.

验证 / Verified

Live(本机 macOS,Codex 26.707.30751):

find_macos_codex_app(["/Applications"]) → Some("/Applications/ChatGPT.app")
build_codex_executable(...)             → "/Applications/ChatGPT.app/Contents/MacOS/ChatGPT"  exists=true

测试: 新增 3 个单测,cargo test -p codex-plus-core 全绿、无回归。

app_paths_finds_renamed_chatgpt_bundle .................. ok
app_paths_build_macos_executable_from_bundle_plist ...... ok
app_paths_build_macos_executable_falls_back_to_codex_without_plist ... ok
test result: ok. 57 passed; 0 failed   (--test launcher)

Windows 说明 / Note on Windows

#1389 的报告人在 Windows。Windows 侧走的是 CODEX_PACKAGE_IDENTITIES = ["OpenAI.Codex", "OpenAI.CodexBeta"] 匹配 WindowsApps 包名——改名后很可能同样匹配不上,需要补上新的 package identity。我没有 Windows 机器无法确证包名,故本 PR 只修 macOS(已 live 验证);若维护者能提供改名后的 Windows 包名,我可以在本 PR 补上。

This PR fixes the macOS path only (live-verified). Windows likely needs the new package identity added to CODEX_PACKAGE_IDENTITIES; I have no Windows machine to confirm the new name — happy to add it here if someone can provide it.

Refs #1389

…707+)

Codex 26.707 ships the same desktop bundle (CFBundleIdentifier is still
com.openai.codex) under the name ChatGPT.app, and its CFBundleExecutable is
ChatGPT instead of Codex. Two hardcoded assumptions break startup:

1. macos_app_candidates() only looks for Codex.app / OpenAI Codex.app /
   OpenAI.Codex.app -> the app is never found.
2. build_codex_executable() hardcodes Contents/MacOS/Codex -> even when the
   bundle is located, the executable path does not exist.

Add ChatGPT.app to the candidate list (after the historical names so existing
installs still win) and resolve the executable name from the bundle's
CFBundleExecutable, reusing the existing plist_string_value helper, falling
back to Codex when the plist is unavailable. Reading the name from Info.plist
makes a future rename non-breaking.

Verified live on macOS with Codex 26.707.30751 (/Applications/ChatGPT.app):
resolution now yields .../Contents/MacOS/ChatGPT, which exists.

Refs BigPizzaV3#1389
@LeoLin990405

Copy link
Copy Markdown
Contributor Author

关闭:与 #1390 重复,而且 #1390 更好 —— 它比本 PR 早 5 小时,并且:

  1. CFBundleExecutable 加了路径穿越防护(.filter(|v| !v.contains('/') && !v.contains('\\'))),本 PR 漏了;
  2. macos_app_version 重构成通用的 macos_app_plist_value(app_dir, key) 复用,比本 PR 另写单用途函数干净;
  3. 回归测试更全(Codex 优先 / 旧候选优先 / ChatGPT fallback / 可执行文件解析)。

抱歉造成重复 —— 我提 PR 前查了 issue 但没查开放 PR。

我已经在 #1390 上做了独立第二机验证(macOS + Codex 26.707.31428:解析出 /Applications/ChatGPT.app/Contents/MacOS/ChatGPT,exists=true;cargo test -p codex-plus-core 全绿),并指出了两点:(a) bundle id com.openai.codex 未变,未来可改为按 id 发现以彻底防改名;(b) Windows 侧的 CODEX_PACKAGE_IDENTITIES 仍是坏的,#1389 的报告人正是 Windows。

请合 #1390

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant