fix(mac): surface Codex's quit-confirm dialog instead of stalling the update#44
Merged
Conversation
… update When automations are enabled, Codex answers the AppleScript quit event with an in-app "Quit Codex?" confirmation dialog instead of quitting. If Codex isn't frontmost (it never is — the manager is, mid-update), that dialog sits unseen, quit_codex() times out after 30s, and the update aborts with a bare "did not quit within the timeout" — the user has no idea a hidden dialog was the cause. Reproduced live on 2026-06-10. - engine (swap.rs): if Codex is still running ~5s after the quit event, it is almost certainly waiting on its own confirm dialog — `activate` Codex so the dialog comes frontmost where the user can answer it, then keep polling until the timeout. Timeout error now names the dialog. Still never force-kills. - app (mac_update.rs): quit_codex_gracefully() wraps both call sites (update perform + uninstall) with an actionable Chinese message telling the user to confirm the quit inside Codex and retry. - ui (i18n.tsx): the pre-update confirm dialog warns about the possible quit-confirmation prompt, in all 11 locales. Verified live: with the manager frontmost, a probe calling quit_codex(30) left the dialog hidden for 5s, then Codex was activated with the dialog visible; confirming it let the quit complete (PROBE-OK).
Wangnov
added a commit
that referenced
this pull request
Jun 10, 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.
问题
Codex 开启 automations 时,对 AppleScript quit 事件的响应是弹出应用内确认框「Quit Codex? Enabled automations won't run while Codex is closed」而非直接退出。更新进行中 manager 在前台、Codex 窗口在后面——确认框没人看见,
quit_codex()30 秒超时,更新中止,报错只有一句 "Codex did not quit within the timeout",用户完全不知道是个隐藏对话框卡住了。2026-06-10 真机复现确认。修复(三层)
swap.rs:quit 事件发出 ~5 秒后 Codex 仍在运行,几乎可以断定是在等确认框——此时activateCodex 把待决对话框带到前台让用户能点;继续轮询到超时。超时错误信息点名该对话框。依旧绝不 force-kill。mac_update.rs:新增quit_codex_gracefully()包装两个调用点(更新 perform + 卸载),超时给出中文可操作指引(去 Codex 里确认退出后重试)。i18n.tsx:更新前确认框加一句「若 Codex 弹出退出确认框,请在 Codex 中点击确认」,11 个语言全部同步。真机验证
探针调用
quit_codex(30),manager 在前台:quit 后对话框被藏住 5 秒 → 引擎自动 activate,「Quit Codex?」对话框跳到前台清晰可见 → 点击 Quit → 探针返回PROBE-OK: Codex quit。codex review --uncommitted无意见;cargo clippy --workspace --all-targets -- -D warnings、cargo test --workspace、npm run check全部通过(CI 同款命令)。