Oh! Wait a minute. Let me amend my earlier response.
You are quite right. The situation I described works only if you are the one with two pactmates and they are at war with each other and both stationed in the same (your) city. You get that warning about attacking your pactmate in the situation you describe.
Sometimes you can persuade your pactmate to become unfriendly with your enemy. A probing action against your pactmate, framing your enemy, could work. The direct diplomatic approach seldom works. Often you can corner the energy market with less energy credits than your pactmate will want to break pact with your enemy.
Even if you don't do anything, it seems to be an unstable situation that often resolves itself within ten to twenty years by way of a downgrading of your enemy's and your pactmates diplomatic status (good) or worsening relations between you and your pactmate (bad).