As recently as Wednesday, federal employees were receiving ominous instructions: prepare, once again, for a possible government shutdown. The deadline for a spending deal was Friday night.

Late yesterday, an agreement came together.

Congressional negotiators signed off Thursday evening on a $1 trillion spending agreement for 2012 for federal agencies, barely 27 hours before a deadline that could have led to a government shutdown.

After dropping minor policy prescriptions that President Obama opposed, members of the House and Senate Appropriations Committees gave final approval to the plan after a four-day standoff related to Obama’s demands to extend the payroll tax holiday for 160 million workers.

The leaders of both parties in both chambers accepted the terms last night, after some modest concessions, but the measure still needs to be approved by House and Senate members today. Passage looks to be a near-certainty.

The spending package will fund federal operations though the end of the fiscal year, which wraps up in September, and sets spending at $1.043 trillion — a figure agreed upon during the debt-ceiling crisis in August — which represents a 1.5% cut from the previous year.

Stepping back for a moment, let’s note a couple of relevant angles for context. First, Congress is waiting until the last possible day to avert a shutdown — and this is the third time this year that’s happened. In April, an agreement wasn’t reached until the last possible day; in August, the debt-ceiling deal wasn’t reached until the last possible day; and now we’re seeing the same thing again in December. It’s not encouraging.

Second, and on a related note, I’m delighted that a deal was reached — shutdowns don’t do anyone any favors — but no one should mistake the agreement as evidence of an effective legislative branch of government. In other words, we shouldn’t be impressed when Washington manages to somehow keep the lights on. The fact that a shutdown was even a possibility this week only reinforces fears that Congress is basically hopeless — lawmakers shouldn’t struggle to complete the most basic tasks, and avoiding shutdowns need not be deemed an accomplishment.

And what about the fight over extending the payroll tax break? The White House and some Democratic leaders had hoped to tie the issue to the larger spending bill — telling Republicans to pass the tax cut or shut down the government — but those efforts faltered, and the issues were decoupled this week.

Talks on the payroll issue continue, however, and several leading lawmakers sounded optimistic notes yesterday. Dems have already given up on a surtax on millionaires and billionaires, and most of the talk yesterday focused on a two-month extension of the payroll cut, allowing lawmakers to revisit this fight in February (rather than delaying their holiday break).

Chances are, if a deal is reached on the payroll cut, it’ll be approved no sooner than the weekend.

Our ideas can save democracy... But we need your help! Donate Now!

Follow Steve on Twitter @stevebenen. Steve Benen is a producer at MSNBC's The Rachel Maddow Show. He was the principal contributor to the Washington Monthly's Political Animal blog from August 2008 until January 2012.