just have it start a timer after it starts the upgrade, make the timer a bit longer than the upgrade time.
In GAE (not MegaGlest), commands return boolean values if they were successfully given (but not necessarily completed), such as with
giveUpgradeCommand(unitId, upgrade). However, the major limitation of this is that it only works if the Lua script gives the upgrade command, not if the player does, which is not currently possible and there is no way to detect if the upgrade starts!
This could perhaps use some expansion in the future, but in the meanwhile, I would advise against trying to check for changes in the resources, as that would be limited and prone to error. Instead, try and find ways around this inability. For example, in most of my tutorials, where a unit requires an upgrade to be produced, I don't tell the player to perform the upgrade in one step then produce the unit in the next, but rather tell them to do both in one step (that is, perform the upgrade then produce the unit once it's complete). Since the unit requires the upgrade anyway, we can be assured that if the player makes said unit, they must have the upgrade. Of course, it all depends on why exactly you are trying to detect the upgrade. Can you elaborate more?