Skip to content

fix(process-daemon): poll every 25 ms on Windows - #59702

Merged
jlongster merged 1 commit into
devfrom
daemon-windows-poll
Oct 28, 2026
Merged

jlongster merged 1 commit into
devfrom
daemon-windows-poll

Conversation

@jlongster

@jlongster jlongster commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Ported from anomalyco/opencode-pty#33. Part of the stack for anomalyco/opencode-pty#25. Builds directly on dev (#59701 merged), no prerequisite.

Issue for this PR

Related to anomalyco/opencode-pty#25

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

  • Interim, Windows-only reduction of idle wakeups. Unix behavior is unchanged.
    • The main loop's Listener::wait stub in packages/process-daemon/src/transport/windows.rs now sleeps up to 25 ms instead of 10 ms (POLL_INTERVAL).
    • The per-terminal root-exit check in packages/process-daemon/src/service/windows.rs now polls every 25 ms instead of 10 ms (EXIT_POLL_INTERVAL).
    • Together these take an idle Windows daemon from ~100 to ~40 wakeups/s in the main loop, and the same for each live terminal.
  • Tradeoff: on Windows, a new connection or a terminal exit may now be noticed up to 25 ms later (it was 10 ms).
  • The README, the transport/mod.rs doc, and the code comments now say 25 ms.
  • Follow-up (the proper fix): have wait call WaitForMultipleObjects on the pending connect event plus a stop event, and have each terminal block in WaitForSingleObject on its process handle.
  • Windows test timing: every Windows test deadline is 3 s or longer, and the src/daemon/server.rs timing tests are Unix-only, so no test needed changing.

The commit applied unchanged after rebasing the stack onto dev (identical patch ID to the opencode-pty commit).

How did you verify your code works?

Port validation (macOS arm64, Rust 1.90.0, in packages/process-daemon), this is the stack tip:

  • cargo fmt --check and cargo clippy --locked --all-targets --all-features -- -D warnings pass.
  • The macOS CI test selection passes: cargo test --locked --lib --test service --test runtime --test ownership --test rows --test ghostty-effects (lib 65, ghostty-effects 5, ownership 8, rows 1, runtime 8 + 1 ignored, service 9).
  • The server module tests (cargo test --locked --lib daemon::server, 13 tests) passed 3 runs in a row.
  • Cross clippy with -D warnings passes for x86_64-pc-windows-msvc and x86_64-unknown-linux-gnu (--all-targets --all-features, ghostty-vt link libs stubbed). Native Windows and Linux rely on CI.

Screenshots / recordings

N/A, internal daemon change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@jlongster
jlongster requested a review from a team as a code owner October 27, 2026 19:55
@jlongster
jlongster force-pushed the daemon-windows-poll branch from bf8b850 to 327e9e5 Compare October 27, 2026 19:55
@jlongster
jlongster force-pushed the daemon-windows-poll branch from 327e9e5 to 8e0d424 Compare October 27, 2026 20:07
@jlongster
jlongster force-pushed the daemon-windows-poll branch from 8e0d424 to 4457371 Compare October 27, 2026 22:22
@jlongster
jlongster force-pushed the daemon-windows-poll branch from 4457371 to 99e3991 Compare October 27, 2026 22:33
@jlongster
jlongster force-pushed the daemon-windows-poll branch from 99e3991 to 170281b Compare October 28, 2026 00:52
Base automatically changed from daemon-poll-loop to dev October 28, 2026 01:09
@jlongster
jlongster force-pushed the daemon-windows-poll branch from 170281b to baa91d2 Compare October 28, 2026 01:11
@jlongster
jlongster merged commit 86ce19d into dev Oct 28, 2026
20 checks passed
@jlongster
jlongster deleted the daemon-windows-poll branch October 28, 2026 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant