Allah (swt) does not have permanent enmity, so whatever the slave does, Allah (swt) accepts his repentance. Allah (swt) forgives the sinners because He is the creator of all things, so neither the obedience brings benefits to Him nor the sin harms Him.
If the door of repentance has been closed, the people will go too far in sins and crimes, moreover, they would have lost hope in salvation. Hence, Allah (swt) opened the door of forgiveness even for those who have tortured the believing men and believing women because Allah (swt) does not want oppression and aggression to last, as the repentance clears what have been done before. Let us see the accuracy in the Quranic text:
عَذَابُ الْحَرِيقِ (Burning fire): A kind of punishment in Hell but It is specifically mentioned because the recompense is based upon the type of deed that they performed that is setting the fire in the trench and throwing the believers in it-. Hence, you reap what you sow.
Even though these verses speak about the companions of the trench who did not repent, but it is as if directed to those who were in the time of the Prophet Muhammad (saws).
This is a case of truth and faith that Allah (swt) announces it every time and everywhere.