whereIn('status', [Status::Running, Status::Pending]) ->where('updated_at', '<=', now()->subHour()) ->update([ 'status' => Status::Failed, 'error' => ['reason' => 'stuck'], 'finished_at' => now(), ]); $this->info("Recovered {$count} stuck automation runs."); return self::SUCCESS; } }