Skip to content

fix(daemon): wait for readiness instead of polling - #31

Closed
jlongster wants to merge 1 commit into
daemon-controlfrom
poll-loop
Closed

jlongster wants to merge 1 commit into
daemon-controlfrom
poll-loop

Conversation

@jlongster

@jlongster jlongster commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Measurement (macOS, debug builds, idle owned daemon)

Before After
Context switches 96.9/s 1.0/s
Ping round trip 11.6 ms 0.19 ms
Owner close → daemon exit 18.9 ms 3.4 ms

Tests added

  • src/daemon/server.rs:
    • owned_handoff_expiry_keeps_daemon
    • idle_loop_does_not_spin
    • connect_does_not_wait_for_timeout
    • handler_completion_closes_socket_promptly
    • missed_wake_is_detected
    • missed_disconnect_is_detected
    • notify_storm_is_not_missed
  • src/ownership.rs: deadline_tracks_each_state
  • src/transport/unix.rs:
    • wake_is_cloexec_and_nonblocking
    • wake_notify_never_blocks_and_drain_empties
    • listener_wait_reports_each_source
    • listener_wait_rounds_timeout_up

Mutation checks

  • Removing the handler-completion (Done) notify fails handler_completion_closes_socket_promptly.
  • Removing the update_ownership notify fails owned_handoff_expiry_keeps_daemon.
  • Making tick notify fails idle_loop_does_not_spin, missed_wake_is_detected, and missed_disconnect_is_detected.

Flakiness runs

  • Server module ×10, full lib ×10, concurrent ×5, single-threaded ×3. All passed.

Validation

  • cargo fmt --check and cargo clippy --locked --all-targets --all-features -- -D warnings pass (toolchain 1.90.0).
  • The macOS CI test selection passes: cargo test --locked --lib --test service --test runtime --test ownership --test rows --test ghostty-effects (lib 59, ghostty-effects 5, ownership 8, rows 1, runtime 8 + 1 ignored, service 9).
  • 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 are verified by CI.

@jlongster

Copy link
Copy Markdown
Collaborator Author

This moved to the monorepo as anomalyco/opencode#59701 (merged) and was released in @opencode/pty 0.3.3.

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