Just ran into a bug that seems highly uncommon, but might be tied into why AI controlled units sometimes do not fire when they should.
It was during a battle with the enemy carrier and I had already destroyed all its mantas, walruses, and most of its defensive guns. I sent in all my own units to attack it at once, including the carrier. The carrier however never fired its weapons even though it was well in range. I took direct control of the carrier weapons and switched to a defensive gun facing in the direction of the enemy carrier. I noticed that sometimes the gun would fire on its own without me pulling the trigger. It always happened when I was aiming for a certain point, where the AI would normally fire on it.
So the AI was firing the gun when I was manually aiming for the point it wanted to fire on, but it was not automatically aiming or firing when I switched to control of a different unit.
It seems as if some AI components do not toggle state properly between AI and player control.