Stop in for a cup of coffee

The pilot would go out after a cycle and not relight. I could manually relight it. Rheem Tech Service said it needed a gas valve and the thermocouple was ok. (apparently)
I am no furnace/water heater guy, but if the pilot would go out after a cycle, not relight, but can manually relight, I wouldn't think it is the gas valve - gas is present if you can manually relight. Unless I don't understand the system. What tells the pilot to relight??

This is water on demand system?