Washington • The head is missing, but the body is still alive.

The president killed off all attempts at compromise, then went dark after the government shut down, refusing to say what he would support on immigration or even to engage in negotiations. But in this leadership vacuum, something remarkable happened: Twenty-five senators, from both parties, rediscovered their role as lawmakers. They crafted a deal over the weekend that offers a possible path forward, and, in dramatic fashion on the Senate floor Monday, signaled the end of the shutdown with a lopsided 81-18 vote.

The agreement may not end in a long-sought immigration deal and a long-term spending plan. Trump could yet kill any deals they reach. And liberal interest groups are furious at what they see as a Democratic surrender. But Monday’s breakthrough shows there is at least the potential for lawmakers to take the wheel from an erratic and dangerous driver.

Senate Minority Leader Chuck Schumer, announcing his deal with Senate Majority Leader Mitch McConnell on the Senate floor Monday afternoon, said he hadn’t even heard from Trump since Friday, before the government closed. “The White House refused to engage in negotiations over the weekend. The great dealmaking president sat on the sidelines,” Schumer said, adding that he reached agreement with McConnell “despite and because of this frustration.”

Looking down from the gallery Monday afternoon, I saw the sort of scene rarely observed any longer in the Capitol: bipartisan camaraderie. Sens. Chris Coons, D-Del., and Susan Collins, R-Maine, two architects of the compromise, were talking, when McConnell, with a chipper “Hey, Chris,” beckoned him for a talk with Sen. Lamar Alexander, R-Tenn., who soon broke off for a word with Sen. Joe Manchin, D-W.Va. During the vote, Manchin sat on the Republican side with Sen. Shelley Moore Capito, R-W.Va., and Sen. Sheldon Whitehouse, D-R.I., sat with Sen. Lindsey Graham, R-S.C. Sen. Mike Rounds, R-S.D., hobnobbed with Coons and Sen. Tim Kaine, D-Va. Sen. Roy Blunt, R-Mo., put an arm around Sen. Dick Durbin, D-Ill., as he chatted with Sens. Debbie Stabenow, D-Mich., and Jeanne Shaheen, D-N.H.

Durbin marveled at the festival of bonhomie. “What I have seen here on the floor of the Senate in the last few days is something we have not seen for years,” he said.

Neither side particularly wanted this shutdown. It was the work of a disengaged president who contributed only mixed signals, confusion and sabotage. After provoking the shutdown by killing a bipartisan compromise to provide legal protection for the “dreamers” (undocumented immigrants who came as children), Trump’s political arm put up a TV ad exploiting the dreamers by saying “Democrats who stand in our way will be complicit in every murder committed by illegal immigrants.”

Trump’s anti-immigrant ad and his racist outburst in the White House a couple of weeks ago will only increase Republicans’ long-term political problems, but, in the short term, Republicans succeeded in portraying Democrats as shutting down the government to protect illegal immigrants. And liberal interest groups took the bait. In a conference call just before news of the deal broke Monday morning, a broad array of progressive groups — Planned Parenthood, labor unions, the Human Rights Campaign, the ACLU, MoveOn and Indivisible — joined immigration activists in demanding Democrats refuse to allow the government to reopen without an immediate deal for the dreamers.

Later, after the compromise was announced, they were enraged: “This deal is a kick in the stomach,” tweeted MoveOn Washington Director Ben Wikler.

The fury will be forgotten, of course, if Congress comes up with an immigration deal by the Feb. 8 deadline McConnell promised. And Republican senators are showing signs that they are willing to chart a different course from their capricious leader.

“What has been difficult is dealing with the White House and not knowing where the president is,” Sen. Jeff Flake, R-Ariz., told reporters Monday. “I don’t think it will change.”

The number of ideological moderates in the Senate can be counted on one hand, but the 25 who hatched the compromise were the temperamental moderates. And, for once, moderation prevailed.

Before Monday’s vote, the two caucuses huddled separately. But on the floor after Monday’s vote, they were as one: Durbin gave Collins a thumbs up and Schumer warmly clasped her hand. Graham had a friendly chat with McConnell, then a similar one with Schumer. “Sue! Sue!” called out Manchin, spying Collins, who was at the moment holding hands with Sen. Cory Gardner, R-Colo., and talking with Sen. Amy Klobuchar, D-Minn.

How long will this last? It may be over already. But at least they still know how.

Dana Milbank