Skip to main content

run_child_spawn

Function run_child_spawn 

Source
pub async fn run_child_spawn(
    ctx: SpawnContext,
    job: SpawnJob,
) -> Result<(), String>
Expand description

Launch a single child spawn job.

This sets up the child run and spawns the actual execution onto a background task, returning Ok(()) once the run has been started — not when it completes. Completion (and persistence finalize) is observed via the SubAgentCompleted event on the parent stream, not via this return value. Err is only returned for synchronous setup failures (e.g. child session not found) before the background task is spawned.

Preserves EXACTLY the canonical behavior:

  • SubAgentStarted is emitted by the adapter before enqueue (not here).
  • Event forwarder + 5s heartbeat tasks, watchdog, runner reservation.
  • Full real [ExecuteRequest] field set incl. split provider fields.
  • Terminal status strings completed | cancelled | error | skipped | timeout.