| name | codex-windows-fast-patch |
|---|---|
| description | Reapply the Windows Codex Desktop MSIX patch after Store upgrades, including Fast Mode request/UI gates, locale i18n, plugin UI gates, Chrome/browser_use gates, Goal command gates, Windows Computer Use availability gates, ASAR integrity repair, signing/installing the patched package, SDK cleanup, Fast Mode wire verification, and registering the local plugin marketplace openai-curated-local. |
Use this skill when the user says Codex Desktop was upgraded and the Fast Mode / Plugins / Goal patch disappeared, asks to repatch Codex on Windows, asks to verify whether Fast Mode is really being sent, asks to restore/register the local plugin marketplace, or asks to enable Chrome browser use or Windows Computer Use in Codex Desktop. Also use it when the language/locale setting reverts after restart, browser or plugin entries are hidden by availability gates, the Computer Control settings page shows "Any App" / "任意应用" as disabled by organization or unavailable in the current region, or the Connections / Codex mobile remote-control setup flow drops into an auth error loop on Windows.
This skill is Windows-only. It depends on the Windows Store/MSIX package layout, PowerShell, Get-AppxPackage, makeappx.exe, signtool.exe, Windows user environment variables, and Windows Computer Use helper paths.
Do not run this skill on macOS. A macOS adaptation needs a separate workflow for the Codex .app bundle, ASAR extraction and repacking, macOS code signing or quarantine handling, shell scripts, and macOS-specific Computer Use availability.
Before doing substantive work with this skill, run the bundled self-update helper once, then reload this SKILL.md if it reports an update:
powershell -NoProfile -ExecutionPolicy Bypass -File "$env:USERPROFILE\.codex\skills\codex-windows-fast-patch\scripts\update-skill-from-github.ps1"The helper checks chen0416ccc-cpu/codex-windows-fast-patch-skill on GitHub and synchronizes only the skill allowlist: SKILL.md, agents, scripts, references, and assets. 如果无法更新到最新版,则不要中断当前任务;继续使用本机已安装的当前版本完成工作,并在结果中说明未能更新。
If the normal workflow does not explain a restriction, plugin gate, Computer Use failure, or Codex mobile entry failure, read references/restriction-debug-cases.md before editing scripts or repatching.
Before any action that can modify, regenerate, or overwrite $env:USERPROFILE\.codex\config.toml, create one timestamped backup of the current file for the task. This applies whether the agent uses bundled scripts, writes TOML manually, runs another helper, registers a marketplace, changes MCP servers, or repairs Computer Use.
The bundled scripts already back up an existing config.toml once per script run before their first write. If not using those scripts, do the backup explicitly before touching the file:
$config = Join-Path $env:USERPROFILE '.codex\config.toml'
if (Test-Path -LiteralPath $config -PathType Leaf) {
$backupDir = Join-Path (Split-Path -Parent $config) 'backups\config'
New-Item -ItemType Directory -Force -Path $backupDir | Out-Null
$backup = Join-Path $backupDir ('config.toml.' + (Get-Date -Format 'yyyyMMdd-HHmmss-fff') + '.manual.bak')
Copy-Item -LiteralPath $config -Destination $backup -Force
Write-Host "config.toml backup before overwrite: $backup"
}Do not proceed with a config write if the backup of an existing config fails. After writing, validate TOML syntax with tomllib when Python is available.
- If the task may modify
config.toml, skills, marketplaces, or MCP server settings, create a state snapshot first:
powershell -NoProfile -ExecutionPolicy Bypass -File "$env:USERPROFILE\.codex\skills\codex-windows-fast-patch\scripts\manage-codex-backups.ps1" -Action Backup- Inspect current package status:
Get-AppxPackage -Name OpenAI.Codex | Select-Object Name,PackageFullName,Version,SignatureKind,InstallLocation- Run a dry run first after every Codex upgrade:
powershell -NoProfile -ExecutionPolicy Bypass -File "$env:USERPROFILE\.codex\skills\codex-windows-fast-patch\scripts\repatch-codex-windows.ps1" -DryRun- If the dry run finds all patch targets, run the full repatch:
powershell -NoProfile -ExecutionPolicy Bypass -File "$env:USERPROFILE\.codex\skills\codex-windows-fast-patch\scripts\repatch-codex-windows.ps1"The wrapper calls the bundled patch script at scripts\patch_codex_fast_mode_windows_msix.ps1 with these defaults:
-InstallPrerequisites-Install-Launch-CleanupWindowsSdkAfterInstall-CleanupAfter-VerifyFastModeRequest
It also verifies and writes the local marketplace config at $env:USERPROFILE\.codex\marketplaces\openai-curated-local, including source_type = "local" and the exact source path.
It also syncs the installed openai-bundled marketplace from the current Codex package into $env:USERPROFILE\.codex\.tmp\bundled-marketplaces\openai-bundled, overlays a local computer-use@openai-bundled compatibility plugin, writes that local marketplace into config, repairs stable browser / chrome plugin cache copies so their latest junctions do not point at the mutable .tmp marketplace mirror, and enables CODEX_ELECTRON_ENABLE_WINDOWS_COMPUTER_USE=1 for the current user so the Desktop app can expose Windows Computer Use after restart.
It patches Fast Mode in both the request path and the settings UI path. The request patch removes the ChatGPT-only branch while still reading host/model feature requirements; the UI patch removes the matching ChatGPT-only availability check in service-tier settings.
It patches the locale i18n gate that can force the Desktop UI back to English after restart when enable_i18n is disabled in the shipped webview bundle.
It patches Chrome/browser_use gates in both the webview assets and the main Electron feature sender/receiver path, covering in-app browser, browser pane, and external browser availability. This only unlocks the local Desktop gates; Chrome extension and native messaging files still need to exist and should be verified separately.
It also patches the Desktop webview gates that otherwise hide or disable Windows Computer Use behind the computer_use experimental feature and Statsig gate 1506311413, and it writes features.computer_use = true into $env:USERPROFILE\.codex\config.toml without replacing the rest of the [features] table.
It also writes [windows] sandbox = "unelevated" into $env:USERPROFILE\.codex\config.toml. On Windows, this avoids the elevated sandbox setup refresh path that can fail with spawn setup refresh / OS error 740 and break Computer Use startup.
It also repairs local marketplace manifest layout when a local root has only a legacy root marketplace.json; the current Codex CLI expects .agents\plugins\marketplace.json, and missing that file can make codex plugin list fail for all configured marketplaces.
It also patches the Codex mobile / remote-control setup flow so a missing ChatGPT Desktop remote-control auth token does not force the settings modal to navigate to /login and become hard to exit; the flow falls back to a safe empty state instead. This does not replace real server-side remote-control enrollment when cross-device control is actually required.
Any bundled script write to an existing config.toml first creates one timestamped backup for that script run under .codex\backups\config\.
- Do not modify
C:\Program Files\WindowsAppsin place. Use the MSIX repack script. - Do not trust a response like
FAST_CHECK_OKas proof of Fast Mode. Trust only the wrapper/script wire verification, which captures Codex's/v1/responsesWebSocket request and checksservice_tier=priority. - If the app launches then immediately exits, run Electron logging and check for ASAR integrity failures:
$pkg = Get-AppxPackage -Name OpenAI.Codex | Select-Object -First 1
$exe = Join-Path $pkg.InstallLocation 'app\Codex.exe'
$env:ELECTRON_ENABLE_LOGGING='1'
Push-Location (Split-Path -Parent $exe)
& $exe --enable-logging=stderr --v=1 2>&1 | Select-String -Pattern 'FATAL|Integrity|asar|ERROR'
Pop-Location
Remove-Item Env:ELECTRON_ENABLE_LOGGING -ErrorAction SilentlyContinue-
If
makeappx.exeorsigntool.exeis missing, run the wrapper normally; it installs Windows SDK temporarily and removes it afterward. -
If the local marketplace directory is missing, do not invent a marketplace. Report the missing path and ask whether to restore it from backup or re-extract it from a known source.
-
For user-level Codex state backup or migration, use
scripts\manage-codex-backups.ps1. It backs upconfig.toml, extractedmcp_servers.json, custom skills, marketplaces, andchrome-native-hosts.json. It excludes.git,node_modules, build output, and virtual environments by default; use-IncludeDependencyDirsonly when an exact offline dependency copy is needed. Plugin cache and.tmp\bundled-marketplacesare also opt-in because they can be large. -
If
codex plugin listfails withfailed to load configured marketplace snapshot(s)and a local marketplace root contains onlymarketplace.json, copy that manifest to.agents\plugins\marketplace.jsonand re-runcodex plugin listbefore diagnosing individual plugins. -
Do not depend on
Downloads\patch_codex_fast_mode_windows_msix.ps1; the skill is intended to be self-contained. Usescripts\patch_codex_fast_mode_windows_msix.ps1unless the user explicitly passes-PatchScript. -
If the user's upstream is CPA, verify CPA override rules as part of Fast Mode validation: for the Codex-facing models, force
service_tieras a string parameter with valuepriority. Local wire capture only proves Codex Desktop sent the field; CPA can still strip, ignore, or fail to apply it unless the override rule is configured. -
In Codex 26.601.2237+, Fast Mode may be gated in
webview\assets\read-service-tier-for-request-*.jsas an async helper shaped likereturn authMethod===\chatgpt` ? featureRequirements?.fast_mode !== false : false. The patch should remove thechatgpt`-only branch while still reading the model/host feature requirement, then verify with the wire capture. -
In Codex 26.601.2237+, Fast Mode may also stay invisible or disabled in the settings UI through
webview\assets\use-service-tier-settings-*.js. The patch should connect the Fast UI patcher and logfast-mode UI patch result, not only patch the request helper. -
If the language selection reverts to English after restart, inspect the extracted webview assets for
enable_i18n,locale_source, andlocaleOverride. The locale patch should loglocale i18n patch result; do not treat a config-only language write as sufficient. -
If browser, Chrome, browser pane, or
browser_useremains unavailable, inspect the Desktop log forbrowser_use_availability_resolved.reason=statsig-disabledmeans the local gate patch did not apply or the Store build introduced a new target shape;reason=local-patchedmeans the availability gate is open and the next checks are the Chrome extension, native messaging host, and bundled plugin state. -
In Codex 26.601.2237+, the old plugin UI gate targets
533078438andpluginDeepLinkAuthBlockedmay be absent. Inspectwebview\assets\plugins-page-*.jsforopenPluginInstall,authMethod:, and a compact assignment shaped like{authMethod:x}=..., y=authBlocked(x),; patch the auth-blocked variable tofalseinstead of failing on missing old sidebar/skills/detail chunks. -
In Codex 26.519.11010+,
use-plugin-install-flow-*.jsmay no longer containfeatureName:\computer_use`. For the Computer Use install-flow gate, locate the file withinstallPlugin:asyncandopenPluginInstall, then patch the imported availability tuple so the first.available` value for Computer Use is forced true. -
Do not modify
C:\Program Files\WindowsAppsin place to enable Computer Use. The Windows gate is controlled byCODEX_ELECTRON_ENABLE_WINDOWS_COMPUTER_USE=1, and the helper paths are supplied through the localcomputer-use@openai-bundledplugin. -
If Computer Use or a
node_replComputer Use plugin fails on Windows withwindows sandbox failed: spawn setup refresh, inspect$env:USERPROFILE\.codex\.sandbox\sandbox.<date>.log. If it showscodex-windows-sandbox-setup.exefailing with OS error 740, set[windows] sandbox = "unelevated". Checkcodex sandbox --helpbefore verification: if the help lists awindowscommand, verify withcodex sandbox windows "C:\Windows\System32\cmd.exe" /c echo OK; only builds whose help accepts a direct command form should usecodex sandbox "C:\Windows\System32\cmd.exe" /c echo OK. -
If "任意应用" is visible but disabled as organization/region unavailable, inspect
webview\assets\use-is-plugins-enabled-*.jsin the extracted ASAR. The relevant local gates arefeatureName:\computer_use`and Statsig1506311413`; reapply the MSIX patch rather than editing WindowsApps in place. -
If the Computer Control page says
Computer Use 插件不可用, check the Desktop log forcomputer-use native pipe startup failedwithmissing-helper-path, then inspect$env:USERPROFILE\.codex\.tmp\bundled-marketplaces\openai-bundled\.agents\plugins\marketplace.jsonandplugins\computer-use. If they are missing or partial, stop bundledextension-hostprocesses under$env:USERPROFILE\.codex\plugins\cache\openai-bundled, rerunscripts\install-computer-use-local.ps1, restart Codex Desktop, and confirm the log ends withcomputer-use native pipe startup ready. -
If
scripts\install-computer-use-local.ps1 -StrictVerifyOnlyfails because$env:USERPROFILE\.codex\plugins\cache\openai-bundled\computer-use\latest\.codex-plugin\plugin.jsonis missing, run the same script with-VerifyOnlyto repair the marketplace mirror, cached plugin copy, andlatestlink, then rerun-StrictVerifyOnly. -
If the failure reappears after fully quitting and reopening Codex Desktop, inspect
$env:USERPROFILE\.codex\chrome-native-hosts.jsonand the real targets of$env:USERPROFILE\.codex\plugins\cache\openai-bundled\chrome\latestandbrowser\latest. Stale Chrome native-host entries, or achrome\latestjunction that points at$env:USERPROFILE\.codex\.tmp\bundled-marketplaces\openai-bundled\plugins\chrome, can let Chrome native messaging lock the mutable marketplace mirror. The symptom isbundled_plugins_marketplace_resolve_failedwithEBUSYonplugins\chrome\extension-host\windows\x64, followed byhelper paths changedandmissing-helper-path; rerunscripts\install-computer-use-local.ps1to stop the lock holder, rebuild stable browser/chrome cache copies, repoint the Chrome native messaging manifest to the stable cache path, and repair Computer Use. -
If the "Codex mobile" / "Codex 移动版" entry or Connections > Control This Computer > Set up opens then drops back, opens nothing, routes to login, or becomes hard to exit, check the Desktop logs under
%LOCALAPPDATA%\Packages\OpenAI.Codex_2p2nqsd0c76g0\LocalCache\Local\Codex\Logs\<year>\<month>\<day>.load_remote_control_unauthedorrefresh_local_remote_control_client_id_failedwithSign in to ChatGPT in Codex Desktopmeans the local patch should prevent the UI loop, but real cross-device remote-control enrollment still requires a ChatGPT Desktop sign-in, not only an API-key Codex login. When patching.vite\build\main-*.js, match the unauth branch by behavior (local_remote_control_client_id=null,authRequired:!0,clientAuthorized:!1,load_remote_control_unauthed) rather than fixed minified class or logger names. -
In Codex 26.602.3474-era builds,
webview\assets\codex-mobile-setup-flow-*.jsmay be absent while the.vite\build\main-*.jsremote-control unauth branch is still present. Treat only that setup-flow chunk as not applicable for that build: log the missing target and pass__none__to the Computer Use gate patcher, but keep the other repair target checks strict.
-DryRun: verify bundle targets only; no install.-NoLaunch: install but do not start Codex Desktop.-SkipFastVerify: skip the WebSocketservice_tiercapture.-KeepBuild: keepDownloads\codex-msix-repackfor debugging.-SkipSdkCleanup: leave Windows SDK installed.-RegisterMarketplaceOnly: only registeropenai-curated-local; do not patch Codex.-PatchScript <path>: override the bundled patch script only when testing a newer patcher.-SkipComputerUse: skip installing/verifying the local Computer Use compatibility plugin.
To refresh only the local Windows Computer Use files and environment gate:
powershell -NoProfile -ExecutionPolicy Bypass -File "$env:USERPROFILE\.codex\skills\codex-windows-fast-patch\scripts\install-computer-use-local.ps1"To verify and automatically repair missing local Computer Use files:
powershell -NoProfile -ExecutionPolicy Bypass -File "$env:USERPROFILE\.codex\skills\codex-windows-fast-patch\scripts\install-computer-use-local.ps1" -VerifyOnlyTo verify without changing files:
powershell -NoProfile -ExecutionPolicy Bypass -File "$env:USERPROFILE\.codex\skills\codex-windows-fast-patch\scripts\install-computer-use-local.ps1" -StrictVerifyOnlyTo back up local Codex config, MCP server entries, custom skills, marketplaces, and Chrome native-host state:
powershell -NoProfile -ExecutionPolicy Bypass -File "$env:USERPROFILE\.codex\skills\codex-windows-fast-patch\scripts\manage-codex-backups.ps1" -Action BackupTo list or restore snapshots:
powershell -NoProfile -ExecutionPolicy Bypass -File "$env:USERPROFILE\.codex\skills\codex-windows-fast-patch\scripts\manage-codex-backups.ps1" -Action List
powershell -NoProfile -ExecutionPolicy Bypass -File "$env:USERPROFILE\.codex\skills\codex-windows-fast-patch\scripts\manage-codex-backups.ps1" -Action Restore -BackupPath "<backup path>"- If an existing
config.tomlwas modified, the log shows a timestamped backup under.codex\backups\config\. Get-AppxPackage -Name OpenAI.CodexshowsSignatureKind = Developer.- Codex Desktop processes stay alive from
...\WindowsApps\OpenAI.Codex_<version>...\app\Codex.exe. - Fast Mode verification logs
request wire service_tier=priority. - The patch log includes
fast-mode UI patch resultandlocale i18n patch result, each eitherpatchedoralready-patched. - The patch log includes
browser-use gate patch result, eitherpatchedoralready-patched. - Desktop logs show
browser_use_availability_resolvedwithavailable=trueandreason=local-patchedafter the patched app starts. - If upstream is CPA, CPA has an override rule for the Codex-facing models that sets
service_tierto string valuepriority. $env:USERPROFILE\.codex\config.tomlcontains[marketplaces.openai-curated-local].$env:USERPROFILE\.codex\config.tomlcontains[marketplaces.openai-bundled]pointing at$env:USERPROFILE\.codex\.tmp\bundled-marketplaces\openai-bundled, and that local mirror contains the installed bundled plugins pluscomputer-use.- Any configured local marketplace used for personal plugins has a supported
.agents\plugins\marketplace.json; root-levelmarketplace.jsonalone is not enough for the current plugin CLI. $env:USERPROFILE\.codex\config.tomlcontains[plugins."computer-use@openai-bundled"]withenabled = true.codex plugin listshowscomputer-use@openai-bundledasinstalled, enabled.- If Chrome/browser use is required,
codex plugin listshowschrome@openai-bundledandbrowser@openai-bundledasinstalled, enabled, the Chrome native messaging host manifest points to a stable cache path under$env:USERPROFILE\.codex\plugins\cache\openai-bundled\chrome\<version>\...rather thanchrome\latestor.tmp\bundled-marketplaces,chrome\latestandbrowser\latestpoint to stable cache version directories rather than the mutable marketplace mirror, and a smoke test can read a controlled tab title such asExample Domain. CODEX_ELECTRON_ENABLE_WINDOWS_COMPUTER_USEis set to1for the current user.$env:USERPROFILE\.codex\config.tomlcontains[features]withcomputer_use = true.$env:USERPROFILE\.codex\config.tomlcontains[windows]withsandbox = "unelevated", and the sandbox command syntax shown bycodex sandbox --helpsucceeds.$env:USERPROFILE\.codex\plugins\cache\openai-bundled\computer-use\latest\node_modules\@oai\sky\dist\project\cua\sky_js\src\targets\windows\internal\helper_transport.jsexists and can return screen info/screenshot.- The patched ASAR has
webview\assets\use-is-plugins-enabled-*.jswith the Computer Use availability gate forced local-available andwebview\assets\use-plugin-install-flow-*.jswith the Computer Use install gate unblocked. - The patched ASAR has
webview\assets\use-service-tier-settings-*.jswith the Fast Mode UI gate unblocked, the locale chunk withenable_i18nforced enabled, and browser_use feature chunks/main feature dispatch patched to report in-app and external browser availability locally. - The patched ASAR has
webview\assets\codex-mobile-setup-flow-*.jskeeping ChatGPT auth failures inside a closable setup flow, and.vite\build\main-*.jsmaps remote-control unauthenticated state to a safe empty state instead of an auth loop. makeappx.exeandsigntool.exeare missing again if SDK cleanup was enabled.