|
| 1 | +# 000 Plan: Windows model-picker full-restart path |
| 2 | + |
| 3 | +## Problem |
| 4 | + |
| 5 | +ocx sync --restart-codex rewrites the Codex catalog JSON and restarts the Codex |
| 6 | +app-server (codex.exe app-server). Observed behavior: |
| 7 | + |
| 8 | +- macOS: the desktop app model picker reflects the new catalog right away. |
| 9 | +- Windows (stable/beta, MSIX package OpenAI.Codex_26.818.3698.0): the picker |
| 10 | + keeps the stale list until the whole desktop app is quit and relaunched. |
| 11 | + |
| 12 | +Local evidence (2026-08-21): |
| 13 | + |
| 14 | +- Desktop UI processes are ChatGPT.exe (Electron shell), installed as MSIX |
| 15 | + package family OpenAI.Codex_2p2nqsd0c76g0, start app id (AUMID) |
| 16 | + OpenAI.Codex_2p2nqsd0c76g0!App. |
| 17 | +- ocx sync --restart-codex matches only codex.exe app-server and |
| 18 | + codex-code-mode-host.exe command lines |
| 19 | + (src/codex/app-server-processes.ts, isCodexAppServerCommandLine). The |
| 20 | + Electron UI is never signalled, so its cached picker survives. |
| 21 | +- After the 20:57 sync + restart, codex.exe (PID 8592) started fresh at 20:59 |
| 22 | + while all ChatGPT.exe UI processes kept their earlier start time, and the |
| 23 | + picker still showed only OpenAI models. |
| 24 | + |
| 25 | +Research findings (subagent, bundle inspection of app.asar): |
| 26 | + |
| 27 | +- The renderer fetches model/list and config/read over stdio JSON-RPC into a |
| 28 | + TanStack Query cache; there is no filesystem watcher on the catalog file. |
| 29 | +- The UI invalidates those queries only on a codex-app-server-initialized |
| 30 | + event. On Windows, externally killing the codex.exe child may not produce |
| 31 | + that event reliably (hypothesis, untested from inside this session), which |
| 32 | + would explain why ocx restart alone does not refresh the picker here while |
| 33 | + macOS recovers. |
| 34 | +- Official docs say to restart the desktop app after changing model_catalog_json; |
| 35 | + no supported refresh hook exists. Known upstream cluster: openai/codex |
| 36 | + issues 19694, 26308, 32349, 34487 (desktop picker vs CLI catalog divergence). |
| 37 | +- Relaunch must go through MSIX activation (shell:AppsFolder AUMID), not the |
| 38 | + exe path under WindowsApps (ACL-restricted, no package identity). |
| 39 | + |
| 40 | +## Scope |
| 41 | + |
| 42 | +IN (audit amendments folded in): |
| 43 | + |
| 44 | +- A supported, documented way to fully restart the Windows Codex desktop app |
| 45 | + after a catalog sync: graceful WM_CLOSE first, bounded taskkill /T /F |
| 46 | + fallback, relaunch via AUMID. Targets resolve InstallLocation at runtime |
| 47 | + via Get-AppxPackage -PackageFamilyName (the family string is NOT a |
| 48 | + substring of the install path); only the root ChatGPT.exe whose parent lies |
| 49 | + outside the package is selected so taskkill /T cascades to codex.exe and |
| 50 | + codex-code-mode-host.exe; the script refuses to kill its own ancestry. |
| 51 | +- A GitHub issue on lidge-jun/opencodex recording the platform gap, the beta |
| 52 | + caveat, upstream issue links, and the requested UX (sync should offer a full |
| 53 | + app restart on Windows). The issue MUST include Version (installed |
| 54 | + @bitkyc08/opencodex version) and Operating system fields, which |
| 55 | + enforce-issue-quality hard-requires once Client or integration is present; |
| 56 | + Reproduction carries the PID/start-time evidence; upstream issues are cited |
| 57 | + as related-but-unverified. |
| 58 | + |
| 59 | +OUT: |
| 60 | + |
| 61 | +- Changing ocx sync runtime behavior in this unit (the issue proposes it; |
| 62 | + implementation is a later unit). |
| 63 | +- Killing processes outside the OpenAI.Codex_2p2nqsd0c76g0 package family. |
| 64 | +- Testing the unverified stdio-respawn hypothesis by killing codex.exe from |
| 65 | + inside this session (would kill our own host); recorded as an open question |
| 66 | + for an external terminal test. |
| 67 | + |
| 68 | +## Work phases |
| 69 | + |
| 70 | +- wp1 (010): add scripts/restart-codex-desktop-app.ps1 with -DryRun/-Force, |
| 71 | + graceful-close then bounded forced fallback, relaunch via AUMID; file the |
| 72 | + templated GitHub issue; record evidence. |
| 73 | + |
| 74 | +## Accept criteria |
| 75 | + |
| 76 | +- Script -DryRun exits 0 AND lists the specific live root PID(s) it would |
| 77 | + stop and the relaunch command, without stopping anything (an exit-0 no-op |
| 78 | + does not pass). Focused probe evidence per scripts/AGENTS.md is the real |
| 79 | + gate (tsconfig includes only src/); bun x tsc --noEmit still runs as a |
| 80 | + no-regression check. |
| 81 | +- Issue exists on origin with bug_report template headings. |
| 82 | + |
| 83 | +## Safety notes |
| 84 | + |
| 85 | +- Running the restart from inside a Codex conversation kills that conversation |
| 86 | + host app; the script warns and docs say to run it from an external terminal. |
| 87 | +- Forced kill is limited to processes whose Path is under the runtime-resolved |
| 88 | + InstallLocation. Close-to-tray behavior is explicitly checked: if |
| 89 | + CloseMainWindow() only hides the window, the wait expires and the forced |
| 90 | + path runs; record observed behavior. Record the PowerShell edition the |
| 91 | + probe ran under (Get-AppxPackage differs between 5.1 and 7). |
0 commit comments