Luke realizes that he’s watching history repeat itself at the end of his duel with Rey when she lowers her lightsaber. She chooses to stop fighting the way he did when he fought Darth Vader in Return of the Jedi. He’s impressed and now knows she has the potential to resist the dark side, unlike before. That’s why he immediately then decides to tell her the truth abouth Kylo Ren. He knows now that she can handle the truth without responding negatively or becoming derailed.