It’s weeks late, and talks came perilously close to breaking down, but Congress is likely to pass a series of compromise reforms for the U.S. Department of Veterans Affairs later this week.

The probable passage is a promising sign for those hoping that congressional lawmakers might, for the right cause, be able to make concessions with the opposing party for the good of the country.

On Monday afternoon, Sen. Bernie Sanders (I-VT) and Rep. Jeff Miller (R-FL), the chairmen of their chambers’ respective veterans’ committees, announced a $17 billion compromise bill to fix widespread problems at the VA. The bill includes some $12 billion of “emergency spending,” which will add to the federal deficit, with the remainder being paid for with cuts in other VA programs.

The bill would allow veterans to seek medical care outside the VA system if they live far from a VA facility or if they cannot get an appointment within a certain number of days. Other measures would fund additional doctors and construction for VA facilities, new building leases, and an extension of a treatment program for veterans with traumatic brain injuries; and allow veterans to qualify for in-state tuition under the post-9/11 GI Bill no matter where they choose to locate.

The agreement was reached just days after negotiations between the House and Senate appeared on the verge of falling apart. Sen. John McCain (R-AZ) revealed that the compromise even faced a potential derailment Monday morning, just hours before it was set to be unveiled. “We had some very spirited conversations, and I mentioned I would condemn everybody if we couldn’t get an agreement,” he said.

Behind-the-scenes discussions over the weekend and on Monday proved fruitful, and congressional observers predict that the way ahead will be smooth.

“I have no doubt whatsoever that it’s going to be allowed to come to the [House] floor and pass,” said Alexander Nicholson, the legislative director of Iraq and Afghanistan Veterans of America, adding that he “would not be surprised if there were unanimity in the Senate.”The votes in the week ahead will prove a testament to the ability of both the House and Senate to come to a mutual agreement when an important issue is on the line. The bill has less money than an original proposal Sanders had floated but requires Republicans who are hawks on the budget deficit to make a tradeoff.Veterans’ advocacy groups, even those that lean conservative, lined up quickly behind the bill.“We’re not too thrilled with the cost aspect of it,” said Dan Caldwell, the issue and legislative campaign manager for Concerned Veterans for America, a deficit-conscious veterans’ group. But he said that while his colleagues would not support additional spending, they thought the bill included “very important reforms that lay the groundwork…for transforming the VA” and was ultimately worth supporting.“We don’t like to see the VA get blank checks, and we don’t think it is,” Caldwell added.Miller, chairman of the House Committee on Veterans’ Affairs, said he recognized that his Republican colleagues would need some convincing.“I come from a sales background before I came to Congress,” he said. “We will be able to sell it to our conference. We will probably not get a unanimous vote…There will be an education process that will have to take place, and obviously some of our members will need a little more educating than others.”But it was difficult to find a House Republican who wasn’t already behind the VA reform plan. Rep. Jason Chaffetz, a conservative Republican from Utah, said the compromise “looks pretty good…I don’t have a problem spending money on veterans. These veterans have sacrificed everything. We’re going to step up and spend what it takes to take care of them.”Rep. Ann Wagner (R-MO) called the bill a “strong compromise,” saying that while the deficit was on her mind, “our VA system is absolutely broken, these are our American heroes, they deserve to be taken care of, and we have to get to the bottom of this.”In the Senate, Sen. Lindsey Graham (R-SC) said he was concerned about the federal deficit, “but veterans dying concerns me more.” Added McCain, a Graham ally: “This qualifies as an emergency. There are provisions for emergency spending. When 50 people in my state are dying, 50 veterans, that’s an emergency.”But while lawmakers vocally opposed to the deal were scarce, it faced some criticism in the think tank world.Michael Tanner, a senior fellow at the libertarian Cato Institute and an Air Force veteran, said the reforms simply threw money at the problem and wouldn’t reshape the VA.“It doesn’t fundamentally reform the system. It keeps the same system in place, with minor steps in the right direction at an increased cost. It’s still an attempt to provide unlimited veteran care,” Tanner told The Daily Beast. “All they’ve done is take the existing system and make it slightly more expensive. It’s good for the beneficiaries but bad for the budget deficit.”If the compromise passes both the House and Senate this week, as expected, it will end weeks of frantic—sometimes vitriolic—negotiations just days before lawmakers prepare to leave Washington, D.C., for the August recess.But they would leave on a positive, if small, note, having proved Congress can still push some reforms through.