Not sure what's code, but I had a natural draft water heater with a vent that went up 18" , elbowed horizontal 12" and tee'd into a 6" pipe that it shared with my furnace. Sometimes it would back draft and spill combustion gas into basement. Could be from dryer running, bathroom vent fan, Air pressure drop. I was getting really high readings on my digital CO detector. WH was old and I got sick of trying to solve it so I replaced with a powervented model.
I'd get a CO detector in there to see if your getting back drafting. Granted my problem was probably more about the 6" shared class B chimney. That's a pretty big pipe for a 40k btu water heater to be orphaned into during the non-heating season.