Skip to main content

spawn_throwaway_turn

Function spawn_throwaway_turn 

Source
async fn spawn_throwaway_turn(
    deps: &AgentTurnDeps,
    mstore: &Arc<Store>,
    boot_id: &Arc<str>,
    source_block_id: &str,
    prompt: String,
) -> Result<(String, BtwProvider), String>
Expand description

Create the throwaway block and drive it through run_agent_turn. Returns the throwaway block id on success — including when run_agent_turn itself fails after the block was created (the block + controller still exist and get cleaned up normally; drain_and_publish’s own not-running-with-nothing-published fallback surfaces that failure, and in the common failure case — the identity/OAuth spawn gate — the block’s own output file already carries a translatable error result frame, so the real message reaches the frontend either way). Only returns Err when nothing was ever created (source block missing, insert failed) — there is then genuinely nothing to poll or clean up.