Repository navigation
fix(windows): tolerate a Codex process that has already exited - #1185
Conversation
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes.
|
| Layer / File(s) | Summary |
|---|---|
退出状态检查与进程终止 crates/platform/src/windows_process.rs |
新增 process_has_exited,通过零超时等待检查进程状态。terminate_process 打开进程时增加同步权限,并在访问拒绝且进程已退出时视为成功。测试覆盖已退出子进程的再次终止。 |
进程筛选中的退出状态检查 crates/platform/src/process.rs |
Windows 安装目录进程筛选会排除已退出的进程。process_exists 只有在进程未退出且枚举结果包含该 PID 时才返回 true。 |
环境变量移除测试
| Layer / File(s) | Summary |
|---|---|
环境变量名称断言调整 crates/platform/src/desktop_launch.rs |
移除变量的断言改用 OsStr 比较。Windows 额外接受大小写不敏感的名称匹配。 |
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Suggested reviewers: bwndlct, bytepioneer-ai, mouzhi
Merge Risk: 
Minimal · previous review d7556
-
This change prevents Windows restart failures when a process has already exited but its handle remains open. No merge-blocking issues were identified. The new Windows regression test should be run on Windows as normal pre-merge verification.
Pre-merge checks: 
4
-
Full details: Description check
-
Explanation
PR 描述与变更集直接相关。描述说明了 Windows 上 TerminateProcess 返回错误 5 的处理方式:仅当零超时等待确认进程已退出时才接受该错误。描述还涵盖跳过已退出进程的检查、新增 Windows 回归测试,以及环境变量移除测试改为 Windows 上大小写不敏感匹配。这些内容与 raw_summary 中列出的 process.rs、windows_process.rs 和 desktop_launch.rs 的改动一致。描述包含具体的测试计划和链接,信息量充足。
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
c9249e1 to
07554f2
Compare
07554f2 to
d755693
Compare
d755693 to
3395b06
Compare
# Conflicts: # crates/platform/src/desktop_launch.rs
|
Thanks for the clean fix and real Win32 process regression test! We merged |
Summary
Windows can return error 5 from
TerminateProcessafter a process has exited while a handle to it is still open. The Launcher can surface this as a restart failure. Microsoft Win32 documentationRelated issues
Refs #1183. The report does not identify whether the process had exited or Windows denied a live termination request.
UI Demo
N/A (Windows process lifecycle).
Test plan
cargo check --locked -p codexhost-platform -p codexhost-launcher --tests --target x86_64-pc-windows-msvcpassed.cargo test --offline --locked -p codexhost-platform --libon macOS passed 80 tests. The remaining system proxy test passed when rerun with access to the macOS configuration store.cargo fmt --all --checkandgit diff --checkpassed.cargo clippy --offline --locked -p codexhost-platform -p codexhost-launcher --all-targets --target x86_64-pc-windows-msvc -- -D warningspassed.