Sometimes I notice that the comp will change its mind. If you play a battle and you lose but it is really close and you know you can win if you retry the comp learns this and then opts not to attack you I find
It's look like the comp gave away to you😮 I've faced it too but have no idea why it's going on... Maybe it's a bag of the game maybe it's a trap for players to fell themselves like a pro and going on playing it
It happens when the AI has no castles left. It attacks the first available castle with no regard for the odds. Maybe this was the reason why it attacked here as well.