You are somehow getting power to the shunt trip on re-energize of the building.
Do you need to do anything other than reset to get it to reset after trip? If not, your trip circuit is somehow becoming energized when you lose power to the building but whatever it is is changing state as it gets powered up and you lose the trip voltage.
I have never had an Ansul installer wire the shunt trips nor have I ever seen them do it. Around here, that is not their work nor are they licensed to do it. It has always been my job.
Just out of curiosity and diagnosis, have you tried disconnecting the trip circuit. You may have a bad breaker that cannot handle the inrush current caused on power-up. Disconnect the trip power (or turn off the circuit that powers it) and imitate a power loss. If upon re-energize, things are ok, look to the trip circuit intermittant power. If it trips out, then a new breaker or diagnosis of the 40 amp circuit is in order.