Skip to main content

Module host_spawn

Module host_spawn 

Source
Expand description

Host-subprocess turn spawn (spawn_turn) for SubprocessController.

Runs the agent CLI as a std::process child (via tokio::process) and writes the turn message to its stdin. spawn_turn reads in order: queue the message if a turn is running, build the argv, claim the session lease (claim_turn_lease), start the process, write the prompt (write_prompt_and_close_stdin), then hand the running turn to its background tasks: spawn_stdout_reader, spawn_stderr_reader, spawn_lease_renewal and spawn_process_waiter, which closes the turn (TurnEnd: wait for exit or kill, classify a failure, report the end, release the lease and run lock, drain the queued-message backlog). See container_spawn for the Docker-exec analog used by container agents.