“It is one of these moments where after many years of us trying to get something passed that ends the shutdown, I think there is support coalescing around a legislative response,” Mr. Portman said.

Senator Mark Warner, the Virginia Democrat whose state is home to tens of thousands of federal employees and contractors, introduced his own proposal, partly with the idea of shaming his colleagues and the Trump administration into avoiding such confrontations.

Searching for a bill title that would deliver the message, he and his staff came up with Stop Shutdowns Transferring Unnecessary Pain and Inflicting Damage in the Coming Years, otherwise known as the Stop Stupidity Act. In the event of funding showdowns, his approach would be to maintain spending for all but the legislative branch and the White House.

“More than a little bit of common sense tells me that we wouldn’t be here 35 days into this shutdown if all our staffs were experiencing the same kind of shortfall and economic distress that 800,000 of our fellow federal workers experienced,” he said on the Senate floor.

Mr. Warner acknowledged that his title was somewhat tongue in cheek and that he would be receptive to making changes in the interest of enacting a law that would prevent recurrences of the last weeks.

“The final language in any deal that comes out three weeks from now should put strong provisions and strong penalties in place to prevent this tactic from being used by either party or any White House or Congress in the future,” he said, a view shared by Senator Charles E. Grassley, Republican of Iowa.