For example: if Bob is lusting after Susie, but then he realizes that he is lusting and stops, did Bob commit a mortal sin? Or would that be venial? Or would Bob only commit a mortal sin if he realizes he is lusting and continues to lust?
One cannot accidentally or inadvertently commit a serious sin.
*1857 For a sin to be mortal, three conditions must together be met: “Mortal sin is sin whose object is grave matter and which is also committed with full knowledge and deliberate consent.”
1858 Grave matter is specified by the Ten Commandments, corresponding to the answer of Jesus to the rich young man: "Do not kill, Do not commit adultery, Do not steal, Do not bear false witness, Do not defraud, Honor your father and your mother."132 The gravity of sins is more or less great: murder is graver than theft. One must also take into account who is wronged: violence against parents is in itself graver than violence against a stranger.
1859 Mortal sin requires full knowledge and complete consent. It presupposes knowledge of the sinful character of the act, of its opposition to God’s law.** It also implies a consent sufficiently deliberate to be a personal choice.** Feigned ignorance and hardness of heart do not diminish, but rather increase, the voluntary character of a sin. *
You answered your won question. Your can’t accidentally commit a mortal sin. The three things necessary to commit a mortal sin are 1) grave matter, 2) full knowledge of the sin, and 3) full consent of the will.
Your example is the following situation with regard to this.
Check, what Jesus said about lusting means it is grave matter
Nope, Bob was not aware at the time of doing this
Nope, as soon as he became aware of it, he stopped.