pub async fn handle_error(
task_id: &str,
agent_err: &AgentError,
agent_name: &str,
agent_runner: &dyn AgentRunner,
model_name: Option<&str>,
complexity: Option<&str>,
new_attempts: u32,
store: &Option<Arc<TaskStore>>,
repo: &str,
) -> Result<ErrorHandleResult>Expand description
Handle an agent error: classify it, attempt recovery strategies, and update store.
Returns Ok(ErrorHandleResult::EarlyReturn) when the task was rerouted and
run() should record metrics and return immediately (skipping tmux cleanup).
Returns Ok(ErrorHandleResult::Continue) when run() should proceed to cleanup.