Skip to content

fix(gpui): 统一退出协调器(关窗即退出、批次中确认、系统终止) - #90

Merged
yeagoo merged 3 commits into
mainfrom
fix/gpui-quit-coordinator
Oct 24, 2026
Merged

yeagoo merged 3 commits into
mainfrom
fix/gpui-quit-coordinator

Conversation

@yeagoo

@yeagoo yeagoo commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

实现 docs/GPUI_MACOS_LIFECYCLE_PLAN.md 的 PR-A(L1–L4、L7)。

修复

  • 关闭主窗口即退出应用,不再留下无窗口、仍持有实例锁的进程(L1/L2)。
  • ⌘Q、关闭主窗口、Dock“退出”在批次运行时先确认;“停止并退出”取消批次后在工作线程等待原子写(最多 10 s),界面不卡(L3/L4)。
  • 注销、重启、关机:取消批次并最多等待 5 s 后退出(L3)。
  • 退出闩:退出请求一开始就拒绝新批次,避免与排队中的开始竞争。
  • 未提交的数值草稿在最终退出时提交,绕过表单忙碌闸门;“继续转换”不改动草稿(L7)。
  • 确认框文案九语言。

框架补丁

gpui-pre / gpui-pre-macos 新增 applicationShouldTerminate: 询问(App::on_should_terminate,按 kAEQuitReason 区分会话结束;状态被借用时回复取消并从主队列重新发起),已登记到覆盖登记表,说明见 docs/GPUI_PATCHES.md。

与方案的偏差

见方案第 7 节:会话结束同步等待、不注册 on_reopen、规划/输出安全确认阶段退出不询问(未写文件)、确认前不关闭已开对话框。

验证

  • Linux:GPUI 全部测试通过(新增 tests/quit.rs 4 项、终止决策表单元测试),clippy -D warnings 通过,覆盖登记表 verify.py 与工具测试通过。
  • macOS 13.6 虚拟机:空闲时关窗 / ⌘Q / AppleEvent 退出均直接退出;批次中三种方式均弹出确认,Esc 继续转换,“停止并退出”约 10 s 后退出,输出目录无残留。实测中发现并修复:⌘Q 从窗口内触发时确认框无法打开,现改为窗口更新后再打开。
  • Codex 评审两轮:修复草稿时机、忙碌闸门、借用时终止三处;规划阶段不询问为有意取舍(见偏差)。

🤖 Generated with Claude Code

yeagoo and others added 3 commits October 25, 2026 01:21
Closing the main window now quits the application instead of leaving a
windowless process that holds the instance marker. Quitting while a batch
runs asks first and waits for in-flight writes off the UI thread. The Dock's
Quit and session end reach the coordinator through a new
applicationShouldTerminate: hook in the vendored macOS platform. A latch
refuses batches that race the quit, and number drafts are committed before
the settings are flushed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…terminate

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@yeagoo
yeagoo merged commit def9fa8 into main Oct 24, 2026
10 checks passed
@yeagoo
yeagoo deleted the fix/gpui-quit-coordinator branch October 24, 2026 18:27
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