Hmbown/CodeWhale · error · anyhow::Error

Automation run has no durable task binding

Error message

Automation run has no durable task binding

What it means

Dispatch recovery guard: an automation run reached execution without a durable task binding, so the runtime cannot validate or resume the run's bound task and refuses the dispatch rather than starting an untracked task.

Solutions

  1. Recover or re-create the task binding for the run before dispatching.
  2. If the run record is corrupt, re-register the automation so dispatch.request and task_id are persisted together.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/tui/src/automation_manager.rs:2147 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/ceb08d2516f345a0. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/automation_manager.rs:2147

            .recover_task_admission(dispatch.request.clone(), task_id.to_owned())
            .await?
    };
    crate::task_manager::validate_bound_task_request(&task, &dispatch.request)?;
    dispatch.accepted = true;
    dispatch.suppress_report = dispatch.delivery_mode == AutomationDeliveryMode::Watcher
        && task.status == TaskStatus::Completed
        && task
            .result_summary
            .as_deref()
            .is_some_and(|summary| summary.trim() == AUTOMATION_WATCHER_NO_REPORT_SENTINEL);
    Ok(task)
}

/// Caller owns dispatch.lock and has already persisted this exact binding.
async fn enqueue_run_task(run: &mut AutomationRunRecord, tasks: &SharedTaskManager) {
    let result = match (&mut run.dispatch, &run.task_id) {
        (Some(dispatch), Some(task_id)) => dispatch_bound_task(dispatch, task_id, tasks).await,
        _ => Err(anyhow::anyhow!(
            "Automation run has no durable task binding"
        )),
    };
    match result {
        Ok(task) => {
            run.error = None;
            apply_task_status(run, &task);
        }
        Err(error) => {
            // Keep the same pending identity after uncertain admission. A later
            // tick first looks for its canonical task; no new id is allocated.
            run.error = Some(format!(
                "Automation task admission needs recovery: {error:#}"
            ));
        }
    }
}

View on GitHub (pinned to 73e0f67d83)