The first article of the treaty states that
The Republic of Panama declares that the Canal, as an international transit waterway, shall be permanently neutral in accordance with the regime established in this Treaty
This guaranteed the neutrality of the canal, not the country. To ensure the this the United States reserved the right to intervene in Article IV of the treaty which states:
The United State of America and the Republic of Panama agree to maintain the regime of neutrality established in this Treaty, which shall be maintained in order that the Canal shall remain permanently neutral, notwithstanding the termination of any other treaties entered into by the two Contracting Parties
This effectively provided the United States legal justification to conduct military operations in order to preserve the neutrality of the Canal. The U.S. also secured the right to have priority for its warships to move through and continued free passage through the canal.