Near the end of the movie Roscoe asks if computer programs can have a Guardian Angel. If you keep watching you'll see the answer.
Sam calls out Roscoe on how he's falling for Loretta, who she claims isn't real.. but she always has been. She kisses Roscoe, confessing her feelings, and Roscoe is clearly touched and flustered despite still wanting to retrieve Loretta.
At the end of the film, Sam laments she kinda winged it during her performance, and Roscoe laughs at the idea of perfection - and kisses her back, causing Sam's face to nearly split from smiling, she's so happy. The film ends with the two leaving holding hands.