fix(macos): stop stale injector watcher CPU loops - #264
Conversation
|
维护者 current-main 复核(main@6f789be / v1.5.12):#218 的 lifecycle/performance 缺口仍有价值,PR 保持开放。当前 macOS 仍使用 请基于 current main 重放 host-PID-bound watcher 与一次性 LaunchAgent 的最小改动,保留 signed runtime、exact process identity、Browser ID 和 pause/restore 清理。验收需覆盖 Codex 正常退出、短时 CDP 不可达、重开、重复 start、stale PID/reuse,并在 Apple Silicon 实机记录 bounded retry、日志增长和 CPU。 |
|
维护者复核(当前 current macOS 仍以 验收需要完整 macOS suite,以及真实退出 Codex 后 watcher/job 消失、30 秒窗口内请求/日志计数有界、SIGTERM 及时退出、pause/restore/reapply 全链路。原描述中的 live/restore 勾选与 Notes 结论不一致,也请用同一 current build 重验后更新。 |
Prevent stale CDP retry loops from surviving the exact Codex process they belong to. Use a one-shot LaunchAgent, PID/start/executable host identity, bounded interruptible discovery backoff, and throttled error logging. Constraint: Preserve the signed runtime, exact injector process identity, pause recovery, and the user's currently paused skin. Rejected: launchctl submit with faster polling | it can relaunch a disconnected watcher indefinitely. Confidence: high Scope-risk: moderate Reversibility: clean Directive: Keep watcher host checks PID-reuse-safe and retry waits signal-interruptible. Tested: isolated watcher lifecycle and repeated LaunchAgent replacement; macOS run-tests.sh with signed-runtime and Doctor branches skipped; git diff --check. Not-tested: Live themed Codex start/quit/reopen was intentionally skipped to keep the skin off. Related: Fei-Away#218, Fei-Away#264
Prevent stale CDP retry loops from surviving the exact Codex process they belong to. Use a one-shot LaunchAgent, PID/start/executable host identity, bounded interruptible discovery backoff, and throttled error logging. Constraint: Preserve the signed runtime, exact injector process identity, pause recovery, and the user's currently paused skin. Rejected: launchctl submit with faster polling | it can relaunch a disconnected watcher indefinitely. Confidence: high Scope-risk: moderate Reversibility: clean Directive: Keep watcher host checks PID-reuse-safe and retry waits signal-interruptible. Tested: isolated watcher lifecycle and repeated LaunchAgent replacement; macOS run-tests.sh with signed-runtime and Doctor branches skipped; git diff --check. Not-tested: Live themed Codex start/quit/reopen was intentionally skipped to keep the skin off. Related: Fei-Away#218, Fei-Away#264
Summary / 摘要
launchctl submitwith a one-shot LaunchAgent usingKeepAlive=false, while cleaning up legacy submitted jobs and orphaned jobs whose state file is missing.Closes #218
Type / 类型
Platform / 平台
Self-check / 自测
Docs-only / 仅文档
macOS (when code under
macos/changes)macos/tests/run-tests.shpassed / 已通过macos/scripts/doctor-macos.shverify-dream-skin-macos.shor Desktop VerifyWindows (when code under
windows/changes)install/start/verify/restorescripts exercised / 已按改動跑過對應腳本User-facing / 用户可见变更
macos/CHANGELOG.md(andmacos/VERSIONif release-worthy) / 已更新 changelog(發版時再 bump VERSION)Security / 安全
127.0.0.1) where applicable / CDP 仍僅本機回環(如適用)Notes / 補充
main; the unrelated localadd Ado themecommit was intentionally excluded.CODEX_DREAM_SKIN_SKIP_DOCTOR=1 npm testfrommacos/, targeted watcher lifecycle and window-readiness tests, shell/Node syntax checks, andgit diff --check.windows/changed.