This was found while working on
If you have a lesson containing only content pages set up as PAGE1->PAGE2->End of Lesson
If you look in the database after a student completes the lesson, it records the attempt in the mdl_lesson_branch table as attempt (retry) 0. If the student re-attempts the lesson each subsequent attempt is also recorded as retry 0.
If the lesson contains at least 1 question page then the subsequent attempt will be recorded as retry 1.