Though it is truly God who knows what is in our hearts and grants us mercy and forgiveness, I think it is important to look at the words used in confession. The priest says “…through the ministry of the Church may God give you pardon and peace, and I absolve you from your sins in the name of the Father, and of the Son, and of the Holy Spirit.”
Jesus gave the apostles the power to retain or forgive sins, or however that is worded it means that a human being gets to make the call on whether to forgive sins. It could happen in confession that the priest senses that I am not one bit sorry for what I have done and perhaps refuse to grant absolution. He has been given the power to act in the person of Jesus, so if the priest says, “I don’t think that you are sorry about this act”, then our sins are not forgiven. Jesus, of course, could over ride it, but I wouldn’t count on it.