Skip to content

fix(mac): surface Codex's quit-confirm dialog instead of stalling the update#44

Merged
Wangnov merged 1 commit into
mainfrom
fix/quit-confirm-dialog-stall
Jun 10, 2026
Merged

fix(mac): surface Codex's quit-confirm dialog instead of stalling the update#44
Wangnov merged 1 commit into
mainfrom
fix/quit-confirm-dialog-stall

Conversation

@Wangnov

@Wangnov Wangnov commented Jun 10, 2026

Copy link
Copy Markdown
Owner

问题

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 仍在运行,几乎可以断定是在等确认框——此时 activate Codex 把待决对话框带到前台让用户能点;继续轮询到超时。超时错误信息点名该对话框。依旧绝不 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 warningscargo test --workspacenpm run check 全部通过(CI 同款命令)。

… 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 Wangnov merged commit ebcc7a1 into main Jun 10, 2026
3 checks passed
@Wangnov Wangnov deleted the fix/quit-confirm-dialog-stall branch June 10, 2026 04:06
Wangnov added a commit that referenced this pull request Jun 10, 2026
Ships #43 (vendor Sparkle BinaryDelta so macOS delta updates actually run), #44 (surface Codex's quit-confirm dialog instead of stalling), #45 (single-snapshot update card + stale-expectation auto-recovery).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant