I was playing last night and noticed two of the stronger powers attacking the Dhayuts, who are widely hated. So I take advantage and jump in. I get a spy in deep cover, and can see the enemy has no fleet left. My AI "allies" are doing the AI thing, basically noodling around making little progress. I send in my assault ships to capture planets. I get a few, but in the main system I am interested in the enemy has 15 armies on a planet. OK, I send in my assault of about the same, with a followon ship dropping seven more. This is probably half my total armies at the time.
The attack takes a while. I notice my AI allies going for the planet too. Well, I am not sure what will happen but there's nothing I can do. So they drop armies too -- a lot of them. Many of mine have been lost in the heavy fighting earlier. Anyway, the planet ends up going to one of my allies. I did all the real work! This is bad enough, but hey, maybe they did have more armies than me when it turned. That's the luck of the draw.
What burns me here is that my armies defected to my ally! I can still see them there, about a third of his army.
So... what should I have done? How can you prevent the AI from stealing your assaults? And conversely, what is the rule for who gets the planet in an N-way attack? How can I steal planets from the AI?