CONGRESSIONAL LEADERS have settled on a bipartisan spending plan to keep the government open for the next five months, and, to judge from the document, their priorities are not President Trump’s priorities.

To be sure, the $1.1 trillion measure includes $1.5 billion in new border-security money and exceeds previously enacted defense spending caps to the tune of $14.8 billion; Mr. Trump hailed both as victories for his agenda. But the president’s border wall gets not one dollar — indeed, Mr. Trump’s abandonment of a demand for funding was the concession that made this deal possible. Meanwhile, the National Endowment for the Humanities, the Environmental Protection Agency, Pell Grants for college students and Community Development Block Grants were held essentially harmless, with respect to their fiscal 2016 spending levels. The National Institutes of Health gets a $2 billion increase. All were targeted for big cuts in Mr. Trump’s fiscal 2018 budget plan.

These results are a tribute to the Democrats’ skillful leveraging of their power, even as a minority in both houses; to the Republicans’ pragmatic fear of a politically costly partial government shutdown — and to the stubborn persistence of good old-fashioned political horse-trading, even under this supposedly disruptive president. The establishment is in low regard just now in politics. Yet when the government needs to function despite polarization and division, the art of compromise — even of the least-common-denominator variety — is what keeps it going. Fortunately, House Speaker Paul D. Ryan (R-Wis.), Minority Leader Nancy Pelosi (D-Calif.), Senate Majority Leader Mitch McConnell (R-Ky.) and Minority Leader Charles E. Schumer (D-N.Y.) understand that.

One heartening element of the bill incorporates a bipartisan commitment to the idea that America will keep faith with those who have served this country abroad — even if they aren’t Americans. It provides for the admission to this country of 2,500 Afghans who worked as translators and the like for the U.S. military in Afghanistan, under the Special Immigrant Visa program. The program’s authority had lapsed, forcing the government to stop processing new applications two months ago. Now that situation has been remedied — at least for five months.

It’s a temporary victory for basic common sense — much like the spending bill itself. The measure keeps agencies operating, but no one should be under any illusion that it fixes government in the sense of actually restoring a sustainable long-term balance between revenues and outlays.