Senator Tim Kaine quietly set his condition weeks ahead of the final vote: he demanded a “moratorium on mischief” from the Trump administration. He didn’t believe the White House would fully agree until the final hours before Sunday night’s nail-biter vote.

He told Senate Majority Leader John Thune the deal had to undo firings carried out by Donald Trump and budget director Russ Vought since the shutdown began, and guarantee job protections for federal workers—a critical constituency in Virginia.

“There was a lot of resistance but they needed my vote,” Kaine said of the Republican reaction, adding that negotiators “reached a meeting of the minds” around 5:45 p.m. Sunday.

About five hours later the Senate advanced legislation requiring any federal employees laid off during the shutdown be rehired and barring future reductions in force (RIFs) until at least the end of a new stopgap spending bill on January 30.

Even though much of the six-week bargaining focused on healthcare and expiring insurance subsidies, the RIF language was the final piece that didn’t just smooth the deal—it locked it in, according to six members of the bipartisan negotiating team.

With only eight Democratic senators voting to advance the bill—the smallest number needed—the satisfaction of Kaine’s condition was vital. It allowed Republicans to claim the deal largely on their terms, while Democrats got a tangible concession: some restraint on federal workforce shake-ups.

Kaine joined the talks late last week. Senators Jeanne Shaheen and Angus King started negotiations the first night of the shutdown, and the core group included Maggie Hassan, Susan Collins and Katie Britt. Shaheen said the RIF language had been on the table for weeks as something the White House might accept. Britt said the idea emerged as she, Collins, Shaheen and others explored ways to reopen the government.

Despite weeks of circling the framework, nothing broke through until late last week. Then, as Democrats’ post-Election Day optimism faded and the real-world toll of the shutdown amplified—unpaid federal workers, travel disruptions, missing food aid—momentum began to shift.

Kaine brought a proposal on Friday to Thune’s team and Collins. That set off 24-hour negotiations on the RIF issue over the weekend, including direct talks Sunday morning between Kaine and Britt. “I think I got off the phone at 12:30 a.m. [Sunday],” Britt said. “Susan Collins was up for an hour past that and then at 5 a.m. I started getting text messages about this. Tim Kaine and I talked a number of times, both on the phone and in person.”

While senators hammered out the RIF language, Collins and other appropriators locked down a separate layer of the deal: a three-bill funding package including veterans programs, food aid and agency funding, plus Congressional operating funds. Closing that piece helped restore enough trust for a broader breakthrough. “We worked night and day, literally,” Collins said after the measure passed. “It shows the Senate can work; we can produce the results that are needed.”

Behind the closed doors, Shaheen, King, and Hassan led efforts to persuade more Democratic senators that this was the best deal they were going to get. Minority Leader Chuck Schumer privately urged them to keep holding out, even as the negotiators were moving toward acceptance. But in the end, many believed the path forward was set. “This was the option on the table,” Shaheen said. She added that some colleagues who opposed the deal told her privately, “I’m so glad you did that, but I’m not going to vote with you.”

On the Republican side, Collins kept key lines open as she worked to close the appropriations and the stopgap bill to reopen the government. Collins had privately laid out a six-point plan that aligned closely with the final deal: pass the three-bill “minibus,” tee up full-year spending bills, guarantee back pay for furloughed employees, commit to an ACA vote, boost security funding for lawmakers, and pass a stopgap to reopen all agencies.

President Trump never directly engaged the Democrats after his unfruitful late-September meeting with top party leaders. But GOP senators, including Britt, made sure the White House was aligned with the ongoing negotiations. Britt said Vice President J D Vance, White House deputy chief of staff James Blair and legislative affairs director James Braid were key White House players in landing the agreement. Vance told her, “Whatever you need, just let me know.”

That communication proved vital in the final 48 hours as Britt, Kaine, and other senators locked in the RIF language. “Obviously the White House set the framework, and Senator Kaine knew what he needed to achieve,” Britt said, describing her role as “being a conduit … and trying to make sure nothing got lost in translation.”