There is an AD that requires both fuel caps be vented. No C 172 should be flying without 2 vented caps.
To the OP: I would suggest that as soon as the engine starts misfireing switch to each mag in turn, I had a similar problem in a club airplane. I isolated it to one Mag which despite having just been overhauled, turned out to have a bad coil.