chatgpt-codex-repair

用于修复 OpenAI ChatGPT/Codex Windows 桌面应用(MSIX 包名 “OpenAI.Codex”)在出现“Windows 安装未完成”卡住或报错“创建聊天失败”“无法解析功能覆盖优先级”时的问题。适用于客户端无法启动、卡在安装界面或无法创建聊天的情况;根本原因通常是 %USERPROFILE%\.codex\config.toml 文件损坏或缺失(并非 WSL/Windows 沙盒问题)。

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "chatgpt-codex-repair":https://skillpi.com/zh/skills/deepskill-c7723be6c652845e3cd07ff241d82f29ba7ad19195ded68c825cd022e3938115。安装前核对上游来源和版本:https://skillhub.cn/skills/user_f7f866dd/chatgpt-windows-setup-fix。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

skillhub.cn

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

用于修复 OpenAI ChatGPT/Codex Windows 桌面应用(MSIX 包名 “OpenAI.Codex”)在出现“Windows 安装未完成”卡住或报错“创建聊天失败”“无法解析功能覆盖优先级”时的问题。适用于客户端无法启动、卡在安装界面或无法创建聊天的情况;根本原因通常是 %USERPROFILE%\.codex\config.toml 文件损坏或缺失(并非 WSL/Windows 沙盒问题)。

0 下载

介绍来源: third_party · user_f7f866dd · 1.0.0 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
适合谁
来源文档未说明。
输入和输出
来源文档未说明。
软件、账号及付费要求
翻译待完成,请参阅来源文档。
限制与区别
来源文档未说明。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: chatgpt-codex-repair
description: This skill repairs the OpenAI ChatGPT / Codex desktop app (Windows, MSIX package "OpenAI.Codex") when it is stuck on "Windows setup didn't finish" or fails with "Error creating chat" / "failed to resolve feature override precedence". Use it whenever a user reports the ChatGPT/Codex desktop client failing to start, hanging on setup, or being unable to create a chat. The root cause is almost always a corrupted or missing `%USERPROFILE%\.codex\config.toml` (NOT a WSL / Windows Sandbox system problem, despite common misdiagnosis).
agent_created: true

ChatGPT / Codex Desktop Repair

Overview

The OpenAI ChatGPT desktop app on Windows ships as an MSIX package named OpenAI.Codex (not "ChatGPT" — search packages with *Codex*). Its two most common fatal symptoms are:

  1. "Windows setup didn't finish" — agent sandbox initialization hangs.
  2. "Error creating chat" / failed to resolve feature override precedence: 系统找不到指定的文件 (os error 2) — config read crashes on startup.

Both are caused by a bad ~/.codex/config.toml (or a file it references). The app stores its real config OUTSIDE the MSIX package, so uninstalling / reinstalling / Reset-AppxPackage does NOT clear it — the broken state is reused every time. WSL and Windows Sandbox are red herrings; the desktop client does not require them.

Recurrence — auto-update silently re-breaks it (read this first)

This is the single most token-wasting trap: ChatGPT/Codex auto-updates in the background, and an update silently resets [windows] sandbox back to "elevated" (and can revert the catalog path). So the exact same "Windows setup didn't finish" symptom recurs after every update. It is NOT a new problem and NOT caused by disk cleanup, Dism++, Windows 磁盘清理, or anything the user did — just re-apply the fix.

When the symptom returns:

  1. Re-apply Step 1 (sandbox = "unelevated") and, if needed, Step 2.
  2. Or just run the bundled one-click repair — see Quick fix below. It is idempotent.
  3. Reopen ChatGPT. No need to re-diagnose from scratch.

Workflow Decision Tree

User reports ChatGPT/Codex broken
  │
  ├─ Symptom A: "Windows setup didn't finish"
  │     └─ See Step 1 (fix [windows] sandbox)
  │
  └─ Symptom B: "Error creating chat" / feature override precedence / os error 2
        └─ See Step 2 (fix model_catalog_json / referenced files)

Both symptoms can co-occur. Apply Step 1 first, then Step 2 if needed.

Step 0 — Locate and read the config (read-only)

The config lives at C:\Users\<user>\.codex\config.toml. Confirm it exists and read it.

Useful companion locations:

  • App package dir: C:\Program Files\WindowsApps\OpenAI.Codex_*\
  • Logs (newest first): C:\Users\<user>\AppData\Local\Packages\OpenAI.Codex_*\LocalCache\Local\Codex\Logs\
  • Real (non-virtualized) data: C:\Users\<user>\AppData\Local\OpenAI\Codex\

To read the latest log and catch the real error:

$pkg=(Get-AppxPackage -Name *Codex* | Select-Object -First 1).PackageFamilyName
$logdir="$env:LOCALAPPDATA\Packages\$pkg\LocalCache\Local\Codex\Logs"
Get-ChildItem -Path $logdir -Recurse -Filter *.log | Sort-Object LastWriteTime -Descending |
  Select-Object -First 3 | ForEach-Object {
    Get-Content $_.FullName | Where-Object { $_ -match 'os error|feature override|Windows setup|Error creating|failed to' }
  }

The package folder name suffix varies by version — list with Get-AppxPackage -Name *Codex* to get the exact PackageFullName.

Step 0b — If a third-party proxy manager (CC Switch, etc.) is in use

Some users route Codex through a local proxy (e.g. CC Switch runs cc-switch.exe and listens on http://127.0.0.1:15721/v1). In that case the config is owned by that tool, not by you:

[model_providers.custom]
name = "deepseek"
base_url = "http://127.0.0.1:15721/v1"      # local proxy, NOT the provider URL
wire_api = "responses"
experimental_bearer_token = "PROXY_MANAGED"  # proxy injects the real key

Recognize it by: base_url points to 127.0.0.1/localhost, and/or experimental_bearer_token = "PROXY_MANAGED".

Do NOT manually rewrite base_url / wire_api / the catalog slug — the proxy manager will overwrite your edits the next time it runs and re-point at the provider directly (e.g. https://api.deepseek.com/...), which then 404s because the provider may not support the Responses API path the app appends.

Correct procedure when a proxy manager is involved:

  1. Confirm the manager process is running (e.g. Get-Process -Name cc-switch) and its port is listening: Test-NetConnection 127.0.0.1 -Port 15721.
  2. Verify end-to-end through the proxy (not the provider) with a quick request:
    import urllib.request, json
    req = urllib.request.Request(
        "http://127.0.0.1:15721/v1/responses",
        data=json.dumps({"model":"deepseek-v4-flash","input":"hi"}).encode(),
        headers={"Authorization":"Bearer PROXY_MANAGED","Content-Type":"application/json"},
        method="POST")
    print(urllib.request.urlopen(req, timeout=25).status)  # expect 200

    If this returns 200, the proxy + key injection work; a 404 here means the manager's key/upstream is misconfigured (fix in the manager UI, not config.toml).

  3. Make sure the manager re-wrote config.toml to the proxy form, then just restart ChatGPT so it re-reads the config. That alone clears the stale direct-to-provider 404.
  4. Tell the user: keep the proxy manager running — closing it kills the local endpoint and ChatGPT can no longer send requests.

Step 1 — Fix "Windows setup didn't finish" (sandbox)

Open the config and look for:

[windows]
sandbox = "elevated"

elevated requires a one-time admin install (creates a sandbox user, firewall rules, local policy). When that install fails on the user's machine, the app hangs forever on setup.

Fix: change it to the official fallback (no admin install needed):

[windows]
sandbox = "unelevated"

Never delete the whole file — it usually holds the user's model/API settings. Edit only the offending line. Back up the file first (see Step 3).

Step 2 — Fix "Error creating chat" (missing referenced file)

The error failed to resolve feature override precedence: 系统找不到指定的文件 (os error 2) means the config references a file that does not exist, so the entire config read aborts and cascades into failed to reload config, experimentalFeature/list, plugin/list, etc.

Most often the culprit is:

model_catalog_json = "cc-switch-model-catalog.json"   # relative path — file missing!

model_catalog_json points to a custom model-catalog JSON. If the file is missing (CC Switch or similar tool failed to generate it, or it was lost on reinstall), every config read fails.

Fix (two parts):

  1. Create the missing file with a valid catalog (see assets/model-catalog-template.json). The slug MUST match the model = "..." value in config.toml.
  2. Change the path to an absolute path (relative paths / ~ are known to break):
    model_catalog_json = "C:\\Users\\<user>\\.codex\\cc-switch-model-catalog.json"

The model_catalog_json schema is strict — missing fields like slug, display_name, base_instructions, supports_reasoning_summaries, supported_reasoning_levels, shell_type, visibility will throw "missing field X" on next load. Use the template.

If a different referenced path is missing (e.g. a [marketplaces.*] source), apply the same logic: create the file / fix the path, prefer absolute paths.

Quick fix — one-click repair (recommended)

Copy the idempotent repair script below into a *.ps1 file on Windows and run it from PowerShell (powershell -ExecutionPolicy Bypass -File .\repair.ps1). It does Steps 1–3 automatically:

  1. Backs up config.toml (timestamped, never overwrites old backups).
  2. Rewrites sandbox = "elevated" → "unelevated".
  3. Rewrites a relative model_catalog_json to its absolute path.
  4. Kills stuck ChatGPT/Codex processes so the app can be reopened cleanly.

Run it whenever the symptom appears (including right after an auto-update). Safe to run even when the config is already correct — it skips changes it does not need to make.

$ErrorActionPreference = 'Stop'

$configPath = "$env:USERPROFILE\.codex\config.toml"
$absCatalog = "$env:USERPROFILE\.codex\cc-switch-model-catalog.json"

if (-not (Test-Path $configPath)) {
    Write-Host "config.toml not found: $configPath" -ForegroundColor Red
    exit 1
}

# Backup current config (timestamped, never overwrites old backups)
$timestamp = Get-Date -Format 'yyyyMMddHHmmss'
$bak = "$configPath.bak-$timestamp"
Copy-Item $configPath $bak -Force
Write-Host "Backed up config to: $bak"

$content = Get-Content $configPath -Raw
$changed = $false

# 1) Fix [windows] sandbox = "elevated" -> "unelevated"
if ($content -match 'sandbox\s*=\s*"elevated"') {
    $content = $content -replace 'sandbox\s*=\s*"elevated"', 'sandbox = "unelevated"'
    Write-Host "Fixed: [windows] sandbox set to unelevated" -ForegroundColor Green
    $changed = $true
} else {
    Write-Host "OK: [windows] sandbox already not elevated, skipped"
}

# 2) Fix relative model_catalog_json to absolute path
if ($content -match 'model_catalog_json\s*=\s*"cc-switch-model-catalog\.json"') {
    $content = $content -replace 'model_catalog_json\s*=\s*"cc-switch-model-catalog\.json"', "model_catalog_json = `"$absCatalog`""
    Write-Host "Fixed: model_catalog_json set to absolute path" -ForegroundColor Green
    $changed = $true
} else {
    Write-Host "OK: model_catalog_json already absolute or not present, skipped"
}

if ($changed) {
    Set-Content $configPath $content -Encoding ASCII -NoNewline
    Write-Host "config.toml updated." -ForegroundColor Green
} else {
    Write-Host "No changes needed in config.toml."
}

# 3) Kill stuck ChatGPT / Codex processes
$procs = Get-Process | Where-Object { $_.Name -match 'codex|chatgpt' }
if ($procs) {
    $procs | ForEach-Object { Stop-Process -Id $_.Id -Force -ErrorAction SilentlyContinue }
    Write-Host "Killed $($procs.Count) stuck ChatGPT/Codex process(es). Please reopen ChatGPT." -ForegroundColor Yellow
} else {
    Write-Host "No running ChatGPT/Codex process found."
}

Write-Host ""
Write-Host "Done. If ChatGPT still shows the error after reopening, make sure CC Switch is running (cc-switch.exe)."

Step 3 — Apply changes safely

  1. Kill stuck processes: Get-Process -Name ChatGPT, codex | Stop-Process -Force
  2. Back up config: Copy-Item $env:USERPROFILE\.codex\config.toml $env:USERPROFILE\.codex\config.toml.bak-$(Get-Date -Format yyyyMMddHHmmss)
  3. Edit config.toml (Edit tool) — change only the offending lines.
  4. Create any missing referenced file (Write tool) using assets/model-catalog-template.json as a base, adjusting the slug to match model = "...".
  5. Relaunch the app: explorer.exe "shell:appsFolder\OpenAI.Codex_<suffix>!App"
  6. Wait ~20s, then re-read the latest log. Success looks like: method=config/read ... errorCode=null and no failed to resolve feature override precedence / Error creating chat lines.

Step 4 — Last-resort fallback

If editing still fails, rename (do NOT delete) the config so the app regenerates a clean default:

Rename-Item $env:USERPROFILE\.codex\config.toml $env:USERPROFILE\.codex\config.toml.old

Relaunch → app generates fresh default config and should open. Then copy the user's custom model provider block (e.g. the [model_providers.custom] DeepSeek section) from config.toml.old back into the new file — but never copy back a broken sandbox = "elevated" line.

Notes / gotchas

  • The desktop client does NOT need WSL or Windows Sandbox. Do not send users down the wsl --install path for these symptoms.
  • Windows Sandbox is unavailable on Windows Home edition — another reason elevated sandbox setup fails there.
  • model_catalog_json requires an absolute path; relative paths silently fail.
  • A single fs/readFile ... os error 3 (path not found) with no cascade is usually benign.
  • User-level API keys set inside the app (e.g. a DeepSeek key) live in this config and are cleared by Reset-AppxPackage — confirm with the user after a reset.
  • Recurrence after auto-update: the app updates itself and resets sandbox to elevated, so the symptom returns on its own. Re-apply the fix (or run the embedded repair script from Quick fix); do not treat it as a fresh incident.
  • Disk / system cleanup does NOT cause this. Tools like Dism++, Windows 磁盘清理, and Dism /Online /Cleanup-Image clean update caches and WinSxS — they never touch ~/.codex/config.toml. If the symptom shows up "right after cleanup", it is coincidence (an update reset fired around the same time), not causation. Keep the pagefile / cleanup changes the user made; they are unrelated.

Resources

  • assets/model-catalog-template.json — ready-to-use model catalog; set slug to match model = "..." in config.toml.
  • references/model_catalog_schema.md — full field reference for model_catalog_json.
  • The one-click repair script is embedded inline in Quick fix above (copy into a *.ps1 file and run with powershell -ExecutionPolicy Bypass -File .\repair.ps1).

当前收录版本

1.0.0

核对来源版本 ↗

安全与评测信息

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值92/100

亮点

  • 针对 Windows 用户在使用 OpenAI ChatGPT/Codex 桌面客户端时常见的高频故障(启动失败、安装卡住、创建聊天报错)提供精准修复方案
  • 包含自动化 PowerShell 修复脚本,支持一键修复,显著提升问题解决效率
触发精准95/100

亮点

  • 触发词覆盖全面,明确列出典型错误信息、系统环境和核心症状,边界清晰,不易误触或漏触
结构规范85/100

待提升项

  • 引用文件缺失 原报告严重程度:轻微

    SKILL.md 中引用了 assets/model-catalog-template.json 和 references/model_catalog_schema.md,但未在传入内容中提供

    改进建议:请补充被引用的资源文件,或明确说明其为外部资源并提供获取方式

  • description写错位置 原报告严重程度:轻微

    顶层 frontmatter 中 description 字段为空,实质描述内容位于 skill_body 内部

    改进建议:将核心描述内容移至顶层 frontmatter 的 description 字段,保持规范一致性

亮点

  • 文档结构完整,包含决策树、分步修复流程、自动化脚本、注意事项和最后手段,逻辑清晰,易于执行
执行可靠88/100

亮点

  • 修复流程安全可靠,强调备份优先、精准修改、进程清理,并提供最后手段(重命名配置)避免数据丢失
  • 自动化脚本包含路径检查、备份机制、变更检测和进程管理,具备良好的异常处理能力
证据可验 (前四项均值)90/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

  • 读取本地文件

    限定到你选择的文件或项目目录;避免读取无关的个人资料、密钥和配置文件。

    主文档提及 · 第 65, 192 行
  • 保存或修改文件

    先确认输出目录和同名文件是否会被覆盖;重要文件保留备份,优先写入新的输出目录。

    主文档提及 · 第 214 行
  • 管理员或提升权限

    确认确有必要再提升权限;不要关闭防护、绕过证书验证或扩大整个系统的访问权限。

    主文档提及 · 第 164, 283 行
文档引用的域名或地址

这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。

  • 127.0.0.1
  • api.deepseek.com

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

翻译待完成,请参阅来源文档。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。