With Trump’s acquiescence to the Democrats’ fiscal demands, their chances of winning a DACA fix have also improved. Schumer and Pelosi specifically wanted only a short-term increase in the debt ceiling because it gives Democrats additional leverage to demand concessions during the next round of spending fights in December, when Congress will be under pressure to make a big year-end agreement before lawmakers go home for the holidays. Republicans know they can’t pass an increase in the debt ceiling without Democratic votes, and the more frequently they have to do it, the more bargaining power Pelosi and Schumer have.

“Both sides have every intention of avoiding default in December and look forward to working together on the many issues before us,” the two Democrats said in a joint statement after the White House meeting. Then they hinted that a DACA fix was next on their list of priorities: “As Democratic leaders, we also made it clear that we strongly believe the DREAM Act must come to the floor and pass as soon as possible and we will not rest until we get this done.”

Trump’s deal with Democrats was a particular humiliation for Ryan, who just hours earlier—and perhaps unbeknownst to the president—had denounced as “ridiculous” and “disgraceful” the exact terms that comprised the agreement. “I think that’s a ridiculous idea. I hope they don’t mean that,” the speaker told reporters when he was asked about the proposal from Pelosi and Schumer to tie a short-term debt-limit increase to the Harvey relief money. “I think it’s ridiculous and disgraceful that they want to play politics with the debt ceiling at this moment when we have fellow citizens in need.”

In the White House meeting, every Republican in the room but Trump—Ryan, McConnell, House Majority Leader Kevin McCarthy, and Treasury Secretary Steven Mnuchin—opposed the Democratic plan, according to multiple people briefed on the discussion. The Republicans first proposed an 18-month extension of the debt limit, which would mean Congress wouldn’t have to vote again on the issue until after the 2018 midterm elections. Then they floated a six-month extension. But when the negotiation came to a standstill and it became clear neither side would budge, Trump sided with Democrats and backed a three-month extension both of federal spending and the debt ceiling.

Another aide briefed on the meeting said that toward its conclusion, Ivanka Trump entered the room to say hello to the leaders and the discussion veered off-track. “Republican leaders were visibly annoyed by Ivanka’s presence,” the aide said. (A Ryan spokeswoman replied: “That’s not true.”)

The agreement must still pass the House and Senate, and although most Democrats will likely vote for it, Republican support could be tough to come by, and blowback from conservatives could be intense. “The Pelosi-Schumer-Trump deal is bad,” Senator Ben Sasse of Nebraska tweeted in one early review.