Expand description
The subagent side of the control channel.
Entered when main sees AGENT_SUBAGENT set. The child, in order:
- installs
PR_SET_PDEATHSIGso a supervisor death collapses it. This must happen here rather than inpre_exec, becauseexecveclears the setting; - 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 or model call; - 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.