This is different from any other AI topic which is why I started a new one for it. Basically if you are at peace with an AI and both of you are at war with a common enemy, you aren't allowed to help them defend their cities. I had one weak AI that was basically a buffer between me and a much stronger AI on the other side, we were at peace and his last city was besieged by a very large army. I sent in a buffed up bearman and started wrecking enemy units near his city to help them out (and because I didn't want that army on my cities), logic tells me this would make the AI grateful (that's how it works in other games), after a couple dozen turns of helping this AI, it spontaneously declares war on me. This has never happened before, I didn't even think it was possible, no message, no demand, just war out of nowhere. So I checked the diplomacy panel... -389 for trespassing. So while I'm saving his last city from certain doom, he's getting pissed at me so much for trespassing that even though he has no army left at all he declares war on me. This really shouldn't happen, there should be significant diplomatic boosts for killing an enemy unit near another AI's city, and a much lower cap for trespassing of like -20 or -15.