Repository navigation
refactor(process-daemon): route stop and ownership through Control - #59700
Merged
Merged
Conversation
This was referenced Oct 27, 2026
jlongster
force-pushed
the
daemon-handler-spawn
branch
from
October 27, 2026 19:55
ffc9c85 to
49f2388
Compare
jlongster
force-pushed
the
daemon-control
branch
from
October 27, 2026 19:55
a1ce868 to
aeeb1e2
Compare
jlongster
force-pushed
the
daemon-handler-spawn
branch
from
October 27, 2026 20:07
49f2388 to
6b21f80
Compare
jlongster
force-pushed
the
daemon-control
branch
from
October 27, 2026 20:07
aeeb1e2 to
b3c1e19
Compare
jlongster
force-pushed
the
daemon-handler-spawn
branch
from
October 27, 2026 22:21
6b21f80 to
6fac8bd
Compare
jlongster
force-pushed
the
daemon-control
branch
from
October 27, 2026 22:21
b3c1e19 to
689be3e
Compare
3 of 6 tasks
jlongster
force-pushed
the
daemon-control
branch
from
October 27, 2026 22:33
689be3e to
20dd8f4
Compare
alsuren
pushed a commit
to alsuren/opencode
that referenced
this pull request
Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ported from anomalyco/opencode-pty#30. Part of the stack for anomalyco/opencode-pty#25. Builds directly on
dev; no prerequisite.Issue for this PR
Related to anomalyco/opencode-pty#25
Type of change
What does this PR do?
daemon::Control(packages/process-daemon/src/daemon/control.rs) holds a private stop flag and the ownership mutex, and is now the only way to stop the daemon or mutate ownership.request_stoptakes the ownership lock, so the next PR can wake the accept loop under that same lock.runis split into bind →Control→serve. Ownership is still created after bind, as before.doneflag set by a drop guard in the handler thread (the reap check still also acceptsis_finished()). The next PR adds a wake there.Ownership::with_timeoutslets tests use short starting/handoff deadlines.packages/process-daemon/src/daemon/server.rs, using aTestDaemonfixture that runsserveon a temp socket:shutdown_request_stops_immediatelyowner_shutdown_stops_immediatelyowner_disconnect_without_handoff_stops_immediatelystarting_deadline_fires_on_timewaiting_deadline_fires_on_timehandoff_claim_transfers_without_spurious_stopPorted from the opencode-pty commit; the only difference is that connection handlers are spawned with plain
thread::spawn, as ondev.How did you verify your code works?
packages/process-daemon):cargo fmt --check,cargo clippy --locked --all-targets --all-features -- -D warnings, andcargo test --locked --lib(53 passed) pass.daemon-windows-poll) the full macOS CI test selection and Windows/Linux cross clippy also pass.cargo test --locked --lib --test service --test runtime --test ownership --test rows --test ghostty-effects(lib 47, ghostty-effects 5, ownership 8, rows 1, runtime 8 + 1 ignored, service 9), and cross clippy with-D warningspassed forx86_64-pc-windows-msvcandx86_64-unknown-linux-gnu(--all-targets --all-features, ghostty-vt link libs stubbed). Windows and Linux tests rely on CI.Screenshots / recordings
N/A, internal daemon change.
Checklist