None of them. It is really a strange bug: the trigger runs fine and also the AI script: the bug happeens randomly when I have at the same time some instances of the same script running fine. For example, let us suppose there are 4 AI players playing with the Empire custom race, it might happen that 3 players run fine, and 1 "gets mad" and decide to invert the harvesting priority, that is, if the priority is "send 5 workers to mine gold and 4 to chop trees" it sends 5 workers to chop trees and 4 to mine gold. But the real mistery is that the other AI runs fine. I suspect it might be a bug in the native HarvestGold and HarvestLumber functions with custom peons, because I really don't understand this behaviour.