Chatgpt代充:aishopvip.com
A conservative Windows repair tool for Codex desktop startup failures caused by broken runtime cache extraction.
Some Windows builds of the Codex desktop app can get stuck on startup after installation or after an automatic update.
Typical symptoms:
- Codex appears to open, but no usable window appears.
- A
ChatGPT.exe/ Codex process exists in Task Manager. - The main window is blank, untitled, or not responding.
%LOCALAPPDATA%\OpenAI\Codex\runtimes\cua_nodekeeps filling with incomplete.staging-*folders.- Restarting Codex creates another
.staging-*folder, but the app still does not open.
This tool repairs the local Codex runtime cache by rebuilding it from the runtime bundled inside the installed Codex package.
On affected machines, files inside the Microsoft Store / MSIX package can carry Windows EFS encrypted file attributes. Codex then tries to copy or extract its bundled runtime into a local cache folder, but the copy can fail or loop because the encrypted attribute cannot be preserved correctly in the target location.
The app keeps retrying with new .staging-* folders, and startup never reaches the normal UI.
codex-runtime-repair performs a narrow, reversible repair:
- Detects the currently installed
OpenAI.Codexpackage. - Detects the active runtime hash from
.staging-*cache folders. - Backs up incomplete staging folders instead of deleting them.
- Copies the bundled runtime file-by-file using byte streams.
- Writes clean local files without preserving EFS encrypted attributes.
- Verifies the copied runtime by file count, size, and manifest.
- Launches Codex for a quick startup check.
This project is intentionally scoped to avoid collateral damage.
It does not:
- Delete your chat history.
- Reset your Codex account or login state.
- Modify
%APPDATA%\Codex. - Uninstall or reinstall Codex.
- Change Windows settings.
- Modify registry keys.
- Clean random caches.
- Kill unrelated apps.
It only works inside:
%LOCALAPPDATA%\OpenAI\Codex\runtimes\cua_node
The script is designed to be cautious by default:
- Default PowerShell mode is
dry-run. - Apply mode requires confirmation unless
-Yesis explicitly passed. - Existing folders are moved to timestamped backups, not deleted.
- Only
ChatGPT.exeprocesses from theOpenAI.Codexpackage are closed. - The target runtime is verified after copying.
Download or clone this repository, then run:
.\scripts\Repair-CodexRuntime.ps1That performs a dry-run only. It prints the installed Codex version, packaged runtime, detected staging folders, and the exact cache path it would repair.
To actually repair:
.\scripts\Repair-CodexRuntime.ps1 -ApplyYou will be asked to type YES before any changes are made.
For one-click usage on Windows, double-click:
Repair-CodexRuntime.cmd
The .cmd launcher runs the script in apply mode, but the PowerShell script still asks for confirmation.
Repair without launching Codex afterward:
.\scripts\Repair-CodexRuntime.ps1 -Apply -NoLaunchRepair without interactive confirmation:
.\scripts\Repair-CodexRuntime.ps1 -Apply -YesUse -Yes only if you have already reviewed the dry-run output.
Use it when Codex desktop repeatedly fails to open after installation or update, and you see incomplete runtime staging folders under:
%LOCALAPPDATA%\OpenAI\Codex\runtimes\cua_node
Do not use it for unrelated Codex issues such as network login failures, account errors, model availability, or project permission problems.
Recommended GitHub topics:
codex windows powershell desktop-app repair-tool runtime-cache openai msix efs
某些 Windows 环境下,Codex 桌面端在安装后或自动更新后可能卡在启动阶段。
常见表现:
- 点开 Codex 后没有可用窗口。
- 任务管理器里能看到
ChatGPT.exe/ Codex 进程。 - 主窗口空白、无标题,或显示未响应。
%LOCALAPPDATA%\OpenAI\Codex\runtimes\cua_node里不断出现未完成的.staging-*目录。- 重启 Codex 后又生成新的
.staging-*,但仍然打不开。
这个工具会从已安装的 Codex 包里提取内置 runtime,并重建本地 runtime 缓存,从而恢复启动。
在受影响的机器上,Microsoft Store / MSIX 安装包里的部分 runtime 文件可能带有 Windows EFS 加密属性。Codex 启动时会尝试把这些 runtime 文件复制或解包到本地缓存目录,但复制过程中可能因为加密属性无法正确保留而失败或反复重试。
结果就是:Codex 不断创建新的 .staging-* 半成品目录,启动流程却无法进入正常界面。
codex-runtime-repair 只做一件事:安全、可回滚地修复 Codex 本地 runtime 缓存。
具体步骤:
- 自动识别当前安装的
OpenAI.Codex版本。 - 从
.staging-*目录识别当前 runtime hash。 - 把未完成的 staging 目录移动到带时间戳的备份目录。
- 从 Codex 安装包内置 runtime 逐文件读取字节并写入本地缓存。
- 写出的文件不保留 EFS 加密属性。
- 通过文件数量、大小和 manifest 校验复制结果。
- 修复完成后启动 Codex 做快速验证。
这个项目的范围非常窄,尽量避免造成新的问题。
它不会:
- 删除你的聊天记录。
- 重置你的 Codex 账号或登录状态。
- 修改
%APPDATA%\Codex。 - 卸载或重装 Codex。
- 修改 Windows 设置。
- 修改注册表。
- 清理无关缓存。
- 关闭无关程序。
它只操作这个目录:
%LOCALAPPDATA%\OpenAI\Codex\runtimes\cua_node
脚本默认尽量保守:
- PowerShell 主脚本默认是 dry-run,不会改任何文件。
- 真正修复需要
-Apply。 - 修复模式下默认仍要求你手动输入
YES。 - 旧目录只移动到备份,不直接删除。
- 只关闭来自
OpenAI.Codex包的ChatGPT.exe进程。 - 复制完成后会校验 runtime 是否完整。
下载或克隆这个仓库后,先执行 dry-run:
.\scripts\Repair-CodexRuntime.ps1dry-run 只会打印当前 Codex 版本、内置 runtime、检测到的 staging 目录,以及将要修复的缓存路径,不会进行任何修改。
确认无误后执行修复:
.\scripts\Repair-CodexRuntime.ps1 -Apply脚本会要求你输入 YES 后才继续。
如果你只是想双击运行,可以双击根目录里的:
Repair-CodexRuntime.cmd
这个启动器会进入修复模式,但主脚本仍然会要求确认。
修复后不自动启动 Codex:
.\scripts\Repair-CodexRuntime.ps1 -Apply -NoLaunch跳过交互确认:
.\scripts\Repair-CodexRuntime.ps1 -Apply -Yes建议只有在你已经看过 dry-run 输出后,才使用 -Yes。
当 Codex 桌面端安装或更新后反复打不开,并且你看到下面目录里不断出现 .staging-* 半成品目录时,可以使用这个工具:
%LOCALAPPDATA%\OpenAI\Codex\runtimes\cua_node
如果你的问题是网络登录失败、账号异常、模型不可用、项目权限问题等,这个工具不是对应的修复方案。
建议给仓库添加这些 topics:
codex windows powershell desktop-app repair-tool runtime-cache openai msix efs