THE SENATE'S APPROVAL of the second Panama Canal treaty brings to a merciful close, we hope, one of the United State's most painful and revealing diplomatic/political passages since World War II. It began 14 years ago as not much more than an unexited effort, one for which American power provided and acceptable cushion for failure, to update the terms of American access through a vital waterway. It became, largely by virtue of the American collapse in Vietnam, nothing less than a symbolic test of the nation's capacity to deal in a world it can influence but not control. It ended with a wafer-thin victory for good sense in international affairs, and for the president, but a victory achieved at no little cost to the country's standing and to the administration's standing, too.

We trust that Panama will show a maturity sadly lacking in much American consideration of the treaties, and accept the language added to take the curse off the right to intervene that it wrote into the first. If Panama does, then the way is cleared for the Canal to remain open to American shipping and for relations with Panama and the rest of Latin America to move on.

These may seem modest gains considering the time and political capital and anxiety invested by the administration. Yet it was always true that, in diplomatic terms, there was far more to be lost by failing to modernize the relationship with Panama than there was to be gained by carrying the new treaties through. And as the ratification debate wound on for 10 weeks, it became evident that, in political terms, President Carter could not possibly lose on the treaties without calling into question his whole competence as president. As the roll call began last night . . . Abourezk, Allen . . . one could be forgiven for thinking that the canal was the lesser part of it, especially for Jimmy Carter.

The final roll call had an unmistakable drama, the more so for the suspense cultivated by the senators whose votes were in doubt until they spoke up on the floor. But surely the most telling scene took place the previously day when the final compromise on the DeConcini reservation was struck - by a handful of senators, maintaining their own exclusive channel to Panama, with the administration's people standing in the corridor outside. We cannot recall a similar instance in which an administration had so lost control of a vital international negotiation, or one in which, given the administration's own erratic performance, it was probably to its advantage that it be on the outside. It goes without saying that this does not bode well for the other difficult political/diplomatic negotiations in which Mr. Carter is involved. For the moment, however, it is perhaps enough to breath a grateful sigh of relief.