This is the manual for your heater
http://www.pentairpoolme.com/uploads/document/file/554/Manual_MasterTemp.pdf . Pay attention to pages 31 and 32 the connection and ladder diagrams. You will notice that all of the safeties and gas valve are run through the operating control and ignition module. You should first have 24 volts ungrounded to IND on the ignition module through water pressure switch and hi limit to start the inducer (blower) motor which will then make the air flow switch to put 24 volts ungrounded to the TH (W on some) terminal on the ignition module. This should start the ignition trial. After the ignitor warm up time the ignition module powers the gas valve through VAL on the ignition module, but this also goes through the operating control VAL which then goes through the AGS safety to the gas valve. This is your ignition module
Fenwal 35-662944-013 and it is user specifically modified which is why you don't see a W terminal. You should notice on the ladder diagram that one leg of the 24 volt side is grounded. Right after the heater fires up, if you add a jumper from the ignition module VAL terminal to the TH terminal on the gas valve and the heater keeps firing then the problem is either with the AGS switch or the operating control. If it still shuts down then the problem is with flame sensing.