If you begin to sin but don’t follow all the way through… is it still a sin? It depends.
We’re offered two different scenarios. In one, the person is prevented from sinning due to external factors that make it impractical or impossible to commit the sin they had planned on. In the second scenario, we see someone preparing to sin, but then freely and rationally choosing not to. The first scenario is a sin, but the second is a virtuous act. Why?
Because the second person freely decided not to commit sin, they morally aligned themselves toward the good when they had previously been aimed towards sin. They redirected their will toward God when they could have continued to go against him. In a simpler sense, they were headed down a bad path, but then turned around before making it to their destination.
That being said, while the second person did realign themselves toward virtue, the extent to which they consented to this sin ahead of time may be worth a confession. Even though the person chose virtue in the end, their soul was still burdened with those thoughts, and in confession, those burdens are lifted through forgiveness.
The beautiful part about our faith is that we have a Savior who is always ready and willing to forgive us. Surrendering our hearts to him creates a living relationship with God, where we trust his knowledge of our hearts, and run to him whenever we are in need of saving.