Skip to main content

run_fresh

Function run_fresh 

Source
pub async fn run_fresh<F, S, O>(
    ctx: &RunContext<'_, F, S, O>,
    task: &TaskId,
    project: &Project,
    task_def: &Task,
    key: &CacheKey,
    created_at_unix: u64,
) -> Result<CompletedRecord, RunTaskError>
Expand description

Cache-miss branch (EXEC-007 step 3, compatible mutex path): spawn the task’s command, capture both streams, classify per EXEC-009, and on success persist the run to the cache.

Reader futures run concurrently with process.wait() so a child that fills its stdout/stderr pipe buffer never blocks waiting for the parent to drain (the classic pipe-deadlock shape). Stream hashes are computed under RunContext::algo from the captured byte buffers (CACHE-011 corollary for fresh runs).

Per MUTEX-006, the caller MUST acquire the task’s mutex before invoking this function and MUST release it after the returned future resolves (regardless of success or failure). This function does not consult any hold set itself.

Does NOT fire RunObserver::on_task_started or RunObserver::on_task_finished; the caller drives the observer lifecycle.

§Errors