Expand description
The subagent side of the control channel. RFC 0005, RFC 0003, RFC 0009.
Entered when main sees AGENT_SUBAGENT set. The child:
- installs
PR_SET_PDEATHSIGso a supervisor death collapses it (must be here —pre_exec’s setting is cleared byexecve); - reads its
SpawnPayload(first control frame) from stdin; - starts a control reader thread (separate from the agentic loop) that
answers
PingwithPongand flips a cancel flag onCancel— so liveness survives a long in-flight tool/model call (Detector C); - emits
Ready, connects intelligence + its scoped MCP servers, runsagentloop::run_loop, and sendsResult/Failedback up.
Wire: stdout carries length-framed AgentMsg up; stderr carries the
child’s JSON telemetry (inherited to the parent). stdin carries
ControlMsg down.
Functions§
- run
- The subagent entry point. Returns the process exit code.