WASHINGTON — The U.S. Senate is expected to take up a bipartisan two-year spending agreement that hands a massive boost to the Pentagon, but its path through the House was cloudy Thursday.

The upper chamber is likely to pass the $2.6 trillion, two-year deal unveiled Wednesday by Senate leaders after months of partisan wrangling. That agreement includes a $148 billion boost for the Pentagon over two years.

The two-year deal would lift Budget Control Act caps established for defense by $165 billion and non-defense by $131 billion. Those caps would be lifted to $629 billion and $647 billion respectively, to accommodate the Pentagon’s base budget. The difference would be made up in cap-exempt Overseas Contingency Operations funding, which would not rise.

The deal would raise total discretionary defense spending from $634 billion in fiscal 2017 to $700 billion in fiscal 2018 and $716 in fiscal 2019.

Non-defense totals would rise from $539 billion in fiscal 2017 to $591 billion in fiscal 2018 and $605 billion in fiscal 2019, with some $20 billion in OCO spread over two years. Reportedly, the agreement also includes another $90 billion in disaster relief.

The deal would also avert the immediate threat of a government shutdown when the most recent funding patch expires at midnight Thursday. It includes a six-week continuing resolution that would allow appropriators to draft a more detailed omnibus appropriations bill.

Senate Majority Leader Mitch McConnell, R-Ky., said Thursday that Republicans were close to another Republican victory, after passing tax reform — one that would “start rebuilding our military.” McConnell detailed military readiness problems, global threats and Congress’s reliance on short-term funding measures.

“No, we have not asked our all-volunteer military to do any less for our country. They’ve just been forced to make do with less,” McConnell said.

In the House, conservative opposition is forcing Republican leaders to rely on Democratic votes. However, House Speaker Nancy Pelosi’s demands on immigration have clouded the question of whether enough Democrats support the bill.

While Pelosi was voting “no,” she signaled she was not pressing her caucus to vote with her. ”I’m just telling people why I’m voting the way I’m voting,” she told reporters Thursday.

The conservative House Freedom Caucus released a statement in opposition.

“The House Freedom Caucus opposes the deal to raise spending caps on discretionary spending by nearly $300 billion over two years. We support funding for our military, but growing the size of government by 13 percent adds to the swamp instead of draining it. This is not what the American people sent us here to do,” the group said.

At a Thursday morning press conference, House Speaker Paul Ryan, R-Wis., stood beside House Armed Services Committee Chairman Mac Thornberry, R-Texas., and other HASC members to lean on Democrats and fiscal conservatives to support the deal.

Echoing military training fatality statistics Thornberry had used a day earlier to tout the need for defense increase, Ryan said: “This is why we cannot allow anyone to politicize our military or use our troops as bargaining chips. The stakes are just two high for this.”

While the devil is in the details, Ryan also pledged to bring immigration reform to the floor, akin to what Pelosi had sought in exchange for her support.

Thornberry and Senate Armed Services Committee Chairman John McCain, R-Ariz., have endorsed the agreement.

“Fixing the military is the dominant priority,” Thornberry said. “We owe it to the men and women who are risking their lives for us, to give them the best equipment, training and support that this nation can provide. This agreement begins to do that for the first time in a long time.”