Expand description
Spawning a subagent process. RFC 0009 §re-exec, RFC 0003 §process-group.
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 (RFC 0003). 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
(RFC 0002 §reactor).
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 forwarded toeventstagged withnode.