UPDATE 10:10 P.M. EST: The House has passed a bill, 285-144, to reopen the government and raise the debt ceiling, averting economic calamity at the last minute. The bill now goes to President Obama.

The only votes against the bill came from Republican lawmakers, underscoring the unity of the Democratic caucus as the GOP splinters on a moderate-Tea Party divide.

UPDATE 8:31 P.M. EST: President Obama spoke briefly to commend congressional leadership on finding a solution to the fiscal impasse, and, pivoting to future debates, urged lawmakers to act more sensibly down the road.

"Hopefully next time it won't be in the eleventh hour," he said of the next deadline to raise the debt ceiling. "We've gotta get out of the habit of governing by crisis."

With the government on the verge of reopening, and the debt ceiling about to be raised, Obama also looked to the future, saying there was still much work to be done on immigration reform, a pending farm bill, and the nation's long-term budget priorities.

"There's a lot of work ahead of us," he said, "including our need to win back the trust of the American people."

UPDATE: 8:12 P.M EST: By a vote of 81-18, the Senate passed the bill to reopen the government and raise the debt ceiling, sending it on to the House.

Among the no votes were, as expected, a number of Tea Party-aligned Republicans, including Sens. Ted Cruz (Texas), Tim Scott (R-S.C.), Rand Paul (Ky.), and Marco Rubio (Fla.). You can find a full list of the nay votes here.

The House is expected to take up and pass the bill later tonight.

UPDATE: 7:26 P.M. EST: Senate Minority Leader Mitch McConnell (R-Ky.), who helped broker the compromise bill to avert the debt default, has snuck in a provision that will divert $3 billion to a Kentucky dam project, as BuzzFeed pointed out. It looks like McConnell at least got something for crafting a deal that will undoubtedly embolden businessman Matt Bevin, the primary challenger in his re-election campaign in 2014.

UPDATE: 7:21 P.M. EST: Sen. Ted Cruz (R-Texas), unsurprisingly, took to the Senate floor ahead of the vote to denounce the compromise legislation as "terrible" and say he would vote against it.

"It does absolutely nothing to provide relief to the millions of Americans who are hurting because of Obamacare," he said.

And, with his Republican colleagues prepared to pass the bill, he lashed out at Senate Republicans for "bombing our own troops" in the GOP-controlled House. No love lost there between Cruz and his Senate colleagues.

UPDATE: 3:45 P.M. EST: Speaker of the House John Boehner (R-Ohio) confirmed in a statement that he would bring the Senate plan up for a vote tonight. He said he expected the government to fully reopen tomorrow, Thursday.

His full statement:

The House has fought with everything it has to convince the president of the United States to engage in bipartisan negotiations aimed at addressing our country's debt and providing fairness for the American people under ObamaCare. That fight will continue. But blocking the bipartisan agreement reached today by the members of the Senate will not be a tactic for us. In addition to the risk of default, doing so would open the door for the Democratic majority in Washington to raise taxes again on the American people and undo the spending caps in the 2011 Budget Control Act without replacing them with better spending cuts. With our nation's economy still struggling under years of the president's policies, raising taxes is not a viable option. Our drive to stop the train wreck that is the president's health care law will continue. We will rely on aggressive oversight that highlights the law's massive flaws and smart, targeted strikes that split the legislative coalition the president has relied upon to force his health care law on the American people. [Speaker.gov]

Earlier in the day, Boehner told a local radio station Republicans had "fought the good fight, we just didn't win."

UPDATE: 1:18 P.M. EST: The White House praised Senate leaders for "working together" to reach an agreement today, but urged Congress to act "as soon as possible" to pass a proposal that would end the government shutdown and raise the debt limit before tomorrow's Oct. 17 deadline.

White House Press Secretary Jay Carney was sure, however, to remind Republicans just how unpopular this shutdown has been.

Carney: "There are no winners here. The American people paid a price for this."

UPDATE: 12:26 P.M. EST: Senate leaders have officially unveiled a deal that would reopen the government through January 15 and extend the debt ceiling until around February 7.

"The compromise we reached will provide the economy with the stability it desperately needs," said Senate Majority Leader Harry Reid (D-Nev.) on the Senate floor, calling Republican support "essential" to reaching a "historic bipartisan agreement."

Senate Minority Leader Mitch McConnell (R-Ky.) said he was "confident" that it would pass both in the Senate and the House later this afternoon.

It also looks like Sen. Ted Cruz (R-Texas) won't delay the bill as previously speculated.

JUST IN : Sen. Ted Cruz says he won't block a vote in Senate to end debt ceiling crisis. Speaking now on #CNN TV

House Speaker John Boehner (R-Ohio) has said that he will allow the bill to come up for a vote on the House floor.

UPDATE 11:28 A.M. EST: Right now, it's not clear who votes on a proposal first, although Politico reports that the House will take the lead and send a proposal to the Senate, even as Senate leaders get ready to make a public announcement about an agreement. Cruz, however, could still grind everything to a halt.

Sen. Ted Cruz refuses to say whether he is willing to hold up deal as he heads to meeting with Republicans

The House could make things go more smoothly if it sent the Senate a rewritten version of H.J. Res. 59, a bill that passed the House on September 30 tying funding the government to defunding ObamaCare. Once altered, the proposal "would be treated in the Senate as though it’s a tweak instead of a whole new piece of legislation," according to Bloomberg, giving people like Sen. Ted Cruz (R-Texas) "fewer opportunities to filibuster, or stall action on a bill."

Meanwhile, it looks like Senate leaders are close to finalizing their own bill.

#Breaking: Reid and McConnell will soon announce an agreement to reopen the government.

If the proposal passes the House first, it would allow the Senate to skip some of its procedural hurdles and bring the plan up for a full vote sooner. Boehner, it appears, is willing to take the hit from Tea Party conservatives and let a proposal pass with a coalition of Democrats and moderate Republicans.

ORIGINAL: With the debt ceiling expected to hit tomorrow, Senate leaders are working to finalize a deal that they hope could pass the House later today, ending the government shutdown and preventing the United States from defaulting on its debt obligations for the first time in history.

In the best-case scenario, Senate Majority Leader Harry Reid (D-Nev) and Senate Minority Leader Mitch McConnell (R-Ky.) would put the finishing touches on their plan, sell it to their respective caucuses when the Senate reconvenes at noon, and promptly send it to the House, where House Speaker John Boehner (R-Ohio) would let it come up for a vote this afternoon.

The Senate proposal would fund the government until January 15, extend the debt ceiling until around February 7, and create a committee that would be responsible for creating a detailed budget plan for the next decade by December 13. According to Politico, it would also require slightly more strict income verification standards for people requesting health-insurance subsidies under ObamaCare, and provide the Treasury Department more flexibility to pay the nation's bills if the country hits the debt ceiling again in the future.

Plenty of things could prevent a deal from getting done today. Sen. Ted Cruz (R-Texas) could delay a Senate deal by requesting 30 hours of debate. Even if it passed the Senate, Boehner would have to ignore the "Hastert Rule" and allow the proposal to go to the House floor for a vote, something that would almost certainly anger Tea Party Republicans.

Right now, however, there doesn't seem to be any other way to avoid default. Yesterday, House Republicans twice attempted to craft a counteroffer to a Senate proposal, only to watch both of them fall apart amid objections from conservatives.

The National Review's Robert Costa reports that House Republicans have pretty much given up on passing their own proposal, and are now waiting for the Senate to act.

Focus is really on the Sen. No GOP conf mtg scheduled. "What'd we even discuss? Another plan that can't get votes?" says a House R