Expand description
Spawning a subagent process.
A subagent is the same binary re-exec’d with AGENT_SUBAGENT set, so
the one artifact is CLI, supervisor, and subagent. Each child is put in its
own process group (setpgid in pre_exec) so the kill ladder can
killpg a whole subtree in one call, including grandchildren the subagent
forked itself. The supervisor delivers the SpawnPayload as the first
control frame; the child’s upward AgentMsgs are read on a dedicated
thread and forwarded — tagged with the child’s NodeId — onto the
reactor’s single merged channel, which is what lets the reactor stay
single-threaded no matter how many children are live.
Teardown is reap-safe: once the reactor has reaped a child via
waitpid(-1) it calls Subagent::mark_reaped, so Drop will not signal
a possibly-reused pid.
Structs§
- Subagent
- A handle to a running subagent process and the down side of its control channel. Upward messages arrive on the reactor’s merged channel, not here.
Functions§
- spawn
- Spawn a subagent that re-execs
exe(normallystd::env::current_exe()), deliveringpayload. Upward messages are handed toeventstagged withnode.
Type Aliases§
- Frame
Sink - Where a child’s upward frames land. The reader thread calls this for every
frame, directly into the queue the consumer drains — no intermediate
hop, because ordering with other producers (the reap path) is established
by joining the reader, and a hop thread would break that happens-before.
Return
falsewhen the consumer is gone (stops the reader).