Senate leaders have a bipartisan funding deal in hand but it remains to be seen whether they will avert a costly government shutdown as the clock ticks down toward Friday’s midnight deadline.