fix(mac): adapt app discovery & lifecycle to the Codex → ChatGPT.app merge - #51
Merged
Conversation
OpenAI now ships Codex inside ChatGPT.app (bundle id still com.openai.codex, process name ChatGPT, CLI at Contents/Resources/codex). Discovery, is-running, activate, open and quit previously keyed off Codex.app / pgrep -x Codex only, so a healthy merged install reported REAL_CODEX_NOT_FOUND and profile switch skipped quitting the running desktop host. Prefer ChatGPT.app with legacy Codex.app fallback, key lifecycle off the stable bundle id, and add a live e2e probe example.
…review Fixes from the adaptive-review pass (5 HIGH / 6 MEDIUM): - quit: fire the polite AppleScript quit without waiting (a quit-confirmation dialog or first-run Automation/TCC consent prompt could block the switch thread for minutes) and TERM immediately, restoring the pre-merge worst-case latency - signalling: resolve PIDs via pgrep and verify each one's bundle CFBundleIdentifier == com.openai.codex before trusting or killing it, so the consumer ChatGPT chat client (com.openai.chat, executable also named ChatGPT) is never killed as collateral; unverifiable PIDs fail safe (quit times out and aborts the switch instead) - is-running: shell twin now matches Rust semantics — a definitive osascript false is authoritative, process names only probed when osascript is unavailable; degradation is logged once - open: verify each open exit status (open reports app-not-found after a successful spawn), add the display-name last resort the comment promised, and align Rust/shell/CHANGELOG on name-major candidate order (ChatGPT.app wins across both Applications dirs); open/reopen candidates must embed the codex CLI so a chat-only ChatGPT.app is never selected - shell reopen: a fully failed open chain no longer aborts the script via set -e after the switch already succeeded — it warns instead - comments: drop the incorrect Electron/renderer architecture claims, describe TERM/KILL timing per call site, distinguish the two APP_EXIT_FAILED causes
…-reporting - new discover_real_codex_cli_path_prefers_path_walk_over_app_bundle test asserts against a concrete PATH fixture (not recomputed via codex_app_candidates), so a discovery block-ordering regression goes red on any machine, including ones with a real /Applications install - live e2e probe: pgrep spawn failures are reported as SKIP with their own counter instead of being folded into "not running" (which silently disarmed the [1] cross-check); probe-dir cleanup failures now warn instead of vanishing
Owner
Author
手动测试清单(本地 .app 已构建,
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e6d384cb05
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- drop the ambiguous `open -a ChatGPT` last resort (Rust + shell): LaunchServices could resolve the bare name to the consumer chat client (com.openai.chat) and report "opened Codex" for an unrelated app; the unambiguous legacy `Codex` alternate name stays - classify name-matched PIDs as ours/other/unknown instead of a binary verified/skip: POSIX only guarantees `ps -o comm=` returns a command name, so an unverifiable PID now still counts for is-running (the switch aborts instead of proceeding over a possibly-live host) while remaining excluded from TERM/KILL - keep the detached osascript quit's child handle and cancel it on every quit exit path: an Apple event still queued behind the TCC consent prompt would otherwise be delivered to — and close — the relaunched host once consent is granted later
This was referenced Jul 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OpenAI folded the Codex desktop app into ChatGPT.app (bundle id still
com.openai.codex, executableChatGPT, CLI atContents/Resources/codex). This app only probedCodex.app/pgrep -x Codex, so on merged installs:REAL_CODEX_NOT_FOUNDwith a healthy install, andChanges (3 commits)
ChatGPT.appwith legacyCodex.appfallback; is-running / activate / open / quit key off the stable bundle id; newlive_chatgpt_merge_checkexample for on-machine e2e probing.CFBundleIdentifier == com.openai.codexbefore trusting/killing — the consumer ChatGPT chat client (com.openai.chat, executable also namedChatGPT) is never killed as collateral; unverifiable PIDs fail safefalseis authoritative); osascript degradation logged onceopenexit statuses are checked (spawn-and-forget hid app-not-found), display-name last resort restored, Rust/shell/CHANGELOG aligned on name-major candidate order, open/reopen candidates must embed the codex CLIset -eafter a completed switch; warns insteadVerification
cargo test --lib: 129 passed / 0 failed (10 new/updated cases)cargo run --example live_chatgpt_merge_checkon a merged install: 6/6 PASS, 0 failures (real/Applications/ChatGPT.app,codex-cli 0.144.0-alpha.4)CFBundleIdentifier=com.openai.codex,CFBundleExecutable=ChatGPT,CFBundleAlternateNames=["Codex"]bash -n+ function-level live test (definitive-false path, PID verification pipeline proven against a live process)macOS-only; the Windows Store host needs a separate pass if it also renamed.
🤖 Generated with Claude Code