Codex Windows Fast Patch
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, asks to enable Chrome browser use or Windows Computer Use in Codex Desktop, or asks to enable/repair phone remote control while keeping third-party/API-key model access. Also use it when a custom provider or /v1/models exposes a new model but Desktop still hides it, when GPT-5.6 Sol/Terra/Luna are missing from the model picker, when the compact blue-purple Power slider falls back to the legacy Model / Reasoning / Speed menu because Statsig available_models filtering removed the required model combinations, or when the "Ultra in model picker slider" setting is visible but disabled because a third-party provider cannot load ChatGPT account user settings. 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, a Computer Use task reports native pipe, bundled plugin cache, helper path, package import, or runtime initialization errors, a Computer Use conversation loses cua.getApp / cua.listApps while cua.getState() and the native pipe still work and the symptom returns after every Desktop restart, a Computer Use call fails with Native app bindings are unavailable for windows. or times out on an in-app-browser tab while cua.computer.list_windows() still works, phone remote-control QR pairing spins/fails, post-pairing phone-created turns hit the wrong model API endpoint, Desktop new-chat/thread start fails with missing field inputSchema, local conversations disappear after switching model_provider / API account, restored conversations are visible but cannot continue because the current working directory is missing, or the user explicitly asks to configure the bundled custom model_instructions_file prompt asset.
Platform Compatibility
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.
Skill Root
Every command in this document refers to the skill directory as $SkillRoot. Resolve it once per session before running anything else. This skill does not care which harness loaded it, so the probe matches any agent home that follows the ~/<agent-home>/skills/<skill-name> layout:
powershell$SkillRoot = $env:CODEX_WIN_FAST_PATCH_SKILL_ROOT if (-not $SkillRoot) { $SkillRoot = (Get-ChildItem -Force -Path "$env:USERPROFILE\.*\skills\codex-windows-fast-patch\SKILL.md" -ErrorAction SilentlyContinue | Select-Object -First 1).Directory.FullName } if (-not $SkillRoot) { throw 'skill root not found; set CODEX_WIN_FAST_PATCH_SKILL_ROOT to the directory that holds this SKILL.md' }
If the agent already knows the directory it loaded this SKILL.md from, assign that path directly instead of probing. When more than one harness has the skill installed, set CODEX_WIN_FAST_PATCH_SKILL_ROOT to pick one explicitly; the probe otherwise takes the first match.
Self-Update Preflight
The skill directory is a git working tree, so updating is git pull. Run the cheap check first and skip the rest when nothing changed:
powershellgit -C "$SkillRoot" fetch --quiet origin git -C "$SkillRoot" rev-list --count 'HEAD..@{u}'
Keep 'HEAD..@{u}' single-quoted. PowerShell parses a bare @{u} as a hashtable literal and fails before git runs at all. HEAD..origin/HEAD is equivalent here and needs no quoting.
A count of 0 means the skill is current: skip the update and start the task. For a non-zero count, read what actually changed, then pull, then reload this SKILL.md:
powershellgit -C "$SkillRoot" log --oneline 'HEAD..@{u}' git -C "$SkillRoot" pull --ff-only
If @{u} reports no upstream configured, substitute the tracking ref explicitly, for example HEAD..origin/main.
Rules:
- Never block the repair on the update. When
fetchfails because the network is unavailable, GitHub is unreachable, or a proxy is down, continue with the installed version and state in the conclusion that the update was skipped. - Local edits are preserved by git, not silently discarded. Inspect with
git -C "$SkillRoot" status --shortandgit -C "$SkillRoot" diffbefore pulling. Uncommitted edits to files the update does not touch survivegit pull --ff-onlyuntouched. Uncommitted edits to a file the update also changes make git refuse the pull, name the blocking file, and leave the edit on disk; recover withgit stash,git pull --ff-only,git stash pop, and expectstash popto leave conflict markers when the local edit and the upstream change touch the same lines. Local commits make--ff-onlyrefuse because the branches diverged;git pull --rebasereplays them on top of the update. Never usegit reset --hardorgit checkout -- .to force a pull through, because local helper profiles and repair guards live in those edits. - A fork is just a different remote.
git -C "$SkillRoot" remote set-url origin <fork-url>pins the update source, and no extra configuration file is involved. - Roll back with git.
git -C "$SkillRoot" log --oneline -10, thengit -C "$SkillRoot" checkout <sha>returns to any earlier version. - When a patch step fails, check for updates again before concluding. A missing helper profile, a pattern that no longer matches, or an unrecognized Desktop build is exactly the case where upstream may already carry the fix, so repeat the fetch and log check at that point even if it already ran at the start of the task.
- If
$SkillRoothas no.gitdirectory, the copy was installed by copying files or through a harness plugin mechanism and can never self-update. Report that, keep working with the installed version, and suggest reinstalling withgit cloneso future updates work.
If the normal workflow does not explain a restriction, plugin gate, Computer Use failure, browser_use failure, or Fast Mode failure, read references/restriction-debug-cases.md before editing scripts or repatching.
If the task is phone remote control, QR pairing, mobile setup, isolated remote OAuth, remote-control WebSocket, or post-pairing API endpoint diagnosis, read references/remote-control-debug-cases.md before editing scripts or repatching.
Config Backup Rule
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:
powershell$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.
Workflow Selection
Before choosing the full MSIX repack path, identify whether the current failure is a Desktop bundle gate or a local plugin/runtime repair. Do not treat a vague "Chrome/Computer Use is unavailable" report as enough evidence to run the full repatch.
- Use the Model Experience workflow for Fast Mode request/UI failures, new models hidden from the Desktop picker, the compact Power slider falling back to the legacy picker, or its Ultra setting being disabled under a custom provider. These symptoms share the same service-tier/model-picker area. Run
scripts\patch_codex_fast_mode_windows_msix.ps1 -OnlyModelExperience -DryRunfirst; it checks the Fast request gate, Fast UI gate, model visibility filter, Electron Power sliderharborEnabledgate, and Ultra setting persistence independently, then repairs only the broken parts in one MSIX repack. The Ultra fallback preserves the normal ChatGPT account API path and uses localshow-ultra-in-model-picker-sliderconfig only when ChatGPT user settings cannot load.-OnlyCustomModelsremains a compatibility alias. Merge missing model metadata intomodels_cache.jsononly when read-only inspection proves the cache entry is absent; back up the cache first. The same area also covers the model picker offering only the Fast speed tier when the official catalog adds a secondultrafasttier forgpt-5.6-soland a custommodel_catalog_jsonpredates it; that is a config-layer catalog backfill, not an ASAR repair — see the missing Ultrafast tier case inreferences/restriction-debug-cases.md. - Use the full repatch workflow for locale, plugin UI gates, browser_use Desktop gates, Goal gates, ASAR integrity, settings/UI availability gates, or when Model Experience repair is required together with those features.
- Before a full repatch after a Store update, compare the current-user and
Get-AppxPackage -AllUsersresults. The patcher selects the highest-version valid current-user or SYSTEM-Staged package, plus running-process candidates; it uses WindowsApps-directory candidates only if the all-user query is unavailable. This prevents an older user-installed package from hiding a newer SYSTEM-Staged build without selecting a package registered only to another user. Check theselected Codex applog before proceeding. Use-AppPathonly when an explicit source override is required. - Use the Computer Use Only workflow first when evidence points to a local plugin/runtime problem:
codex plugin listmarketplace errors, missing.agents\plugins\marketplace.json, missing or partialopenai-bundledplugin files,bundled_plugins_marketplace_resolve_failed,EBUSYon bundled plugin files, native pipe unavailable,missing-helper-path, stale Chrome native messaging host paths, bundled plugin cache drift, Chrome/browser cache link drift, staleSKY_CUA_NATIVE_PIPEconfig,@oai/skyimport errors, orsetupComputerUseRuntimeimport failure. This class does not require an MSIX uninstall/reinstall unless a later check also proves a Desktop gate is still closed. - If a Store update breaks an already-configured MCP because its
commandpoints into a removed%LOCALAPPDATA%\OpenAI\Codex\runtimes\cua_node\<old-runtime-id>directory, use the retired CUA Node MCP case inreferences/restriction-debug-cases.md. This is a targetedconfig.tomlrepair, not evidence for a broad MSIX repatch or permission to install additional MCP servers. - If app/window enumeration works but the first screenshot fails with
SetIsBorderRequired failedand0x80004002on Windows 10, treat it as a native CUA screenshot-helper compatibility failure, not a cache path or Desktop gate. Readreferences/win10-computer-use-screenshot-backend.md, then usescripts\patch-computer-use-helper-win10.ps1only when its read-only status reports the exact supported original or patched hash. Unknown hashes require fresh analysis and must remain untouched. - If
sky.list_windows()succeeds but a later independentsky.get_window_state()orsky.activate_window()call fails withnode_repl exec context not found, read the cross-call approval case inreferences/restriction-debug-cases.md. On the exact documented@oai/sky 0.6.2helper transport, the persistent helper's approval callback can inherit the previous JavaScript call'sAsyncLocalStoragestore.install-computer-use-local.ps1 -VerifyOnlyapplies the hash-guarded request-context patch;-StrictVerifyOnlyonly verifies it. Reset the current JavaScript kernel after repair, then prove the fix with real captures in later independent calls. - Use the Custom Provider Tool Exposure triage when MCP tools or Computer Use are unavailable only under a custom
model_provider: the agent reports zero MCP tool names, while the same machine and config expose every MCP tool with-c model_provider=openai. Capture the real provider request body through a local logging reverse proxy and check the/modelsresponse shape before touching Desktop: a gateway that answers the OpenAI list-models shape ({"data":[...]}) fails catalog decoding (missing field \models`) and forces fallback model metadata withsupports_search_tool: false, pinning the wire shape tonamespaceentries; both thenamespaceandtool_searchshapes were ineffective despite HTTP 200 on the observed chain - an outcome that does not by itself distinguish gateway filtering from upstream or model-side ignoring. Treat the dropping hop (gateway filter versus model-side rejection of these shapes) as unverified unless a controlled raw-request probe or a gateway inbound/outbound comparison proves it, and never use the model's verbal tool report as evidence. The documented MSIX repatch and Computer Use local repair do not target this failure class — see the custom provider chain case inreferences/restriction-debug-cases.md`. - Use the CUA surface lock case when
cua.getState()succeeds but native-app methods are missing (cua.getApp is not a function,cua.listApps is not a function, nocomputer/getApp/listAppsinObject.keys(cua)) whilescripts\install-computer-use-local.ps1 -StrictVerifyOnlypasses and thecodex-computer-use-*pipe exists. The materialized plugin cache.mcp.jsonpinsCUA_REPL_ENABLED_SURFACEStobrowser, but editing that file is not a repair: the Desktop plugin reconcile rewrites it on every Desktop start, which is why the symptom keeps returning. Runscripts\repair-cua-surface-lock.ps1 -VerifyOnly, then-Install, start a fresh conversation, and require the three verification signals — see the surface lock case inreferences/restriction-debug-cases.md. - Use the Windows app-binding case when the surface lock is already repaired,
Object.keys(cua)containscomputer/getApp/listApps, and a Computer Use test still fails becausecua.getApporcua.listAppsrejects withNative app bindings are unavailable for windows.In@oai/cua, both methods throw unless the service reportssky.target === "mac", so they are unusable on Windows by design. The working native API is the window-basedcua.computer.*surface (list_windows,activate_window,get_window_state,click,type_text, ...), and the shippedresources\computer-description.mdnever mentions it — it documents only the macOS entry point, which is why the model keeps calling the broken one. Run the samerepair-cua-surface-lock.ps1 -Install, which patches that description too, and verify withscripts\probe-cua-surface.py— see the Windows app-binding case inreferences/restriction-debug-cases.md. Do not report native control as unavailable on Windows; report it as available through the window API. - Use the config-rewriter case when Computer Use breaks immediately after an external tool (for example a provider switcher such as CC Switch) rewrote
config.tomlandcodex mcp listno longer listscua_replat all: the rewriter rebuilt the file and dropped[plugins."unified-computer-use@openai-bundled"], sibling plugin tables, and thecomputer_use/js_repl/non_prefixed_mcp_tool_namesfeature keys. Restore those tables from the config backup instead of repatching, and diff the three points after every provider switch — see the config rewriter case inreferences/restriction-debug-cases.md. - Use the Phone Remote Control workflow when the user needs mobile pairing/control, the Connections page hides the phone setup card, the QR dialog spins, remote-control setup jumps to ChatGPT auth, the Allow dialog fails, the phone says the Codex environment version expired, or phone-created turns reach Desktop but send model requests to the wrong API endpoint.
- Use the Missing inputSchema decision workflow when Codex Desktop cannot create a new conversation or local task and the newest Desktop log reports
method=thread/startwith the phrasemissing field inputSchema. Do not assume this is always MCP. First compare CLI/app-server smoke tests against Desktop logs and inspect whether Desktop is sending non-null app dynamic tools. If the failure follows a suspect MCP server, isolate MCP. If CLI thread start succeeds while Desktop UI fails and extracted ASAR haswebview\assets\app-server-dynamic-tools-*.jsreturning a namespace-wrappeddynamicToolsobject, use the Dynamic Tools Schema workflow. Do not run Phone Remote Control or Computer Use repair for this symptom unless separate evidence points there. - Use the Provider History Sync workflow when old conversations disappear from the official Desktop sidebar after the user changes
model_provider, API account, or provider config, but localsessions,archived_sessions, orstate_5.sqlitedata still exists. Also use it when the conversations reappear but opening/continuing one fails with当前工作目录缺失,current working directory missing, orinvalid codex requestcaused by a missing historicalcwd. This workflow is data-layer repair; it does not require third-party recovery tools, does not patch ASAR, and must not modifyconfig.toml. - Use the targeted bundled marketplace repair when the newest Desktop logs show fewer descriptors than the current package marketplace, or show
not_in_bundled_marketplace_plugin_namesremoving a plugin the user had already installed. Descriptor presence means a plugin is available; it does not authorize installing or enabling optional plugins such assites,latex,deep-research, orvisualize. This should not trigger a broad repatch or Phone Remote Control workflow. First rule out an account-gated descriptor gap: when the only missing descriptors are ones whoseisAvailablepredicate reads an account feature flag, such asunified-computer-use(browserUseTinysky) anduser-writing(userWriting), the smaller set is expected on a third-party provider or API-key account and must not be repaired. Read the account-gated bundled descriptor case inreferences/restriction-debug-cases.mdfirst. - If the user asks for Phone Remote Control and ordinary Desktop features in the same repair, patch Phone Remote Control first, then verify Fast Mode/browser/Chrome/Computer Use. If the remote-control MSIX install disturbs Computer Use or Chrome native-host state, immediately run the Computer Use Only workflow and re-run
-StrictVerifyOnly. - Do not infer that a new
resources\codex.exePE file meansapp.asaris gone or that Computer Use needs binary patching. Inspect the current package resources first. Ifapp.asarstill exists and the symptom is a plugin/runtime import or cache failure, runscripts\install-computer-use-local.ps1before considering MSIX or binary changes. - After a Computer Use-only repair, always run
scripts\install-computer-use-local.ps1 -StrictVerifyOnly. Legacy layouts pass withclient import okplushelper transport ok; descriptor-only layouts pass withruntime import okafter importing the officialskyexport and callinglist_windows. For a recognized cross-call request-context profile, strict verification must also report the exact patched helper-transport hash. These checks still do not replace a real screenshot in a later JavaScript call. - Do not put Phone Remote Control into the default full repatch path unless the user asked for it. It is an opt-in workflow because it can require isolated remote-control OAuth, ASAR changes, a native app-server replacement binary, SQLite enrollment cleanup, and post-pairing API endpoint diagnosis.
- If evidence is mixed, use the lowest-disruption path first: run read-only triage, then
scripts\install-computer-use-local.ps1 -VerifyOnlyfor local plugin evidence, restart Codex Desktop only if needed, and escalate to MSIX only when logs or extracted ASAR checks still show a closed gate.
The normal scripts\repatch-codex-windows.ps1 preflight recognizes one package-gated Computer Use case: installed app.asar does not preserve external NODE_REPL_TRUSTED_CODE_PATHS across Desktop config regeneration. This means the installed app must be repatched before external D: marketplace/cache roots can survive Desktop config regeneration. For this exact message only, the wrapper records the fallback and continues into its MSIX dry run or install; unrelated Computer Use failures still stop the workflow. After installation, the wrapper runs the normal Computer Use refresh and strict verification. During a dry run, post-dry-run local verification is skipped only for this recognized case because the currently installed package is intentionally still unpatched.
External Executor For Desktop-Restarting Repairs
If a repair can stop, uninstall, reinstall, repackage, or relaunch Codex Desktop, do not run it from the Codex Desktop session being repaired. Use an external Windows PowerShell session, the VS Code Codex extension, or another agent environment that will survive the Desktop restart.
The target state is the Desktop Codex home: normally $env:USERPROFILE\.codex. Do not use an isolated CLI entrypoint for Desktop repair decisions; if that wrapper sets CODEX_HOME to $env:USERPROFILE\.codex-cli or another isolated directory, it is not the Desktop plugin, marketplace, MCP, remote-control, or login state.
Before starting from VS Code Codex or external PowerShell, confirm no User-level or Machine-level CODEX_HOME is set. Do not set global CODEX_HOME, do not copy .codex into .codex-cli, and do not expose or commit auth.json, API keys, OAuth tokens, MCP credentials, browser profiles, or local credential stores. Start with a Desktop-state backup, run read-only package/config/log checks, then run the relevant -DryRun. Only use -Install, full repatch-codex-windows.ps1, or targeted *-windows-msix.ps1 -Install -Launch -InstallPrerequisites after the dry run finds and validates the intended targets.
An external executor has no Desktop node_repl JavaScript kernel, so the normal real-acceptance path for Computer Use and Chrome is unavailable. Do not downgrade acceptance to -StrictVerifyOnly output alone, and do not claim an end-to-end result the environment cannot produce. Drive the official CUA runtime from separate short-lived node.exe processes for read-only Computer Use calls, keep a capture and any element_index input that consumes it inside one long-lived process, and report the Chrome/browser layer as gate-and-configuration verified with the tab-read smoke test explicitly not run. The external-executor Computer Use acceptance case in references/restriction-debug-cases.md gives the required load order, object shapes, approval stub, CODEX_CLI_PATH prerequisite, and the benign input call that turns a read-only probe into acceptance.
Default Workflow
- If the task may modify
config.toml, skills, marketplaces, or MCP server settings, create a state snapshot first:
powershellpowershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\manage-codex-backups.ps1" -Action Backup
- Inspect current-user and all-user package status so a newer SYSTEM-Staged Store build is visible:
powershellGet-AppxPackage -Name OpenAI.Codex | Select-Object Name,PackageFullName,Version,SignatureKind,InstallLocation Get-AppxPackage -Name OpenAI.Codex -AllUsers | Select-Object Name,PackageFullName,Version,SignatureKind,InstallLocation,PackageUserInformation
The MSIX patcher automatically chooses the highest-version candidate whose app layout is complete, even when the current-user query returns an older installed build. Confirm its selected Codex app and source package log lines before installation. An explicit -AppPath remains authoritative.
- Run read-only feature triage before any package reinstall. Capture the decision evidence, especially for Chrome/Computer Use:
powershellcodex plugin list powershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\install-computer-use-local.ps1" -StrictVerifyOnly
If -StrictVerifyOnly fails on a missing marketplace manifest, missing plugin files, stale latest link, stale Chrome native messaging manifest path, allowed_origins, registry value, or extension-host-config.json runtime path, missing helper path, or @oai/sky import/runtime issue, run the Computer Use Only repair first:
powershellpowershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\install-computer-use-local.ps1" -VerifyOnly
This local repair may update config, plugin cache, Chrome native host paths and origins, user environment, and helper runtime files, but it does not uninstall or reinstall the Codex MSIX package. It invokes the current Chrome plugin's official scripts\installManifest.mjs with a user-local Codex CLI whose hash matches the installed package and with matching current cua_node node.exe / node_repl.exe paths. That official installer writes the outer native-host manifest, registry value, and required extension-host-config.json. The repair also synchronizes the current schema-2 app-server entry into both %LOCALAPPDATA%\OpenAI\Codex\chrome-native-hosts-v2.json and $env:USERPROFILE\.codex\chrome-native-hosts-v2.json using the current plugin's NUL-separated SHA-256 identity contract. Strict verification requires the exact current origin set from scripts\extension-ids.json, a stable current-version Chrome cache, existing current runtime paths in the host config, and a valid current entry in both v2 state files. On 26.814-style builds, that entry must include both browserClientPath and browserServicePath in the same stable cache; omitting the service path passes byte checks but fails the trusted RPC dependency gate. When the stable cache resolves through a junction outside CODEX_HOME, the repair also writes its physical marketplace/cache roots to the user-level NODE_REPL_TRUSTED_CODE_PATHS. A full MSIX patch is still required so Desktop appends that parent environment value when regenerating the Node REPL config; strict verification requires CODEX_NODE_REPL_TRUSTED_PATHS_V1 in the installed ASAR for this external-root layout.
The repair must preserve the installed package's plugins\chrome\scripts\browser-client.mjs bytes exactly. Earlier Node REPL builds expose privileged browser capabilities only when the imported browser-client SHA-256 matches the trust list embedded in the installed app.asar; rewriting a node:process import or process shim changes the hash and causes Browser use requires privileged node_repl capabilities before Chrome discovery. Codex Desktop 26.814 instead delivers browserClientPath through the official native-host configuration and no longer embeds the client hash as ASCII in app.asar. Normal repair restores the packaged bytes to both the stable marketplace and versioned cache. Strict verification requires both copies to match the packaged SHA-256 and then requires either the legacy ASAR hash or the complete native-host path contract; an unknown or partial shape remains unsupported.
- Before choosing a full MSIX repack, check whether this is the bundled marketplace fast path. Compare the package's
.agents\plugins\marketplace.jsonnames with the Desktop reconcile log. If descriptors are missing, ornot_in_bundled_marketplace_plugin_namesremoves a plugin the user had already installed, run only the targeted bundled marketplace patch on a large local drive:
powershellpowershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\patch_codex_fast_mode_windows_msix.ps1" -OnlyBundledMarketplaceCopy -DryRun -OutputRoot "<large-local-build-root>" powershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\patch_codex_fast_mode_windows_msix.ps1" -OnlyBundledMarketplaceCopy -Install -Launch -InstallPrerequisites -CleanupAfter -CleanupWindowsSdkAfterInstall -OutputRoot "<large-local-build-root>"
After relaunch, run scripts\install-computer-use-local.ps1 -VerifyOnly and scripts\install-computer-use-local.ps1 -StrictVerifyOnly -VerifyAllBundledPluginsAvailable. The local repair preserves each unrelated optional plugin's installed/enabled state and refreshes an optional cache only when that plugin was already installed. The availability check requires every current descriptor name and version to match the installed package and to appear with that version in the CLI's installed-or-available JSON without calling plugin add.
- Escalate to MSIX only when the evidence points to package-gated Desktop code: Fast Mode request/UI gates, locale gate, Goal/plugin UI gate, browser_use availability with
reason=statsig-disabled, Computer Use/Any App disabled by settings/UI availability gates after local repair, ASAR integrity failure, a stable Browser cache junction whose physical target is rejected by the trusted RPC dependency gate after local repair, or Phone Remote Control package patches. For the junction case, require the full patcher'sNode REPL trusted-paths patch result, restart Desktop, and confirm the regenerated config retains the resolved external roots. Otherwise do not run the full repatch just because a plugin is unavailable.
Run a dry run first after every Codex upgrade when MSIX escalation is justified:
powershellpowershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\repatch-codex-windows.ps1" -DryRun
- If the dry run finds all patch targets, run the full repatch:
powershellpowershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\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 a stable local root, overlays a local computer-use@openai-bundled compatibility plugin, writes that marketplace into config, and registers browser@openai-bundled through the user-accessible Codex CLI. Pass -VerifyAllBundledPluginsAvailable to add an availability assertion for every complete descriptor currently offered by the installed package, including version-dependent plugins such as deep-research and visualize. The assertion itself uses plugin list --available --json; it does not download from the network, call plugin add, or change unrelated optional plugin state. The surrounding wrapper still performs its requested repair or DryRun behavior. When .codex\.tmp is a junction, the stable root is created beside the junction target so an existing non-system-drive layout stays off C:; otherwise it uses .codex\marketplaces\openai-bundled-local. It also 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 also forces the configured custom model IDs through the Desktop model visibility filter. By default these are gpt-6-astra, gpt-5.6-sol, gpt-5.6-terra, and gpt-5.6-luna. This patch only unhides catalog entries that already exist for the current build; it never creates one. A slug the active catalog does not contain stays absent from the picker no matter how often the bundle is repatched, so confirm the entry exists before reading a missing model as a patch failure. The CLI builtin catalog is embedded in codex.exe and ships not-yet-rolled-out models with "visibility": "hide", which is exactly the shape this patch is for; a user model_catalog_json replaces that builtin catalog instead of extending it, so it must carry the new entry itself. On builds containing the compact Power slider, it also opens the Electron-specific harborEnabled gate so the matching GPT-5.6 model and reasoning combinations use that slider instead of the legacy model/effort/speed-only menu.
On builds where the Ultra slider setting reads only ChatGPT account user settings, it adds a local fallback for third-party providers. The toggle then reads and writes show-ultra-in-model-picker-slider locally, survives restart, and feeds the same Ultra inclusion value used by the actual model picker. Normal ChatGPT-authenticated users retain the official account setting path.
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 does not install the bundled custom model_instructions_file prompt by default. Only install it when the user explicitly requests that optional configuration.
Any bundled script write to an existing config.toml first creates one timestamped backup for that script run under .codex\backups\config\.
Phone Remote Control
Before repairing phone remote control, read references/remote-control-debug-cases.md. Keep these boundaries explicit:
- Remote-control pairing/control transport can legitimately call
https://chatgpt.com/backend-api/wham/remote/control/.... Do not rewrite that transport to a third-party model API endpoint. - After phone pairing works, verify the actual model sampling request URL. If it goes to the wrong model API endpoint, treat that as a post-pairing configuration diagnosis, not as part of the remote-control pairing implementation.
- Remote-control OAuth is isolated: use
.codex\remote-control-oauth.jsonand.codex\remote.json; never use.codex\auth.jsonfor the remote-control bearer injection path. - An alternate build root is mandatory when the user says not to consume the system drive. Pass
-WorkRoot/-OutputRooton the requested large local drive and keep Cargo, Rustup, temp, target, MSIX, and source checkout under that root. Do not hard-code a drive letter into the workflow.
If Settings -> Connections -> Control this computer is visible but the device list says to sign in to ChatGPT again, verify the normal remote-control bearer before repatching MSIX again:
powershellpython "$SkillRoot\scripts\refresh-remote-control-auth.py" --verify-only
If that reports remote_json_disabled, access_token_expired, endpoint_http_error, HTTP 401/403, or a token-refresh diagnosis such as refresh_token_reused, regenerate only .codex\remote.json with the same script. It uses the official Codex OAuth client, requests openid profile email offline_access api.connectors.read api.connectors.invoke, backs up the old remote.json under .codex\backups\remote-control-auth, defaults to proxy http://127.0.0.1:10808, and must not write .codex\auth.json or config.toml.
If remote.json verifies successfully but clicking Add or opening Control this computer falls back to a new conversation/main chat page, inspect $env:USERPROFILE\.codex\remote-control-flow.log and direct endpoint results for an expired remote-control-oauth.json enroll token shadowing the normal bearer. The ASAR patcher must skip expired JWTs before returning an isolated bearer and should verify remote_control_auth_token_expired_skipped in the patched ASAR. Do not delete .codex\remote-control-oauth.json blindly; keep it for fresh step-up/enroll flows and let valid .codex\remote.json satisfy read/MFA endpoints.
If the Allow dialog fails and the newest native app-server logs show remote control requires ChatGPT authentication; API key auth is not supported, ASAR patches and .codex\remote.json refresh are not enough. Build a patched native app\resources\codex.exe from the Codex Rust source with the reference native patch, using a large non-system work root when requested:
powershellpowershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\build-remote-control-native-replacement.ps1" -WorkRoot "<large-local-build-root>\native-remote"
If the phone reports the Codex environment is expired after a native replacement, inspect the original installed native version before building. Use only an exact mapped Desktop/native/source-tag combination. For example, Desktop 26.715.2305.0 ships codex-cli 0.145.0-alpha.18 and Desktop 26.707.3748.0 ships codex-cli 0.144.0-alpha.4:
powershellpowershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\build-remote-control-native-replacement.ps1" -WorkRoot "D:\CodexData\rc145" -CodexSourceRef "rust-v0.145.0-alpha.18" -AppServerVersion "0.145.0-alpha.18" powershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\build-remote-control-native-replacement.ps1" -WorkRoot "D:\CodexWork\phone-remote-26.707\native-remote-0.144.0-alpha.4" -CodexSourceRef "rust-v0.144.0-alpha.4" -AppServerVersion "0.144.0-alpha.4"
The build helper keeps the clone, Cargo cache, Rustup cache, temp directory, target directory, and any bootstrapped Windows SDK packages under -WorkRoot. When -CodexSourceRef and -AppServerVersion are omitted together, it copies the installed WindowsApps app\resources\codex.exe into WorkRoot\tmp, runs --version only on that copy, and selects a bundled version mapping; it never executes the WindowsApps binary in place. Desktop 26.715.2305.0 maps to rust-v0.145.0-alpha.18, references\remote-control-native-replacement-0.145.0-alpha.18.patch, and workspace version 0.145.0-alpha.18. Desktop 26.707.3748.0 maps to rust-v0.144.0-alpha.4, references\remote-control-native-replacement.patch, and workspace version 0.144.0-alpha.4. For historical rust-v0.142.4, matching parameters select references\remote-control-native-replacement-0.142.4.patch; that patch has passed clean patch-apply validation, but has not yet completed the same end-to-end native compilation validation as the newer mappings. Other source versions require matching explicit version parameters plus a validated -PatchPathOverride. Do not use GNU toolchain output for Windows MSIX replacement; use the MSVC target.
If MSVC is present but kernel32.lib is missing, the helper first searches for one coherent existing Windows SDK root/version containing matching x64 kernel32.lib, ucrt.lib, and headers; it does not mix independently discovered installed SDK versions. Only when no usable SDK exists, it downloads Microsoft.Windows.SDK.CPP and Microsoft.Windows.SDK.CPP.x64 version 10.0.26100.4188 into <WorkRoot>\cache\windows-sdk-cpp. Downloads use .partial files, validate the archive and expected payloads, and replace the cache only after validation; corrupt cached packages are deleted and downloaded again. On Windows PowerShell 5.1, extract NuGet packages with checked tar.exe; Expand-Archive can fail while cleaning a deep _rels\.rels tree. The two packages use a split layout, so accept the matching NuGet roots c\um\x64\kernel32.lib, c\ucrt\x64\ucrt.lib, c\Include\<version>\um\Windows.h, and optionally c\bin\<version>\x64\rc.exe instead of requiring one traditional installed-Kits tree. Downloads honor existing HTTPS_PROXY / HTTP_PROXY; when neither is set, the helper uses http://127.0.0.1:10808 only if that port is listening, otherwise it downloads directly.
Keep -WorkRoot short as well as off the system drive. A deeply nested D-drive root can still fail while Cargo checks out Git dependencies with path too long; the validated 0.145.0-alpha.18 build succeeded under D:\CodexData\rc145. When retrying after an interrupted or timed-out external run, first confirm the child PowerShell process has exited and use a unique WorkRoot / OutputRoot; a timed-out parent can leave a child cleaning the previous root.
Run a dry run first. Do not pass -KeepWorkDir unless you need to inspect failed patch artifacts; successful dry-runs should clean generated package and ASAR extraction output:
powershellpowershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\patch-remote-control-windows-msix.ps1" -DryRun
If the machine needs a larger temporary build location, pass it explicitly:
powershellpowershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\patch-remote-control-windows-msix.ps1" -DryRun -OutputRoot "<large-local-build-root>"
If a patched native app\resources\codex.exe was built from the Codex Rust source, pass it explicitly:
powershellpowershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\patch-remote-control-windows-msix.ps1" -DryRun -ReplacementResourceCodexExe "<path-to-built-codex.exe>"
Only after dry-run markers pass, install and relaunch:
powershellpowershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\patch-remote-control-windows-msix.ps1" -Install -Launch -InstallPrerequisites -ReplacementResourceCodexExe "<path-to-built-codex.exe>"
When makeappx.exe / signtool.exe are missing, the install path downloads Windows SDK BuildTools from NuGet under -OutputRoot\.remote-control-temp, not %TEMP%. Do not hard-code a local proxy for this download. Use the default direct/env-proxy path first; only pass -BuildToolsProxy "http://127.0.0.1:10808" or set CODEX_WINDOWS_SDK_BUILDTOOLS_PROXY when that proxy is known to be listening. Proxy URIs and credentials are never printed. curl download failed with exit code 7 usually means the selected proxy endpoint refused the connection.
Run disruptive install commands from an external PowerShell process and judge the child's actual exit code. Under Windows PowerShell 5.1, do not pipe *>&1 through Tee-Object when $ErrorActionPreference = 'Stop'; npm warnings written to stderr can become terminating RemoteException records. Do not redirect child stdout and stderr to the same file. Use Start-Process powershell.exe -Wait -PassThru -RedirectStandardOutput <stdout-file> -RedirectStandardError <stderr-file>, check ExitCode, then merge or summarize the two logs after the process exits.
If an install attempt is interrupted after uninstall/signing and Get-AppxPackage -Name OpenAI.Codex returns no package, do not rebuild first. Install the existing patched MSIX from the selected -OutputRoot if it exists:
powershellAdd-AppxPackage -Path "<large-local-build-root>\OpenAI.Codex_<version>_remote-control-patched.msix" -ForceApplicationShutdown -Verbose
Cleanup policy: successful remote-control script runs delete generated MSIX staging directories, ASAR extracts, script-local npx cache, installed patched .msix artifacts, and temporary Windows SDK BuildTools. If the user only asked for the repair and did not ask to keep reusable build outputs, also remove the native source checkout, Cargo/Rustup caches, target directory, temp directory, and generated patch/MSIX files created only for this repair. Keep the installed patched package, .codex\remote.json, .codex\remote-control-oauth.json, auth/config/sqlite state, logs, and explicit backups.
After installing Phone Remote Control, verify that ordinary features survived the remote-control repack. At minimum check live ASAR markers for remote control and browser local-patched availability, live native markers when a replacement binary was used, run scripts\install-computer-use-local.ps1 -StrictVerifyOnly, run codex plugin list, run the Windows sandbox smoke test, and verify the Chrome native messaging manifest points at a stable versioned cache path or at a chrome\latest junction that resolves to a versioned cache directory, never at .tmp or another mutable marketplace mirror. If the strict check reports a stale Chrome native-host manifest or missing bundled cache, run scripts\install-computer-use-local.ps1 -VerifyOnly, then rerun -StrictVerifyOnly.
When reading shared log databases, distinguish the running WindowsApps app-server process from old extension app-server processes. A stale Antigravity/VS Code extension codex.exe can continue logging API key auth is not supported after the WindowsApps package is fixed; filter by process path or pid before declaring the repair failed.
If phone-created turns reach Desktop but fail against the wrong model API endpoint, inspect the concrete request URL, config.toml, and the affected thread/session metadata before changing anything. Treat this as a post-pairing configuration diagnosis, not as part of remote-control pairing. Preserve conversation history and do not change model_provider ids just to change a URL.
Dynamic Tools Schema
Use this targeted MSIX/ASAR path only for the Desktop dynamicTools variant of missing field inputSchema. Required evidence:
- Newest Desktop log shows
method=thread/startwithmissing field inputSchema. - CLI/app-server smoke tests can start a thread when they do not send Desktop app dynamic tools, for example
codex debug app-server send-message-v2 "只输出 OK"or an equivalentthread/startpath withdynamicTools:null. - The Desktop log or extracted bundle shows the failure happens after Desktop app dynamic tools are assembled, not after MCP server startup.
- Extracted
webview\assets\app-server-dynamic-tools-*.jsreturns the old namespace wrapper shape:[{type:\namespace`, name, description, tools:[...]}]`.
When those conditions hold, patch the Desktop asset to return flat DynamicToolSpec[] entries with namespace, name, description, inputSchema, and optional deferLoading. Do not disable MCP servers for this variant unless a separate MCP-specific failure remains.
Run a dry run first. Use -OutputRoot on a large local drive when the system drive is low:
powershellpowershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\patch-dynamic-tools-windows-msix.ps1" -DryRun -OutputRoot "<large-local-build-root>"
If the dry run passes, install and relaunch:
powershellpowershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\patch-dynamic-tools-windows-msix.ps1" -Install -Launch -InstallPrerequisites -OutputRoot "<large-local-build-root>"
After installation, verify with the actual Desktop UI or newest Desktop logs. A CLI-only smoke test is not sufficient because it can bypass Desktop dynamicTools. Confirm the latest thread/start entries do not report missing field inputSchema, then run scripts\install-computer-use-local.ps1 -StrictVerifyOnly and codex plugin list if Computer Use, Chrome, or browser use are in scope.
Cleanup policy: successful dynamic-tools script runs delete generated MSIX staging directories, ASAR extracts, script-local npx cache, temporary SDK cache under -OutputRoot, and installed patched .msix artifacts. Use -KeepWorkDir only for failed or actively debugged runs.
Provider History Sync
Use this targeted workflow when Codex Desktop local conversations disappear after switching model_provider, API account, or provider config, while the actual local history files still exist. The root cause is usually that Codex filters the official sidebar by the active provider bucket; older thread rows and rollout metadata remain under a previous provider.
Also use this workflow for the second-stage failure where recovered conversations are visible in the official sidebar but cannot be continued because Desktop reports the working directory is missing. In that case the provider bucket may already be correct; the durable source of truth can still point at an old session_meta.payload.cwd directory that no longer exists.
This workflow uses the verified local-history mechanism directly; it does not install or require external recovery tools. It reads the current provider from config.toml, then aligns provider metadata in local history stores:
sessionsandarchived_sessionsrollout JSONL first line:session_meta.payload.model_provider- App SQLite store:
$env:USERPROFILE\.codex\sqlite\state_5.sqlite - Legacy CLI SQLite store:
$env:USERPROFILE\.codex\state_5.sqlite - Missing thread rows from the legacy CLI store into the newer App store when the App store is missing rows that still exist in the legacy store.
- Missing historical
cwddirectories referenced by rollout first lines, when explicitly requested with-RepairMissingCwdDirs.
Important source-of-truth details:
- Codex 26.609+ can rebuild
state_5.sqlitefrom rollout JSONL on startup. Treat rollout first-linesession_meta.payloadas durable metadata, not the App SQLite row alone. - Do not repair
当前工作目录缺失by changing only one SQLite store. That can make the UI look fixed until restart, then backfill or rollout reads can reintroduce the old value. - Prefer recreating the original missing
cwddirectory as an empty directory before rewriting historical metadata. This keeps the rollout history intact and was verified to fix visible-but-uncontinuable restored conversations.
Before changing anything, run a dry run:
powershellpowershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\sync-codex-provider-history.ps1" -DryRun
Read the dry-run output before selecting the write path:
- If it shows mismatched provider buckets, close or stop Codex Desktop and run the sync.
- If the sidebar already shows recovered conversations but continuing a thread fails with missing working directory, look at
missing rollout cwd dirs before. If missing cwd entries are listed, use-RepairMissingCwdDirs. - If the missing cwd paths are outside the current user profile, do not create them by default. Review the paths first; pass
-AllowCwdOutsideUserProfileonly when they are expected local paths.
Provider sync write path:
powershellGet-Process Codex,ChatGPT -ErrorAction SilentlyContinue | Where-Object { $_.Path -like 'C:\Program Files\WindowsApps\OpenAI.Codex_*\app\Codex.exe' -or $_.Path -like 'C:\Program Files\WindowsApps\OpenAI.Codex_*\app\ChatGPT.exe' } | Stop-Process -Force powershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\sync-codex-provider-history.ps1"
Missing cwd repair path:
powershellGet-Process Codex,ChatGPT -ErrorAction SilentlyContinue | Where-Object { $_.Path -like 'C:\Program Files\WindowsApps\OpenAI.Codex_*\app\Codex.exe' -or $_.Path -like 'C:\Program Files\WindowsApps\OpenAI.Codex_*\app\ChatGPT.exe' } | Stop-Process -Force powershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\sync-codex-provider-history.ps1" -RepairMissingCwdDirs
This creates only the missing directories referenced by rollout first lines. It does not rewrite those cwd values, and it still verifies that config.toml is unchanged. By default it skips cwd paths outside $env:USERPROFILE to avoid creating unexpected roots on other drives or network shares.
Guardrails:
- Do not modify
config.toml; the script checks the file hash before and after each run and fails if it changes. - Do not install or launch external recovery tools for this workflow. The script implements the required local metadata repair directly.
- Do not patch ASAR or inject a floating session list for this symptom. A separate floating panel can show sessions but is not the official sidebar recovery mechanism and can introduce UI/encoding bugs.
- Do not sync
.codex-global-state.jsonworkspace/project roots by default. Doing so can expose many historicalcwdvalues as empty project groups in the Desktop sidebar. - Do not default to rewriting rollout
cwdor forcing all missing cwd values to a fallback directory such asDocuments\Codex. First try restoring the original missing directory path. Rewrite historicalcwdonly as a separately backed-up last resort after directory restoration fails. - Backups are written under
$env:USERPROFILE\.codex\backups_state\history-sync-agent\<timestamp>before SQLite or rollout writes. - One unreadable or empty rollout first line may be skipped; treat that as a residual data issue, not a failure if SQLite and readable rollout counts align and the official sidebar shows the expected conversations.
Success criteria:
- The script logs the target provider from the current config.
- Both App and legacy SQLite stores, when present, report active and archived thread rows under that target provider.
- Rollout first-line provider counts under
sessionsandarchived_sessionsmatch the target provider for readable rollouts. config.toml sha256 unchangedis logged.- Codex Desktop's official sidebar shows the recovered historical conversations after restart.
- If the symptom was a visible restored conversation that could not continue,
missing rollout cwd dirs afterreports zero or only reviewed/skipped paths, and the affected conversation can send a new turn after Desktop restart. - The Projects/workspace area does not gain new empty project groups as a side effect.
Important Guardrails
- The full MSIX install path removes the existing
OpenAI.Codexpackage and installs a patched package. If run from inside Codex Desktop, the app can disappear or exit while the script continues. Use that path only when package-gated Desktop code must be patched; for local Chrome/Computer Use marketplace/cache/native-host/runtime failures, use the Computer Use Only workflow instead. - The full wrapper verifies that the final package still matches the package version it patched and has
SignatureKind = Developer. If Store replaces the package during repair, it retries once against the current package instead of reporting a false success; a second replacement fails with an actionable error. - Do not modify
C:\Program Files\WindowsAppsin place. Use the MSIX repack script. - Do not solve a Windows 10
SetIsBorderRequired/0x80004002screenshot failure by restoring an older Codex Desktop package or copying a helper from another runtime. Each bundled helper patch profile is limited to its documented exact input/output hash pair, backs up the original, and refuses unknown binaries. - Do not treat
list_windows,runtime import ok, a returned screenshot count, or a written PNG as proof that Computer Use capture is correct. Fornode_repl exec context not found, require later independent calls to pass after the request-context patch. Activate and revalidate the target immediately before capture, then inspect that the image content matches the target instead of an occluding foreground window. - Do not run the phone remote-control MSIX patch as a default repatch side effect. Use it only for phone remote-control tasks or when the user explicitly asks for that workflow.
- Do not treat every
missing field inputSchemaas an MCP problem. If CLI smoke tests pass while Desktop UI fails and the dynamic-tools ASAR asset still returns a namespace wrapper, use the Dynamic Tools Schema workflow instead of disabling unrelated MCP servers. - Do not trust a response like
FAST_CHECK_OKas proof of Fast Mode. Trust only the wrapper/script wire verification, which runs with an isolated temporaryCODEX_HOME, serves the CLI's/v1/modelsprobe, then captures a/v1/responsesHTTP body or WebSocket frame and checksservice_tier=priority. A models-only request is not proof. Ifcodex execexits or crashes before sending that request, the verifier falls back tocodex debug app-server send-message-v2and must also observethread/start serviceTier=priority; the wire capture remains mandatory. IfPATHresolves only to the protected WindowsApps CLI, the patcher must use the copied work-package CLI; an explicit verification request must fail instead of silently skipping when no runnable CLI exists. - Do not use keyword hits in
%USERPROFILE%\.codex\logs_2.sqliteas proof that the current installed package is patched. Task prompts and recorded tool calls can persist strings such aslocal-patched,already-patched, and patch marker names, creating false positives. Use the current patcher DryRun, direct evidence from the live package/ASAR, and real wire, UI, browser, or runtime smoke tests for patch-state decisions. This does not invalidate timestamped Desktop runtime logs when they are correlated with the current package, process, and test run; do not delete or modifylogs_2.sqlitefor this check. - If the app launches then immediately exits, run Electron logging and check for ASAR integrity failures:
powershell$pkg = Get-AppxPackage -Name OpenAI.Codex | Select-Object -First 1 $manifest = [xml](Get-Content -Raw -LiteralPath (Join-Path $pkg.InstallLocation 'AppxManifest.xml')) $desktopExecutable = [string](($manifest.Package.Applications.Application | Select-Object -First 1).Executable) $exe = Join-Path $pkg.InstallLocation $desktopExecutable $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 dry run or repack fails early with
robocopy failed with exit code 16, inspect the configured-OutputRootbefore changing patch targets. A common Windows failure is a broken junction such asDownloads\codex-msix-repackpointing at a deleted build directory. The patch script now recreates a missing reparse target when possible and otherwise fails early with an actionableOutputRoot is a broken reparse pointmessage. Pass a valid-OutputRooton a large local drive if the default cannot be repaired. - 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. - Do not enable the bundled custom
model_instructions_fileprompt unless the user explicitly asks for it. Treatassets\system-prompt.mdas an opaque asset; copy/configure it, but do not inspect or summarize its content unless the user separately asks to review the prompt. - 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.616.3767+,
plugins-page-*.jsmay insert an account-data hook betweenauthMethodand the auth-blocked variable, shaped like{authMethod:x}=authHook(),{data:y}=accountHook(),z=authBlocked(x),. Preserve the inserted hook and patch only the auth-blocked variable tofalse. - In Codex 26.616.3767+, the Goal slash command may no longer contain the old
3074100722/goalsconfig gate orthreadGoalObjectiveanchor. If the composer computes goal availability from non-cloud/local state, for exampleisGoalActionAvailablepassed through toenabled, treat that shape as already open instead of failing the MSIX dry run. - In Codex 26.616.3767+,
use-is-plugins-enabled-*.jsmay keep the samefeatureName:\browser_use`andfeatureName:`browser_use_external`semantics but use different minified helper names for the feature hook, statsig, andrunCodexInWslreads. Match the gate by shape aroundfeatureName,enabled,isLoading,410262010, andrunCodexInWsl; do not depend on a fixed helper identifier such asx,g, oru`. - In Codex 26.707.3748.0, the Desktop feature sender can insert
findShortcutsbetweenexternalBrowserUseAllowedandcomputerUse. Preserve that field while forcing the browser-use availability fields; do not requirecomputerUseto immediately followexternalBrowserUseAllowed. - In Codex 26.707.8479.0, the Electron feature receiver uses parameterized minified variables such as
o=r===\win32`&&n.CODEX_ELECTRON_ENABLE_WINDOWS_COMPUTER_USE...instead of the older fixedi` platform variable. Match the assignment, platform variable, environment object, and base feature object structurally; do not hard-code minified identifiers. - In Codex 26.707.8479.0,
plugins-page-*.jscan place workspace/account derivations between{authMethod:x}=...()and the auth-blocked assignment. Locate the blocked assignment by the laterroute.kind===\manage`` boundary and patch only that variable; preserve all intervening hooks and derived state. - 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. - In Codex 26.707.8479.0, the Computer Use install flow can migrate into
plugin-detail-page-utils-*.jsand replace the literalinstallPlugin:asyncproperty with aninstall-pluginRPC inside a minified async mutation. Accept either anchor, requireopenPluginInstall, and patch only the first value in the three-entry availability tuple. - In Codex 26.707.8479.0, the bundled marketplace copier can already route Windows through
copyDirectoryAllowDecryptedDestinationOnEncryptionFailurefromwindows-file-copy-*.js. Treat that native Windows fallback as already repaired instead of replacing it with the older byte-stream fallback; still apply the independent bundledsitesavailability patch when needed. - 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 a Computer Use task fails before app interaction with
Package subpath ... is not defined by "exports",Module not found: @oai/sky, missingsetupComputerUseRuntime, or an internal@oai/sky/computer_use_client_baseimport path error, treat it as local bundled plugin/runtime drift. Runscripts\install-computer-use-local.ps1 -VerifyOnly, then-StrictVerifyOnly. Do not patchapp.asarorresources\codex.exefor this class unless Desktop logs also prove a UI availability gate is still closed. - 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 thesourceconfigured under[marketplaces.openai-bundled]and its.agents\plugins\marketplace.jsonplusplugins\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. - Current Codex builds can use a lightweight versioned Computer Use cache with no usable
latestjunction and no plugin-localnode_modules;@oai/skylives under%LOCALAPPDATA%\OpenAI\Codex\runtimes\cua_node. Some builds are descriptor-only and omitscripts\computer-use-client.mjs. Treat that layout as healthy when the versioned descriptor matches the installed package and importing the independent runtime exposessky.list_windows, which returns an array. For the recognized@oai/sky0.6.2 Window2 profile, do not rely on a bundled runtime-documentation call; repair applies a guarded local skill overlay that useslist_windows,get_window_state({ window, ... }), andactivate_window({ window }). Builds that still ship the client script retain the legacy client-import and helper-transport checks. - If the failure reappears after fully quitting and reopening Codex Desktop, inspect
$env:USERPROFILE\.codex\chrome-native-hosts.json, both%LOCALAPPDATA%\OpenAI\Codex\chrome-native-hosts-v2.jsonand$env:USERPROFILE\.codex\chrome-native-hosts-v2.json, and the real targets of$env:USERPROFILE\.codex\plugins\cache\openai-bundled\chrome\latestandbrowser\latest. A side-panel error such asCodex app-server manifest entry is missing required path nodePathcan persist even when the outer manifest andextension-host-config.jsonare correct if both v2 state files still contain only old package/runtime paths or a wrongly hashed current entry. Newer Chrome plugin builds may canonicalize a versioned cache path tochrome\latest; that is acceptable only when the junction resolves to a versioned cache directory. Stale Chrome native-host entries, or achrome\latestjunction that points at$env:USERPROFILE\.codex\.tmp\bundled-marketplaces\openai-bundled\plugins\chrome, can also let Chrome native messaging lock the mutable marketplace mirror. Rerunscripts\install-computer-use-local.ps1to stop the lock holder, rebuild stable browser/chrome cache copies, repoint the outer manifest, and atomically synchronize both v2 state files. - Do not build stable
browser,chrome,sites, or basecomputer-usecaches from the mutable.tmp\bundled-marketplacesmirror. Desktop can reconcile that mirror while files are being copied. Use the installed package marketplace as the stable source, then overlay the local Computer Use runtime directly into its versioned cache. - If the failure reappears after restart with
plugin_marketplace_folder_write_failedduringcopy_plugins,bundled_plugins_marketplace_resolve_failed, ornot_in_bundled_marketplace_plugin_namesremoving a previously installed bundled plugin, patch only the bundled marketplace copy helper instead of running the full Fast/browser/Computer Use gate repatch. The targeted patch keeps the package descriptor set locally available but must not install or enable optional plugins the user did not select.
powershellpowershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\patch_codex_fast_mode_windows_msix.ps1" -OnlyBundledMarketplaceCopy -DryRun -OutputRoot "<large-local-build-root>" powershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\patch_codex_fast_mode_windows_msix.ps1" -OnlyBundledMarketplaceCopy -Install -Launch -InstallPrerequisites -OutputRoot "<large-local-build-root>"
If the local Computer Use runtime has passed install-computer-use-local.ps1 -StrictVerifyOnly but the Desktop still exposes no cua.computer.* surface, first inspect the current ASAR for both supported Darwin-only gates. Only when both are present, use the targeted main-ASAR mode below. It is intentionally separate from the broader Fast Mode/browser/plugin patch set:
powershellpowershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\patch_codex_fast_mode_windows_msix.ps1" -OnlyComputerUseSurface -DryRun -OutputRoot "<large-local-build-root>" powershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\patch_codex_fast_mode_windows_msix.ps1" -OnlyComputerUseSurface -Install -Launch -InstallPrerequisites -OutputRoot "<large-local-build-root>"
The mode requires exactly one content-matched .vite\build target and one occurrence of each original gate. Idempotency requires both complete patched gates, one CODEX_CUA_WINDOWS_SURFACE_V1 marker, and no original gates; a marker alone, mixed state, or duplicate candidate fails closed. The Windows branch still requires the existing computerUse and computerUseNodeRepl feature flags, while Darwin behavior remains unchanged. The patched asset must pass node --check. This mode skips the unrelated Chrome registry patch and rejects combinations with other targeted modes, marketplace registration, or Fast Mode verification. It does not edit plugin cache files, .mcp.json, or user configuration. Normal repacking still updates the copied package's ASAR integrity metadata and signature; installation/relaunch must run from an external executor.
Fixture success and an installed-package dry run do not establish real Desktop acceptance. After relaunch, validate the Windows window-based API with the current runtime's documented argument shapes: cua.computer.list_apps, cua.computer.list_windows, cua.computer.get_window, and get_window_state with the selected window, include_screenshot: true, and include_text: true. Record real approval UI, inspected screenshot content, and accessibility results separately; do not use the macOS-only cua.getApp result as the acceptance criterion.
Useful Wrapper Options
-DryRun: verify bundle targets only; no install. Unless-KeepBuildis supplied, the wrapper asks the patcher to clean its copied build root after a successful patch stage. Cleanup is best-effort, so inspect the reported path when zero residual data is required; a later wrapper verification can still fail after the patcher has already cleaned its own build root.-NoLaunch: install but do not start Codex Desktop.-SkipFastVerify: skip the local HTTP/WebSocketservice_tiercapture.-CustomModels <id1,id2,...>: custom model IDs forced through the Desktop model visibility filter; defaults togpt-6-astra,gpt-5.6-sol,gpt-5.6-terra, andgpt-5.6-luna. Passing this parameter replaces the default list rather than extending it, so repeat the models you still want alongside the new one.-KeepBuild: keep the wrapper's MSIX build root and retained artifacts for debugging after either DryRun or installation. The patcher's internal temporary ASAR work directory still follows its own cleanup policy.-OutputRoot <path>: optional large local build root; use it when the default output root is short on space, points at a broken junction, or should be kept off the system drive.-OnlyBundledMarketplaceCopy: patch only the Desktop bundled marketplace copy/helper availability path so Windows falls back to byte-stream copying whenfs.cp()cannot copy bundled plugin files from WindowsApps-protected package paths, and sositesremains locally available when bundled availability filtering would otherwise remove it. Use this for restart-time bundled marketplace sync failures that uninstallsites,browser, orchrome, not for general Fast Mode or UI gates.-OnlyComputerUseSurface: patch only the current main-ASAR Darwin-only Windows Computer Use surface gate. Use-DryRunfirst; it fails closed when the bundle anchors are missing or ambiguous.-OnlyModelExperience: inspect and selectively repair the Fast Mode request gate, Fast Mode UI gate, custom model visibility filter, compact Power slider gate, and Ultra setting persistence together. Use this for Fast Mode, hidden custom models, the dependent compact Power slider, and a disabled Ultra toggle under custom providers. The legacy-OnlyCustomModelsname is retained as an alias.-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.- The wrapper may continue past Computer Use preflight only for the exact package-gated trusted-paths error documented above; use
-SkipComputerUseonly when intentionally separating local runtime repair from package patching. -VerifyAllBundledPluginsAvailable: add an assertion that the stableopenai-bundleddescriptor names and versions exactly match the installed package and every entry appears with that version in structured CLI output as installed or available with an existing local source. The assertion never callsplugin add, but the main wrapper still performs its normal repair or DryRun behavior. For a fully read-only check, runinstall-computer-use-local.ps1 -StrictVerifyOnly -VerifyAllBundledPluginsAvailabledirectly.-InstallModelInstructionsFile: optional; copy the bundled prompt asset to$env:USERPROFILE\.codex\prompts\system-prompt.mdand set top-levelmodel_instructions_filein$env:USERPROFILE\.codex\config.toml.-ModelInstructionsSource <path>: optional source override for-InstallModelInstructionsFile; defaults toassets\system-prompt.md.-ModelInstructionsDestination <path>: optional destination override for-InstallModelInstructionsFile; defaults to$env:USERPROFILE\.codex\prompts\system-prompt.md.
Phone remote-control script options:
scripts\build-remote-control-native-replacement.ps1 -WorkRoot <path>: clone/patch/build the native replacement under the selected work root, keeping Cargo/Rustup/temp/target/source artifacts and the fallback Windows SDK C++ NuGet cache off the system drive. With both version parameters omitted, it auto-detects the installed native version from a temporary WorkRoot copy; if the detected version has no mapping, it requires explicit parameters instead of assuming 0.144.-CodexSourceRef <rust-vX> -AppServerVersion <X>: always supply these as an exact matching pair when overriding auto-detection.0.145.0-alpha.18is exact-tag build/install/phone end-to-end validated with Desktop26.715.2305.0;0.144.0-alpha.4has the same validation scope with Desktop26.707.3748.0; the dedicated0.142.4patch is patch-apply validated but not yet fully compiled in this workflow.-PatchPathOverride <path>: use only with an exact matching source-ref/app-server version pair, after validating that the supplied patch targets that exact source; patch apply is still checked before compilation.-SkipBuild: reuse only a previously generated binary accompanied bycodex.remote-control-build.json. The helper verifies the exact Git commit, source ref, app-server version, patch SHA-256, Rust toolchain, target, profile, binary--version, and native markers; marker-only or unstamped stale binaries are rejected. It does not initialize or download the Windows SDK in this mode.scripts\patch-remote-control-windows-msix.ps1 -DryRun: patch and validate extracted package without installing, then clean successful generated artifacts.-KeepWorkDir: keep MSIX staging, ASAR extract, and script-localnpxcache for debugging; avoid this on routine repairs because each kept run can consume multiple GB.-OutputRoot <path>: optional large local build root; use it when the default temp/output drive is short on space.-ReplacementResourceCodexExe <path>: copy in a patched native app-server binary and verify remote-control markers before packaging.-Install -Launch -InstallPrerequisites: sign, install, and relaunch the patched package after dry-run passes.
Dynamic tools schema script options:
scripts\patch-dynamic-tools-windows-msix.ps1 -DryRun: extract current package, patch/verifyapp-server-dynamic-tools-*.js, runnode --check, then clean successful generated artifacts without installing.-OutputRoot <path>: optional large local build root; use it when the system drive is short on space.-Install -Launch -InstallPrerequisites: sign, install, and relaunch the targeted dynamicTools patched package after dry-run passes.-KeepWorkDir: keep MSIX staging, ASAR extract, and script-localnpxcache for debugging only.
Optional Model Instructions File
This workflow has an optional custom model instructions installer. It is not part of the default repatch flow and should only run when the user asks for that extra configuration.
To install only the bundled prompt asset and configure Codex:
powershellpowershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\install-model-instructions-file.ps1"
The installer copies assets\system-prompt.md to $env:USERPROFILE\.codex\prompts\system-prompt.md, writes this top-level TOML entry, validates TOML syntax when Python is available, and logs a timestamped backup of any existing config.toml:
tomlmodel_instructions_file = 'C:\Users\<user>\.codex\prompts\system-prompt.md'
To combine it with the main wrapper, add -InstallModelInstructionsFile explicitly:
powershellpowershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\repatch-codex-windows.ps1" -InstallModelInstructionsFile
To verify the current machine without changing files:
powershellpowershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\install-model-instructions-file.ps1" -VerifyOnly
After configuring model_instructions_file, restart Codex CLI/Desktop or start a new session so the new model instructions file is loaded.
Computer Use Only
Use this path for local Computer Use plugin/runtime repair without repacking the MSIX. It rebuilds the local openai-bundled marketplace mirror, repairs stable computer-use / browser / chrome / sites cache links from one pinned installed-package source, overlays the installed CUA @oai/sky runtime into the local Computer Use plugin, patches localized/default-value Chrome registry parsing and the Computer Use client import shape when needed, preserves a live SKY_CUA_NATIVE_PIPE configuration while removing stale overrides, updates the Chrome native messaging host and both schema-2 app-server state files to current stable cache/runtime paths, and verifies the client import or independent runtime transport.
If the runtime responds, the codex-computer-use-* pipe exists, and -StrictVerifyOnly passes, but Object.keys(cua) still lists no computer, getApp, or listApps, the plugin surface list — not the runtime — is the problem. Check and repair it before anything heavier:
powershell$surfaceRepair = "$SkillRoot\scripts\repair-cua-surface-lock.ps1" powershell -NoProfile -ExecutionPolicy Bypass -File $surfaceRepair -VerifyOnly powershell -NoProfile -ExecutionPolicy Bypass -File $surfaceRepair -Install
-VerifyOnly fails while any required target is missing, unsupported, or unpatched; a marker alone is never accepted as a complete patch. The default report and -Json alone are read-only; -Json can also format an explicit install/rollback report. -VerifyOnly cannot be combined with a write mode. -Rollback restores adjacent <file>.bak-* backups only when they match the installed patch, refusing to overwrite later edits. The repair forces the computer surface inside scripts\launch.mjs and adds Windows guidance in resources\computer-description.md, across the cache and supported marketplace source copies. It never modifies the generated .mcp.json: a new server reads the forced surface from the launcher even when that environment value remains browser.
This workflow requires the script-based plugin layout. Descriptor-only builds without scripts\launch.mjs or the required description are unsupported; do not install extra plugins or broaden the patch just to make the check pass. scripts\test-cua-surface-lock-patterns.ps1 covers the repair against isolated fixtures, and python "$SkillRoot\scripts\test-probe-cua-surface.py" checks probe result validation without launching a server. The live probe-cua-surface.py requires the guidance, API members, and nonempty window/application results; it is not evidence of a real Desktop restart or screenshot capture.
Both patches survive a same-version Desktop restart and reset only when the plugin cache is re-materialized, which in practice means a Desktop upgrade that moves the plugin version directory. After any Desktop update, re-apply rather than re-analyze: run -VerifyOnly and run -Install only if it fails. The script globs every plugin version directory, so a version bump needs no edit. See the re-application case in references/restriction-debug-cases.md for what to do when the report says unsupported instead.
If enumeration works but a later Computer Use call returns node_repl exec context not found, inspect the source profile before repair:
powershell$contextPatcher = "$SkillRoot\scripts\patch-computer-use-node-repl-context.ps1" powershell -NoProfile -ExecutionPolicy Bypass -File $contextPatcher
The documented @oai/sky 0.6.2 profile is 6423BA83...702B7C -> 3600AC24...5BB60A. Prefer the normal install-computer-use-local.ps1 -VerifyOnly path to install it, then reset the current node_repl JavaScript kernel and rerun -StrictVerifyOnly. The patcher backs up the exact original under .codex\backups\computer-use-node-repl-context and supports -Rollback; it rejects unknown hashes. End-to-end validation must start the helper in one JavaScript call and capture a controlled, freshly activated window in later calls so the test exercises the stale-context boundary.
If Windows 10 reaches the native helper but screenshot capture fails specifically at SetIsBorderRequired with 0x80004002, inspect the helper profile before rerunning the general local repair:
powershell$helperPatcher = "$SkillRoot\scripts\patch-computer-use-helper-win10.ps1" powershell -NoProfile -ExecutionPolicy Bypass -File $helperPatcher
Only an original-patchable result for one of the documented complete helper SHA-256 profiles authorizes further evaluation. A real write additionally requires Windows 10 and the exact SetIsBorderRequired / 0x80004002 screenshot failure; a matching hash on Windows 11 is not authorization. The current profiles include @oai/sky 0.4.20 / Desktop 26.707.12708.0, 0.5.2 / 26.721.4979.0, 0.6.6 / 26.803.10989.0, 0.6.11 / 26.810.6296.0 and 26.810.7004.0, 0.6.16 / 26.814.5167.0 and 26.814.5517.0, and 0.6.17 / 26.818.2872.0 and 26.818.3698.0; the helper hash, not the Desktop version, is the binary compatibility boundary, and identical reported versions can still cover different binaries:
powershellpowershell -NoProfile -ExecutionPolicy Bypass -File $helperPatcher -Install
The patcher verifies the complete output hash, stores the original under .codex\backups\computer-use-helper, and supports -Rollback. After installation, continue with -VerifyOnly, -StrictVerifyOnly, and real Explorer/Task Manager Computer Use captures. Do not apply the profile to an unknown helper hash.
To refresh only the local Windows Computer Use files and environment gate:
powershellpowershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\install-computer-use-local.ps1"
To verify and automatically repair missing local Computer Use files:
powershellpowershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\install-computer-use-local.ps1" -VerifyOnly
To verify without changing files:
powershellpowershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\install-computer-use-local.ps1" -StrictVerifyOnly
If -StrictVerifyOnly fails because a cache path is missing or stale, run -VerifyOnly once, then rerun -StrictVerifyOnly. If -VerifyOnly succeeds but Desktop still reports native pipe unavailable, restart Codex Desktop and inspect the newest Desktop log for computer-use native pipe startup ready.
Backup Management
To back up local Codex config, MCP server entries, custom skills, marketplaces, and Chrome native-host state:
powershellpowershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\manage-codex-backups.ps1" -Action Backup
To list or restore snapshots:
powershellpowershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\manage-codex-backups.ps1" -Action List powershell -NoProfile -ExecutionPolicy Bypass -File "$SkillRoot\scripts\manage-codex-backups.ps1" -Action Restore -BackupPath "<backup path>"
Success Criteria
- If an existing
config.tomlwas modified, the log shows a timestamped backup under.codex\backups\config\. - The patch log's
selected Codex appandsource packagelines identify the intended highest-version package, including a newer SYSTEM-Staged Store package when present. Get-AppxPackage -Name OpenAI.CodexshowsSignatureKind = Developer.- The install log launches the patched Desktop package through its AppUserModelId, avoiding direct-executable access failures under
WindowsApps. - The manifest-declared Codex Desktop process stays alive from the installed package, currently
...\app\ChatGPT.exeon newer builds and...\app\Codex.exeon older builds. - Fast Mode verification reaches
/v1/responsesand logsrequest wire service_tier=priority;/v1/modelsprobes alone do not pass verification. When the app-server fallback is used, it also logsthread/start serviceTier=priority. - The patch log includes
fast-mode UI patch resultandlocale i18n patch result, each eitherpatchedoralready-patched. - The patch log includes
custom models patch result, and the patched model filter contains all configured custom model IDs. - 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. $env:USERPROFILE\.codex\config.tomlcontains[marketplaces.openai-curated-local].$env:USERPROFILE\.codex\config.tomlcontains[marketplaces.openai-bundled]pointing at the marketplace rootinstall-computer-use-local.ps1selected, and that marketplace contains the installed bundled plugins plus the local Computer Use overlay. On codex-cli 0.149+openai-bundledis a reserved marketplace name, so the accepted source is the Desktop-materialized.tmp\bundled-marketplaces\openai-bundledreserved root; the script's fallback to that root is correct behavior, not drift, and it logscodex-cli refused the local bundled marketplace source; repointing marketplaces.openai-bundled at the reserved root. A stable non-reserved root is only expected on older CLI versions that still accept it. Do not "fix" a reserved-root source back to a stable root: doing so makes the CLI drop the marketplace entirely, socodex plugin marketplace list --jsonno longer reportsopenai-bundledand Desktop logsmarketplace `openai-bundled` is reserved and cannot be added from this source. Keeping the reserved root does not violate a no-C-drive constraint when.codex\.tmpis a junction to another volume, because the reserved path resolves to that volume.- 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. codex plugin listshows the plugins required by the requested repair, includingbrowser@openai-bundled,chrome@openai-bundled, andcomputer-use@openai-bundledfor Browser/Chrome/Computer Use work, asinstalled, enabled. Optional plugins retain their prior state.- When
-VerifyAllBundledPluginsAvailableis requested, every complete descriptor in the stableopenai-bundledmarketplace has the same name and version as the installed package and appears with that version in the union of CLIinstalledandavailableJSON entries with an existing local source; no optional plugin becomes installed or enabled as a side effect. This switch compares the marketplace against the package's ownapp\resources\plugins\openai-bundledmanifest, so it fails withstable bundled marketplace descriptor set does not match the installed packagewhenever the account's feature flags make Desktop materialize fewer descriptors than the package ships. That is expected on a third-party provider or API-key account and is not a repair target; see the account-gated bundled descriptor case inreferences/restriction-debug-cases.mdbefore acting on such a mismatch. - Recent Desktop logs retain the current package's bundled descriptor names and do not show
not_in_bundled_marketplace_plugin_namesremoving a plugin that was already installed. $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 current-version cache rather than.tmp\bundled-marketplaces, and its origins exactly match the currentextension-ids.json. Theextension-host.exedirectory containsextension-host-config.jsonwith schema 1, the current package-matching user-localcodex.exe, and current same-runtimenode.exe/node_repl.exepaths. Both%LOCALAPPDATA%\OpenAI\Codex\chrome-native-hosts-v2.jsonand$env:USERPROFILE\.codex\chrome-native-hosts-v2.jsoncontain the same current schema-2 entry, official NUL-separated SHA-256 identity, installed-packageresourcesPath, and existing runtime/cache paths. The active marketplace and versioned-cachebrowser-client.mjshashes match the installed package. Legacy builds also require that hash in the installedapp.asar;26.814-style builds instead require the complete native-host path contract and same-root stablebrowserClientPath/browserServicePathvalues in both v2 state files.setupBrowserRuntime()succeeds,agent.browsers.get("chrome")returns the Chrome extension backend,chrome\latestandbrowser\latest(when present) resolve to stable version directories, and a real smoke test can read a controlled tab title such asExample Domain. - When Chrome/browser smoke validation is in scope and Chrome is not running, launch Chrome automatically without requesting additional user authorization. Run the controlled
https://example.com/smoke test and verify its URL,Example Domaintitle, exactly oneh1, andExample Domainheading text. 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.- The Computer Use plugin cache matches the installed package. Support both legacy
computer-use\latest\node_modules\@oai\skyand the current lightweight versioned or descriptor-only cache plus%LOCALAPPDATA%\OpenAI\Codex\runtimes\cua_node; validation reacheslist_windowseither through the helper transport or the official independent runtime export. scripts\install-computer-use-local.ps1 -StrictVerifyOnlylogsclient import okandhelper transport okfor legacy layouts, orruntime import okwithmethod=list_windowsfor descriptor-only layouts.- For the CUA surface lock,
scripts\repair-cua-surface-lock.ps1 -VerifyOnlyrequires completesurfaceanddescriptionpatches on every discovered script-based copy. On the recorded26.903.61454profile the patched hashes are4312E22A...419175andC72E08A0...FB9291; different complete files require their own evidence rather than those historical hash prefixes. Both fixture suites must pass. The live probe must report Windows guidance, all three API members,windows/<n>withn > 0, and a positive application count under the forcedbrowserenvironment. Record real Desktop restart, approval UI, and screenshot results separately; the external probe does not establish them. - On Windows, native Computer Use is exercised through the window-based
cua.computer.*API, and the injectedjstool description says so.cua.getApp/cua.listAppsthrowNative app bindings are unavailable for windows.on every Windows build; that is an expected upstream boundary and not a defect to report as "Computer Use unavailable". - For the supported
@oai/sky 0.6.2cross-call approval profile,scripts\patch-computer-use-node-repl-context.ps1reportspatchedwith SHA-2563600AC240CD6CB7029F1E489DF990CAE22D72177350B8084412DF1F3FA5BB60A, and its original backup matches6423BA834F18139D55CDAC2290C91CD9B24B568332B07CDDD2A7EDA043702B7C. - Real Computer Use acceptance starts the persistent helper during one
node_replcall, then uses at least two later calls to activate and capture a stable non-minimized target. Each call returns the expected window, accessibility state when requested, and a normal-sized screenshot whose visible content matches the target. A screenshot count or PNG file without content inspection is not acceptance. - When the repair runs from an external executor and no Desktop
node_replsession is available, real Computer Use acceptance may instead run the official runtime from separate short-livednode.exeprocesses. Each process must reachlist_windows, activate the target, and return a decoded screenshot whose content is inspected. Separate processes are for read calls only; anelement_indexclick must run in the same process as theget_window_statethat produced its index. Chrome/browser smoke validation cannot be substituted this way, becausebrowser-client.mjsrequires a trustedglobalThis.nodeRepl.rpc; report the browser layer as gate-and-configuration verified only. See the external-executor Computer Use acceptance case inreferences/restriction-debug-cases.mdfor the required call order, object shapes, andCODEX_CLI_PATHprerequisite. - For the supported Windows 10 screenshot-helper profiles,
scripts\patch-computer-use-helper-win10.ps1reportspatchedwith the selected profile's complete output SHA-256 and an original backup matching the profile's complete input SHA-256. Each documented profile has repeated-static resource checks and dynamic-capture image-change checks. Their pairs are0.4.20:F2B2F56F...->71A13CBC...,0.5.2:2C4CAC16...->D816B14A...,0.6.6:BE488E66...->34D6EB4F...,0.6.11:DE07F17A...->40530E62...,0.6.11:7A95D14E...->E84A4ECB...,0.6.16:E40BE614...->F35CA6D8..., and0.6.17:29D5E113...->DC83663F.... One@oai/skyversion can ship more than one helper binary, so select a profile by the complete hash and never by the version string. The0.6.6baseline includes a cold Explorer capture, two batches of ten unchanged static captures, twenty-capture post-warm-up resource counts, and three distinct Task Manager performance frames; the0.6.16baseline includes ten identical static frames, eight distinct Performance-tab frames, accessibility text, and a twenty-capture resource-stability sample. The0.6.17baseline reuses the same five guarded regions and adds eight unique static frames, twenty unique dynamic frames, and a threads/handles/working-set stability sample. A dynamic-capture check must activate the target and select a continuously animating view, because a backgrounded Task Manager Processes tab does not repaint and would yield identical frames for reasons unrelated to the patch. The target must also be a non-browser window owned by a real executable: Computer Use ends a turn against a browser window withcould not determine the current browser URL on Windows with enough confidence to enforce policy, andlist_windowsdoes not enumerate a window hosted bypowershell.exe. - The patched ASAR has the Computer Use availability and install gates forced local-available. On newer builds these targets can be merged into
webview\assets\app-initial-*.jsinstead of the olderuse-is-plugins-enabled-*anduse-plugin-install-flow-*chunks. - The patched ASAR has the Fast Mode UI gate unblocked, the locale chunk with
enable_i18nforced enabled, and browser_use feature chunks/main feature dispatch patched to report in-app and external browser availability locally. Codex Desktop26.721.3996.0can merge the Fast UI, model visibility, and Browser sidebar targets intowebview\assets\app-initial-*.js. - For phone remote-control repair, the patched ASAR contains
remote_control_desktop_fetch_override_used,remote_control_auth_token_expired_skipped,remote_control_mobile_setup_no_auth_redirect,remote_control_mobile_setup_authorize_before_enable,remote_control_mfa_info_403_nonblocking,remote_control_client_list_partial_failure_nonblocking,remote_control_settings_force_control_this_pc_visible,remote_control_settings_force_remote_control_section_visible, andremote_control_qm_start. - For phone remote-control repair with a native replacement, live
app\resources\codex.execontainsremote_control_app_server_isolated_oauth_used,remote_control_native_remote_json_first,remote_control_websocket_proxy_attempt,remote_control_websocket_proxy_connected,remote-control-oauth.json,remote.json, andcodex.remote_control.enroll. - For phone remote-control device-list login errors,
scripts\refresh-remote-control-auth.py --verify-onlyreportsok: trueagainst/backend-api/wham/remote/control/clients; if the script regenerated auth, the previous.codex\remote.jsonwas backed up and.codex\auth.jsonplusconfig.tomlwere not modified. - For phone remote-control repair,
Settings -> Connectionsshows the mobile/phone setup path, the QR code appears, phone scan no longer reports an expired Codex environment, PID/path-correlated native logs showremote_control_websocket_proxy_connectedand statusConnectedwithout repeated Windowsos error 10060, and phone-sent turns reach Desktop. Ping/Pong frame text is optional because some native versions handle those frames without logging them. If a phone-sent turn then targets the wrong model API endpoint, handle it as the post-pairing configuration case. - For Dynamic Tools Schema repair, the patched ASAR has
webview\assets\app-server-dynamic-tools-*.jsreturning flat entries containingnamespace,name,description, andinputSchemainstead of a namespace wrapper object,node --checkpasses for that asset, and actual Desktop new-chat/thread creation no longer logsmissing field inputSchema. - For Provider History Sync, both App and legacy SQLite stores report thread rows under the current provider, readable rollout first lines use the current provider,
config.toml sha256 unchangedis logged, official Desktop conversations reappear, and no new empty project groups are introduced. makeappx.exeandsigntool.exeare missing again if SDK cleanup was enabled.

