(Karen Bleier/AFP/Getty Images)

LET’S BEGIN by thanking Congress for small favors: Top lawmakers from both parties have agreed on a $1.01 trillion spending bill that will fund all but one federal department through September, thereby averting a shutdown like the one that entangled Washington for 16 days last year. (The Department of Homeland Security will get enough cash to last only through February, as a sop to Republicans outraged by President Obama’s unilateral decision to change immigration policy.) In addition to agency appropriations, the bill would provide billions in funding for such emergencies as the Ebola outbreak in West Africa and the war against the Islamic State.

That Congress has averted major chaos, however, does not imply that chaos of a more minor kind no longer reigns on Capitol Hill. The gargantuan bill includes a host of provisions, both budgetary and policymaking, that could only have made it through amid last-minute horse-trading on sweeping, must-pass legislation. One is a provision blocking a D.C. referendum on marijuana, which we discuss in another editorial.

Reflecting the GOP’s rising power, the Environmental Protection Agency and the Internal Revenue Service both will sustain significant cuts — of $60 million and $346 million, respectively. The latter is especially unjustifiable since the IRS’s budget in the current fiscal year, $11.3 billion, already represented a $525 million fall-off since fiscal 2012. Republicans love to take shots at the hated tax collectors but never explain how the agency is supposed to rein in fraud and mistaken payments — including $14.5 billion in excess earned-income tax credits, about which the GOP also complains mightily — without the funds to do the job.

As for policy changes, the bill would give federally insured banks relief from rules that had limited their use of derivatives, a slight but symbolically important shift of risk from financiers to taxpayers. At least Congress balanced that by supplying more funding for the Commodity Futures Trading Commission and the Securities and Exchange Commission. Meanwhile, there was no such saving grace in a section of the bill providing nearly $1.5 billion in fresh support, most of it military, to Egypt. The provision keeps human-rights conditions on the aid to that brutal dictatorship but makes it much too easy for the Obama administration to waive them on national-security grounds. All it would take is a classified assurance from the secretary of state to Congress. After a year in which the Cairo regime has jailed journalists and issued mass death sentences to its political opponents, among other trangressions, this is the worst possible signal to send.

In this mess of a mega-bill, there was one piece of bipartisan farsightedness. Reps. John Kline (R-Minn.) and George Miller (D-Calif.) crafted a provision that should help ensure the sustainability of large, decreasingly solvent multiemployer union pension funds that might otherwise fail and confront Congress with a choice between bailing them out and leaving retirees with nothing. The measure, which allows pensions to trim existing benefits, was the least painful option — as several key labor unions that supported it recognized. Looking at the bill as a whole, we’d call this fair and responsible provision the exception that proves the rule.