(CNN) - A tentative border security deal has been agreed to on Capitol Hill, but there is still more work to be done in Washington before a partial government shutdown can be averted -- and there are plenty of opportunities along the way for a deal to be derailed.
Lawmakers are racing against the clock to pass a deal that can be signed into law before midnight on Friday night, when funding will expire for parts of the federal government.
One Democratic aide told CNN on Monday that there is still "a ton of work to do once they have an agreement reached" to ready any legislation to be taken up on the floor of both chambers.
Here's what needs to happen now:
1. House expected to vote after bill text released
Top-line details from the tentative agreement emerged on Monday night, including that the deal is slated to provide $1.375 billion for barrier funding that will cover roughly 55 miles of new barrier.
But the full legislative text has not yet been released and that will need to happen ahead of any votes in the House.
As of Wednesday morning, the legislative text had not been completed yet, according to a Democratic aide involved in the negotiations.
It is likely to be completed and released some time on Wednesday.
House Majority Leader Steny Hoyer said on Wednesday that the House is likely to pass the bill on Thursday evening.
"We hope to pass it by tomorrow night," he said.
Typically, the House has a 72-hour wait period before voting on legislation after it is filed, a rule intended to give lawmakers time to review bill text before voting on it. That rule applies to legislation that is not being taken up under a suspension of the rules, but it can be waived in emergency situations to speed consideration of legislation and a looming shutdown could be deemed one such situation.
A House Democratic aide told CNN that it is "likely" that lawmakers may need to try to waive the 72-hour rule ahead of Friday's midnight deadline.
The deal will undoubtedly be deemed unacceptable by some of the chamber's most conservative and most liberal members. GOP Rep. Jim Jordan of Ohio, a co-founder of the conservative House Freedom Caucus, called it a "bad deal" on Monday, while GOP Rep. Mark Meadows of North Carolina, the current chair of the Freedom Caucus, said it was "hardly a serious attempt to secure our border or stop the flow of illegal immigration."
But there is little appetite for another shutdown on Capitol Hill among Democrats and Republicans in both the House and Senate. The expectation for now is that the House, which is controlled by a Democratic majority, will have the votes needed to pass the deal.
2. Senate expected to vote after the House takes up the measure
The Senate could move fairly quickly once the House has voted as long as there are no senators who act to slow down the process.
Senate Majority Leader Mitch McConnell said on Tuesday in remarks on the Senate floor, "I look forward to reviewing the full text as soon as possible and hope the Senate can act on this legislation in short order."
If the Kentucky Republican is able to get unanimous consent to move forward with the bill -- meaning that no senator raises any objection -- passage could come quickly.
If that is not possible due to objections, however, the process of bringing the measure to a vote would take longer to unfold. McConnell could still move to break a filibuster, however, by filing for cloture. That would then be subject to a 60-vote threshold.
If some unforeseen complication jeopardizes the timeline for passage, congressional leaders could also opt to fall back on a stopgap spending bill to keep the government open while they continue to work on final passage of a longer-term deal.
3. After passing Congress, the legislation would head to Trump for signature
The central factor that has injected uncertainty into efforts to avert a shutdown is the question of what the President will accept and if he will sign off on a final deal even if it does not include $5.7 billion in border wall funding.
It now looks like he will. President Donald Trump intends to sign the border security deal to avoid another partial government shutdown, according to two sources who have spoken directly with the President.
But there is still a caveat to that: Nothing is final until the President actually signs a deal. Back in December, Republicans and Democrats on the Hill believed the President would sign legislation to avert a shutdown, but at the last minute he came out against a bill that did not meet his demand for border wall funding, triggering a shutdown.
On Tuesday, Trump expressed distaste for the tentative deal, saying during a Cabinet meeting, "I have to study it. I'm not happy about it. It's not doing the trick."
But he also said he does not think it's likely the government will shut down again after Friday. "I don't think you're going to see a shutdown," Trump said.
Republican Sen. John Cornyn of Texas told CNN on Tuesday of the President's reaction to the deal, "I don't think it's everything that he had hoped for."
"He is not ecstatic over the deal but I do think he's reviewing his options," Cornyn said, adding, "I flew back with him last night. He didn't make any declarative statements about what his intentions are but obviously it's a compromise, and with compromises everybody's a little bit unhappy."
Later Tuesday, the President tweeted a more positive message:
"Was just presented the concept and parameters of the Border Security Deal by hard working Senator Richard Shelby. Looking over all aspects knowing that this will be hooked up with lots of money from other sources.... Will be getting almost $23 BILLION for Border Security. Regardless of Wall money, it is being built as we speak!"
This story has been updated with additional developments Wednesday.
The-CNN-Wire ™ & © 2019 Cable News Network, Inc., a Time Warner Company. All rights reserved.