Skip to content

0.1.12: nagoya::process, and a local-reactor timer wake fix - #15

Merged
pathscale merged 3 commits into
masterfrom
feat/process
Sep 23, 2026
Merged

pathscale merged 3 commits into
masterfrom
feat/process

Conversation

@pathscale

Copy link
Copy Markdown
Owner

Releases 0.1.12. Two changes:

  • nagoya::process (new process feature): Command, Child, and ChildStdin/ChildStdout/ChildStderr, spelled the way tokio spells them. The pipes are futures-io AsyncWrite/AsyncRead. Pipes are non-blocking on one process-wide reactor that is never dropped, so the futures run under any executor. Exit is an event, not a poll: a per-child kqueue with EVFILT_PROC/NOTE_EXIT on macOS and the BSDs (registered as readable on the reactor), and pidfd_open on Linux, with a waitid(WNOWAIT) thread only where pidfd is unavailable. wait is cancel safe, and a child dropped unreaped is reaped by the reactor instead of being left as a zombie. This is what lets agent-abstraction, and through it agency-proxy, drop tokio.
  • Wake a local reactor whose own timer fired before its kernel wait (the commit already on the local feat/resolve branch, carried here). nagoya::timeout under block_on_with could hang for good: a due timer fired inside poll_once woke a waker that skipped its syscall, and the reactor then blocked with nothing left to wake it. Has its own regression test.

Checked locally:

  • cargo test --features process --test process: 12 pass in 0.21s. Covers echo to EOF, cat round trip, false under a foreign executor, output() of both streams, prompt kill, kill_on_drop reaps, a dropped wait can be waited again, 16 children at once, write-after-close is an error, and a missing program is NotFound.
  • cargo test --all-features: all 13 suites pass.
  • cargo clippy --all-features --all-targets -D warnings and cargo fmt --check are clean.

The Linux pidfd path compiles only on Linux, so CI's Linux run is the first to build it.

meh added 3 commits September 23, 2026 20:21
When the reactor fired a due timer itself inside poll_once, the waker saw
it was inside the wait and skipped the syscall; the timer heap was then
empty, so the reactor blocked in kevent with no timeout and nothing left
to wake it. nagoya::timeout under block_on_with hung for good. A timer
that woke a waker now makes that wait non-blocking. The regression test
drives the race deterministically and fails in 5 s without the fix.
0.1.12.
agent-abstraction spawns the provider CLIs with tokio::process, which is the
last thing holding tokio in agency-proxy. This is the same surface, spelled
the way tokio spells it: Command, Child, and ChildStdin/Stdout/Stderr as
futures-io AsyncWrite/AsyncRead, behind a `process` feature.

Pipes are non-blocking and registered on one process-wide reactor that is
never dropped, so the futures run under any executor. Exit is an event, not a
poll: a per-child kqueue holding EVFILT_PROC/NOTE_EXIT on macOS and the BSDs,
registered as readable on the reactor, and pidfd_open on Linux, with a waitid
WNOWAIT thread only where pidfd is unavailable. wait is cancel safe, and a
child dropped unreaped is reaped by the reactor rather than left a zombie.
nagoya::process started a process-wide reactor on first spawn and kept it in
a OnceLock for the life of the process. That is hidden global state and a
thread nobody asked for, created at whatever moment the first child happens
to be spawned; nagoya refuses exactly that elsewhere, and an application that
must register its signals before any thread exists (a Linux signalfd) could
not guarantee it. spawn, output and status take the Handle to register on, as
a socket in net does. The caller owns the Reactor and its lifetime, and every
test starts its own.

Also adds process_group, which agent-abstraction needs so that killing a run
reaches the processes the agent started.
@pathscale
pathscale merged commit cac152e into master Sep 23, 2026
2 of 3 checks passed
@pathscale
pathscale deleted the feat/process branch September 23, 2026 14:04
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