Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.
codex: the Windows Codex app's own app-server is found, so Connect, Disconnect and failover restart it there too
yetone3aead9c62773
diff --git a/internal/provider/codex_app_server_test.go b/internal/provider/codex_app_server_test.goindex d6c89ae38..9ef95125c 100644--- a/internal/provider/codex_app_server_test.go+++ b/internal/provider/codex_app_server_test.go@@ -372,15 +372,28 @@ func TestCodexOutUntil(t *testing.T) {}}+// codexWindowsAppServer is the Windows Codex app's own app-server.+const codexWindowsAppServer = `C:\Users\yeton\AppData\Local\OpenAI\Codex\bin\2993767bd1dfb009\codex.exe -c features.code_mode_host=true app-server --analytics-default-enabled -c [email protected]_servers.codex_app.enabled=true`+// Only the app's own app-server is restarted: another program's, started// from the app's bundled codex with --listen (Miyi Helper's, seen on the// owner's Mac), is that program's.func TestCodexAppOwnServer(t *testing.T) {- own := "/Applications/ChatGPT.app/Contents/Resources/codex-cli/CodexCLI.app/Contents/MacOS/codex -c features.code_mode_host=true app-server --analytics-default-enabled -c [email protected]_servers.codex_app.enabled=true"- if !isCodexAppOwnServer(own) {- t.Fatalf("the app's own app-server not taken: %s", own)+ for _, own := range []string{+ "/Applications/ChatGPT.app/Contents/Resources/codex-cli/CodexCLI.app/Contents/MacOS/codex -c features.code_mode_host=true app-server --analytics-default-enabled -c [email protected]_servers.codex_app.enabled=true",+ // the Windows app's (OpenAI.Codex 26.1021, ChatGPT.exe's child),+ // as Windows listed it on the Windows box: run from LOCALAPPDATA,+ // not from its package (zhibukaixinyao on Discord)+ codexWindowsAppServer,+ } {+ if !isCodexAppOwnServer(own) {+ t.Errorf("the app's own app-server not taken: %s", own)+ }}for _, other := range []string{+ `C:\Users\me\AppData\Local\OpenAI\Codex\bin\2993767bd1dfb009\codex.exe app-server --listen stdio://`,+ `C:\Users\me\AppData\Roaming\npm\node_modules\@openai\codex\vendor\x86_64-pc-windows-msvc\codex\codex.exe app-server`,+ `C:\Users\me\AppData\Local\Microsoft\WinGet\Links\codex.exe app-server`,"/Applications/ChatGPT.app/Contents/Resources/codex-cli/CodexCLI.app/Contents/MacOS/codex app-server --listen stdio://","/Applications/ChatGPT.app/Contents/Resources/codex-cli/CodexCLI.app/Contents/MacOS/codex app-server --listen=ws://127.0.0.1:4500","/Applications/ChatGPT.app/Contents/Resources/codex-cli/CodexCLI.app/Contents/MacOS/codex -c forced_login_method=\"chatgpt\" exec-server --remote https://codex-cloud-environments.chatgpt.com/api",diff --git a/internal/provider/codex_daemon.go b/internal/provider/codex_daemon.goindex 480b8210e..a7f4b790f 100644--- a/internal/provider/codex_daemon.go+++ b/internal/provider/codex_daemon.go@@ -258,9 +258,12 @@ func DismissCodexApp() {// Codex desktop app runs for itself: 0 when it isn't open. On macOS that// is ChatGPT.app's (or Codex.app's) bundled codex, `…/CodexCLI.app/// Contents/MacOS/codex [-c k=v…] app-server --analytics-default-enabled …`;-// on Windows the Store app's `…\WindowsApps\OpenAI.Codex_…\codex.exe-// app-server`. Not the managed daemon, nor an app-server's helpers or-// proxy, nor an editor's codex.+// on Windows the Store app's (OpenAI.Codex, ChatGPT.exe), which copies its+// codex out of WindowsApps and runs it from %LOCALAPPDATA%:+// `C:\Users\…\AppData\Local\OpenAI\Codex\bin\<hash>\codex.exe -c … app-server+// --analytics-default-enabled …` (26.1021 on the Windows box). Not the+// managed daemon, nor an app-server's helpers or proxy, nor an editor's+// codex.func findCodexApp(ps []proc.Process) int {for _, p := range ps {if isCodexAppServer(p.Args) {@@ -278,7 +281,7 @@ func isCodexAppServer(args string) bool {// the program's own path: ps leaves a path's spaces unquoted, so// "…/Codex Computer Use.app/Contents/MacOS/…" reads as one named Codexexe, rest := splitExe(args)- if !strings.Contains(exe, ".app/Contents/") && !strings.Contains(exe, `\WindowsApps\OpenAI.`) {+ if !strings.Contains(exe, ".app/Contents/") && !windowsCodexApp(exe) {return false}if base := strings.ToLower(exe[strings.LastIndexAny(exe, `/\`)+1:]); base != "codex" && base != "codex.exe" {@@ -289,6 +292,14 @@ func isCodexAppServer(args string) bool {return i >= 0 && (i+1 >= len(f) || strings.HasPrefix(f[i+1], "-"))}+// windowsCodexApp is whether exe is the Windows Codex app's codex: the one+// it runs from %LOCALAPPDATA%\OpenAI\Codex\bin\<hash>\, or one in its+// package under WindowsApps.+func windowsCodexApp(exe string) bool {+ e := strings.ToLower(exe)+ return strings.Contains(e, `\appdata\local\openai\codex\bin\`) || strings.Contains(e, `\windowsapps\openai.`)+}+// RestartCodexDaemon has Codex restart its app-server, which reads the// sign-in again: `codex app-server daemon restart`, run with the codex CLI// magpie finds and the Codex home it signs Codex in through. Codex 0.162'sdiff --git a/internal/provider/codex_daemon_test.go b/internal/provider/codex_daemon_test.goindex a37876334..e2fd2a1c5 100644--- a/internal/provider/codex_daemon_test.go+++ b/internal/provider/codex_daemon_test.go@@ -339,6 +339,7 @@ func TestIsCodexClient(t *testing.T) {"/Users/me/.vscode/extensions/openai.chatgpt-1.0/bin/darwin-aarch64/codex app-server": false,"codex mcp-server": false,`"C:\Program Files\WindowsApps\OpenAI.Codex_1.0\app\resources\codex.exe" app-server`: false,+ codexWindowsAppServer: false,// other programs"/Users/me/.codex/plugins/cache/chrome/extension-host ChatGPT for Chrome": false,// a path with a space, as the user's own ps showed it@@ -493,8 +494,9 @@ func TestFindCodexApp(t *testing.T) {// (ChatGPT 26.1007), beside a terminal codex and the managed daemonapp := "/Applications/ChatGPT.app/Contents/Resources/codex-cli/CodexCLI.app/Contents/MacOS/codex -c features.code_mode_host=true app-server --analytics-default-enabled -c [email protected]_servers.codex_app.enabled=true"for want, ps := range map[int][]proc.Process{- 9: {{PID: 3, Args: "codex"}, {PID: 4, Args: "/Users/me/.codex/packages/app-server-daemon/releases/0.162.0-aarch64-apple-darwin/bin/codex app-server --listen unix:///x --managed-daemon"}, {PID: 9, Args: app}},- 8: {{PID: 8, Args: `"C:\Program Files\WindowsApps\OpenAI.Codex_1.0\app\resources\codex.exe" app-server`}},+ 9: {{PID: 3, Args: "codex"}, {PID: 4, Args: "/Users/me/.codex/packages/app-server-daemon/releases/0.162.0-aarch64-apple-darwin/bin/codex app-server --listen unix:///x --managed-daemon"}, {PID: 9, Args: app}},+ 8: {{PID: 8, Args: `"C:\Program Files\WindowsApps\OpenAI.Codex_1.0\app\resources\codex.exe" app-server`}},+ 61552: {{PID: 3, Args: `C:\Users\yeton\AppData\Local\Microsoft\WinGet\Links\codex.exe`}, {PID: 61552, Args: codexWindowsAppServer}},0: {{PID: 3, Args: "codex app-server proxy"},{PID: 5, Args: "/Applications/ChatGPT.app/Contents/Resources/codex-cli/CodexCLI.app/Contents/MacOS/codex exec-server --remote x"},