Unofficial local patch bundle for the Codex desktop app. It fixes the /goal workflow, adds a project path retarget action for moved local folders, and repairs common patched-app browser-use wiring issues.
This repository does not include OpenAI binaries, app.asar, extracted application files, user profiles, tokens, or cache files. Users apply the patch to their own local Codex installation at their own risk.
The initial release added the missing desktop UI wiring for Codex goals: /goal <objective> appears in the local composer, calls Codex's persisted thread/goal/set API, and lets Codex's own goal runtime keep working until the goal is complete, paused, budget-limited, or stopped.
This update keeps that real goal behavior and adds the install-time pieces needed on current Codex desktop builds: the installer enables [features].goals = true automatically in %USERPROFILE%\.codex\config.toml, preserves existing TOML sections, repairs stale local goal-runtime state, supports the current minified bundle names, and resumes the thread after setting the goal so Codex's continuation runtime starts even when the desktop view had not loaded the thread yet.
The screenshots show the four important behaviors this patch is meant to provide:
- Project path menu: the local project sidebar menu includes Change project folder / 프로젝트 경로 변경. Use this when a project folder moved and you want existing chats to keep using the new
cwd. cwdretarget proof: after using the project path action, the same chat reports a different current working directory, showing that the saved workspace path changed from the old folder to the new one./goalslash command: typing/goalin the composer opens the Goal slash command entry.- Goal set confirmation: after submitting
/goal <objective>, the app shows Goal set, confirming that the thread goal was accepted.
The chat output shows that the active `cwd` changes after retargeting the project path.
The composer recognizes `/goal` as a slash command.
The "Goal set" toast confirms that the goal was applied.
This is a Windows-only patch installer for people who already have the Codex desktop app installed. It is tested on Windows 11, and should also work on Windows systems that use the same Codex desktop app layout.
It does not give you a modified Codex installer. Instead, it copies your own local Codex app into a separate folder, patches that copy, and leaves the original app installed.
After installing, use:
%LOCALAPPDATA%\OpenAI\CodexPatched\app\Codex.exe
It is normal if %LOCALAPPDATA%\OpenAI does not exist before running the installer. The installer creates %LOCALAPPDATA%\OpenAI\CodexPatched for the patched copy.
Some official Codex installs live under %LOCALAPPDATA%\Programs\Codex. Store/AppX installs can also live under a versioned WindowsApps path such as:
C:\Program Files\WindowsApps\OpenAI.Codex_26.429.3425.0_x64__2p2nqsd0c76g0\app\Codex.exe
The installer checks these locations automatically. If auto-detection fails, pass the full Codex.exe path with -SourceApp.
You can tell non-technical users this:
Install the official Codex desktop app first. Then install Python 3.11+ and Node.js LTS if you do not already have them.
Download the latest release ZIP from the Releases page, extract it, close Codex completely, open PowerShell in the extracted folder, and run:
Set-ExecutionPolicy -Scope Process Bypass
.\install_windows.ps1
When it finishes, launch:
%LOCALAPPDATA%\OpenAI\CodexPatched\app\Codex.exe
Use /goal your goal text in a loaded local Codex chat to set or replace the active thread goal. For anything nontrivial, write the goal in a separate note or editor first, then paste it after `/goal`; keeping that source copy makes the original objective easier to review after Codex finishes the goal run. Codex uses its built-in goal continuation runtime to start or continue work until the goal is marked complete, paused, budget-limited, or stopped. On the new-chat home screen, `/goal <objective>` queues that goal for the next local chat you start from the same project.
If you moved a project folder, right-click that project in the sidebar and choose Change project folder / 프로젝트 경로 변경. Select the new folder location. This keeps the chat history and retargets the cwd/workspace path Codex uses.
If the installer cannot find Codex, find the official Codex.exe path and run the installer again with -SourceApp. For Store/AppX installs the path may look like:
.\install_windows.ps1 -SourceApp "C:\Program Files\WindowsApps\OpenAI.Codex_26.429.3425.0_x64__2p2nqsd0c76g0\app\Codex.exe"
If a patched copy already exists, run:
.\install_windows.ps1 -ForceTo install and launch the patched app in one step:
.\install_windows.ps1 -Launch/goal <objective>can be entered from the composer./goal <objective>in an existing loaded local thread sets the active thread goal through Codex'sthread/goal/setAPI and lets the real goal runtime start/continue work automatically./goal <objective>appears on the new-chat home composer. If no thread exists yet, the goal is queued and applied to the next local chat created from that project.- The installer enables the local Codex
goalsfeature flag in%USERPROFILE%\.codex\config.toml. - The installer repairs stale local goal-runtime backfill state that can block Codex from opening its goal continuation database.
- Setting a new goal first clears the previous thread goal, so a completed or stale goal does not block the next one.
- Local project sidebar menu gets Change project folder / 프로젝트 경로 변경.
- When a project folder was moved, the app can retarget existing chats to the new folder path instead of treating the old path as permanently missing.
- Existing chats keep their session history while their saved
cwdis updated to the new folder. browser-useis configured to trust the patched app's bundled browser client whennode_replis launched from the patched copy.browser-usecan recover the registered conversation/window route when the app missed a per-turn IAB route capture.- During
browser-usecontrol, simple websitealert()popups are suppressed so native OK-only dialogs do not block automation.confirm()andprompt()are left unchanged. - Electron ASAR integrity in
Codex.execan be updated after repackingapp.asar.
cwd means current working directory. In Codex, each local chat is tied to a project folder path. That path decides where shell commands run and which workspace the chat sees.
If you move a project folder, old chats can still point at the old path. The patched app adds Change project folder / 프로젝트 경로 변경 so you can choose the new location for that existing project.
The retarget action updates Codex's saved local state for matching chats:
state_5.sqlitethreadcwdvalues.- Matching session JSONL
payload.cwdvalues. - Saved sidebar/workspace root state in
.codex-global-state.json.
The retarget action does not:
- Delete chats.
- Create new replacement chats.
- Move files or folders on disk.
- Change unrelated projects.
Before writing changes, it creates a backup under:
%USERPROFILE%\.codex\backups\cwd-retarget-*
- This is not an official OpenAI project.
- This repository is source-only. It does not redistribute Codex binaries or a prepatched app.
- Do not publish or redistribute
Codex.exe,app.asar, extracted app bundles,.codexprofiles, auth files, logs, or caches. - The patched app is installed as a separate copy named
CodexPatched. Your official Codex install remains available. - Codex updates can change the minified bundle names and code patterns. If the script cannot find exactly one match, it stops instead of guessing.
- Patch a copied app directory, not your only Codex install.
- The project path action does not move folders on disk. It only updates Codex's saved workspace path for matching local chats.
- Windows Codex desktop app installed.
- Python 3.11 or newer.
- Node.js/npm for
npx @electron/asar.
The installer auto-detects common Codex desktop install locations, including:
%LOCALAPPDATA%\OpenAI\Codex\app
%LOCALAPPDATA%\Programs\Codex
%PROGRAMFILES%\Codex
%PROGRAMFILES%\OpenAI\Codex
C:\Program Files\WindowsApps\OpenAI.Codex_*\app
It also checks Codex-looking folders under %LOCALAPPDATA%\Programs, %LOCALAPPDATA%\OpenAI, Program Files, Windows uninstall registry entries, and AppX/MSIX package installs such as OpenAI.Codex. If Get-AppxPackage is unavailable, the installer still tries the direct WindowsApps folder pattern.
The patched copy is always created at:
%LOCALAPPDATA%\OpenAI\CodexPatched\app
- Open the latest GitHub Release and download
codex-desktop-patch-*.zip. - Extract the ZIP.
- Close Codex completely.
- Open PowerShell in the extracted folder.
- Run:
Set-ExecutionPolicy -Scope Process Bypass
.\install_windows.ps1If you already installed a patched copy and want to replace it:
.\install_windows.ps1 -ForceIf you want the installer to open the patched app when it finishes:
.\install_windows.ps1 -LaunchIf your Codex app is installed in a nonstandard folder:
.\install_windows.ps1 -SourceApp "C:\Path\To\Codex\app"-SourceApp may point at either the app folder, Codex.exe, or resources\app.asar:
.\install_windows.ps1 -SourceApp "C:\Program Files\WindowsApps\OpenAI.Codex_26.429.3425.0_x64__2p2nqsd0c76g0\app\Codex.exe"If the app is already patched but browser-use still points at an old app copy:
.\install_windows.ps1 -RepairBrowserUseOnlyThe installer creates a separate patched copy at:
%LOCALAPPDATA%\OpenAI\CodexPatched\app\Codex.exe
The commands below create a separate patched app copy:
- Original app:
%LOCALAPPDATA%\OpenAI\Codex\app - Patched copy:
%LOCALAPPDATA%\OpenAI\CodexPatched\app
Close Codex before patching. The easy installer above does these steps automatically. The manual commands below are kept for troubleshooting.
Run PowerShell from this repository directory.
$src = "$env:LOCALAPPDATA\OpenAI\Codex\app"
$dstRoot = "$env:LOCALAPPDATA\OpenAI\CodexPatched"
$dst = "$dstRoot\app"
$extract = "$env:TEMP\codex-desktop-patch-app-asar"
New-Item -ItemType Directory -Force $dstRoot | Out-Null
Copy-Item -Recurse -Force $src $dst
Copy-Item "$dst\resources\app.asar" "$dst\resources\app.asar.original-codexpatch"
Copy-Item "$dst\Codex.exe" "$dst\Codex.exe.original-codexpatch"
Remove-Item -Recurse -Force $extract -ErrorAction SilentlyContinue
npx --yes @electron/asar extract "$dst\resources\app.asar" $extract
py -3 .\codex_desktop_patch.py $extract
npx --yes @electron/asar pack $extract "$dst\resources\app.asar"
py -3 .\codex_desktop_patch.py --fix-integrity $dst
.\install_windows.ps1 -RepairBrowserUseOnly -SourceApp $dstIf py -3 is not available, use python:
python .\codex_desktop_patch.py $extract
python .\codex_desktop_patch.py --fix-integrity $dst
.\install_windows.ps1 -RepairBrowserUseOnly -SourceApp $dst& "$env:LOCALAPPDATA\OpenAI\CodexPatched\app\Codex.exe"If the official Codex app is already running, close it first. Electron may forward launches to the already-running instance.
The installer prints the exact path to the patched Codex.exe when it succeeds.
For /goal, in a local Codex thread:
- Type
/goal test goal one. - Confirm the app reports that the goal was set.
- Confirm Codex starts or continues through the goal runtime.
- Type
/goal test goal two. - The second goal should replace the previous one instead of failing because a goal already exists.
For real work, draft the full goal somewhere outside Codex first and paste it into /goal. That keeps the exact objective easy to find later when reviewing a completed run.
For /goal from the new-chat home screen:
- Select a local project.
- Type
/goal test goal from home. - Confirm the app queues the goal for the next chat.
- Send the first real task message in that project.
- Confirm the new chat starts and the queued goal is applied.
For moved project folders:
- Launch the patched Codex copy.
- Right-click a local project in the sidebar.
- Click Change project folder or 프로젝트 경로 변경.
- Select the folder's new location.
- The patch updates the sidebar project path, matching local thread cwd values, and session metadata. A backup is written under
%USERPROFILE%\.codex\backups\cwd-retarget-*.
This keeps the existing chats. It changes the workspace path those chats use. It does not delete sessions and does not move project files.
For browser-use:
- Launch the patched Codex copy.
- Start a local thread in the patched app.
- Ask Codex to open or inspect a local page with browser-use.
- The
iabbackend should connect through the patched app's bundled browser client. - If the app missed a per-turn IAB route capture, the patched app should recover the registered route for the same conversation/window instead of failing with a route capture error.
- OK-only website alerts should not block browser-use while the agent is controlling the browser.
Close Codex, then restore the backed-up files. The easy installer writes timestamped backups next to the patched files:
%LOCALAPPDATA%\OpenAI\CodexPatched\app\Codex.exe.original-codexpatch-*
%LOCALAPPDATA%\OpenAI\CodexPatched\app\resources\app.asar.original-codexpatch-*
For manual installs using the commands above, restore the fixed backup names:
$dst = "$env:LOCALAPPDATA\OpenAI\CodexPatched\app"
Copy-Item "$dst\resources\app.asar.original-codexpatch" "$dst\resources\app.asar" -Force
Copy-Item "$dst\Codex.exe.original-codexpatch" "$dst\Codex.exe" -ForceOr delete %LOCALAPPDATA%\OpenAI\CodexPatched and keep using the official Codex install.
The Codex desktop app bundle changed. Do not force the patch. Update the script for that Codex version.
Run:
py -3 .\codex_desktop_patch.py --fix-integrity "$env:LOCALAPPDATA\OpenAI\CodexPatched\app"Make sure you launched the patched copy, not the official app. Close all Codex processes and launch:
& "$env:LOCALAPPDATA\OpenAI\CodexPatched\app\Codex.exe"Make sure you launched the patched copy. The project path action only appears for local workspace projects in the project action menu.
Check %USERPROFILE%\.codex\backups first. The retarget action backs up state_5.sqlite, its WAL/SHM sidecars when present, .codex-global-state.json, and affected rollout JSONL files before writing changes.
That can be normal before installation. The installer creates %LOCALAPPDATA%\OpenAI\CodexPatched for the patched app copy.
If the installer says it cannot find Codex, the official app is probably installed somewhere else or only the Codex CLI is installed. Find the folder that contains both Codex.exe and resources\app.asar, then run:
.\install_windows.ps1 -SourceApp "C:\Path\To\Codex\app"If Codex is installed from an AppX/MSIX package, the path can look like:
C:\Program Files\WindowsApps\OpenAI.Codex_26.429.3425.0_x64__2p2nqsd0c76g0\app\Codex.exe
That full Codex.exe path is valid for -SourceApp:
.\install_windows.ps1 -SourceApp "C:\Program Files\WindowsApps\OpenAI.Codex_26.429.3425.0_x64__2p2nqsd0c76g0\app\Codex.exe"If a Node REPL reset fixes it, the app bundle is usually not broken. The current node_repl process lost the in-app browser discovery state.
Run:
.\install_windows.ps1 -RepairBrowserUseOnlyThis rewrites %USERPROFILE%\.codex\config.toml so node_repl trusts the browser-use client shipped inside %LOCALAPPDATA%\OpenAI\CodexPatched\app. It does not stop running node_repl.exe processes by default, because doing that can interrupt active browser-use sessions.
If you are sure no active session is relying on browser-use and you want to clean stale patched node_repl.exe processes too, run:
.\install_windows.ps1 -RepairBrowserUseOnly -StopNodeReplRetry browser-use after that. If the same error persists, reset Node REPL or fully close and reopen Codex.
Current versions of this patch also include desktop-app IAB route recovery for cases where Codex has already registered a browser route for the same conversation. If you still see the same error after reinstalling with .\install_windows.ps1 -Force, verify that you launched %LOCALAPPDATA%\OpenAI\CodexPatched\app\Codex.exe, not the official unpatched app.
If setupAtlasRuntime({ backend: "iab" }) succeeds but opening a tab fails with an error like this:
No Codex browser route captured for browser session ... turn ...
Install the latest patch with:
.\install_windows.ps1 -ForceThen fully close Codex and launch the patched app again. This version can recover the registered conversation/window route when Codex missed the per-turn browser route capture.
Install the latest patch with:
.\install_windows.ps1 -ForceThen fully close and reopen the patched app. The patch suppresses simple window.alert() popups only while browser-use is controlling the in-app browser. This prevents OK-only validation popups from freezing automation. Dialogs that require a choice or entered text, such as confirm() and prompt(), are intentionally not auto-handled.
Review the script before running it. It edits local application files, updates the Electron ASAR integrity hash in the copied Codex.exe, and updates local Codex config for the patched node_repl. The runtime project path action edits local Codex profile state for the selected moved project.