fix(build): restore Windows compile and add windows CI job#410
Conversation
Two recent PRs broke the Windows release build: - PR #408 added `src/supervisor/pty.rs` (uses `std::os::fd`) and a bare `mod pty;` declaration in `supervisor/mod.rs` — Windows lacks `std::os::fd`. - PR #406 referenced `libc::SIG*` constants in `src/config_types.rs`, but `libc` is gated to `[target.'cfg(unix)']`. Gate `mod pty;` to `cfg(unix)` and use platform-portable signal constants in `StopSignal` (libc on Unix, hardcoded POSIX-typical values on Windows where `procs::kill` ignores the signal anyway). Clean up incidental Windows-only warnings in the same touched files. Add a `windows-build` CI job running `cargo check --lib --bins` on windows-latest so this regression cannot reach the release pipeline again. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Greptile SummaryThis PR restores Windows compilation by Confidence Score: 4/5Safe to merge; all changes are compile-fix and warning-cleanup with no logic changes on Unix paths. All findings are P2 (style/best-practice). The Windows CI job lacks an explicit toolchain pin, and the cfg_attr-on-let pattern in logs.rs is unconventional, but neither affects correctness. No P0 or P1 issues found. .github/workflows/ci.yml — consider adding an explicit Rust toolchain step to match rust-version = 1.87 declared in Cargo.toml. Important Files Changed
Reviews (1): Last reviewed commit: "fix(build): restore Windows compile and ..." | Re-trigger Greptile |
| - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2 | ||
| # `cargo check` (debug) catches the compile errors that otherwise only | ||
| # surface in the release pipeline, without paying for an optimized link. | ||
| # Integration tests under tests/ are Unix-only (lsof, pkill, etc.) so | ||
| # we limit the check to lib + bins. | ||
| - run: cargo check --lib --bins --all-features |
There was a problem hiding this comment.
Missing Rust toolchain setup step
The windows-build job relies on the Rust version that happens to be pre-installed on the windows-latest runner. Cargo.toml declares rust-version = "1.87", but GitHub's hosted runners ship whatever Rust stable was current when the image was built — that may lag behind. Adding an explicit dtolnay/rust-toolchain action (or similar) ensures the Windows job uses the same pinned version managed by mise on the Linux job and prevents silent version drift.
| #[cfg_attr(not(unix), allow(unused_variables))] | ||
| let poll_count = poll_count; | ||
| tokio::task::spawn_blocking(move || { | ||
| #[cfg_attr(not(unix), allow(unused_variables))] | ||
| let opened_fresh = fh.is_none(); |
There was a problem hiding this comment.
Prefer
_-prefix over cfg_attr for unused-variable suppression
#[cfg_attr(not(unix), allow(unused_variables))] on a let statement is uncommon and easy to misread. Since both poll_count and opened_fresh are only consumed inside #[cfg(unix)] blocks, the simpler and more idiomatic way to silence the warning on non-Unix targets is to use a leading underscore in the binding itself (let _poll_count = poll_count;), which requires no attribute at all.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
## 🤖 New release * `pitchfork-cli`: 2.9.0 -> 2.9.1 <details><summary><i><b>Changelog</b></i></summary><p> <blockquote> ## [2.9.1](v2.9.0...v2.9.1) - 2026-05-03 ### Fixed - *(build)* restore Windows compile and add windows CI job ([#410](#410)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/).
Summary
The v2.9.0 release pipeline failed on both Windows targets (run 25281536062) due to two recently-merged PRs that didn't cfg-gate Unix-only code:
src/supervisor/pty.rs(usesstd::os::fd) and a baremod pty;insupervisor/mod.rs—std::os::fddoesn't exist on Windows.libc::SIG*references insrc/config_types.rs, butlibcis gated to[target.'cfg(unix)']inCargo.toml.This PR:
mod pty;behindcfg(unix).libc::SIG*lookups inStopSignalwith platform-portable constants —libcon Unix (where signal numbers vary across BSD/Linux), hardcoded POSIX-typical values on Windows. The Windows constants are only used for parsing/Display;procs::killignoresstop_signalon Windows and usesTerminateProcessviasysinfo.windows-buildCI job runningcargo check --lib --bins --all-featuresonwindows-latest. Integration tests undertests/uselsof/pkilland are Unix-only, so we limit the check to lib + bins. This catches the regression in PR CI rather than the release pipeline.A follow-up patch release will be needed since v2.9.0 shipped with no Windows binaries.
Test plan
cargo check --all-targets --all-features(Linux) cleancargo check --target x86_64-pc-windows-gnu --all-featurescleancargo clippy --all-targets --all-features -- -D warnings(Linux) cleancargo clippy --lib --bins --target x86_64-pc-windows-gnu -- -D warningscleanwindows-buildCI job passes on this PR🤖 Generated with Claude Code
Note
Low Risk
Low risk: changes are primarily platform
cfggating and CI configuration to catch Windows-only compile issues; runtime behavior is unchanged except for stop-signal parsing/display constants on Windows.Overview
Restores Windows compatibility by
cfg-gating Unix-only modules/imports (e.g.supervisor::pty, Unix signal handling) and fixing Windows-only warnings/unused code paths.Makes
StopSignalplatform-portable by usinglibcsignal numbers on Unix and POSIX-typical constants on Windows, and adjusts Windows process-kill code to ignore unused stop-signal parameters.Adds a new GitHub Actions
windows-buildjob that runscargo check --lib --bins --all-featuresonwindows-latestto catch Windows compile regressions in PR CI.Reviewed by Cursor Bugbot for commit d3c3830. Bugbot is set up for automated code reviews on this repo. Configure here.