The function of warning is to verify that the man would continue despite a good knowledge, there is one opinion in Tanayim in masechet Macot (Rabbi Yosi) which said that Talmid Chacham doesn't need warning.
But it seems that if the warned man will answer to the warners one "OK, right I stop it." there is no punishment and Teshuva is good. We are talking about a case that there is no new sin activity after the warning.
Even after this step, after the irreversible decision to punish, Teshuva is valuable but Bet Din Shel Mata ("earth" tribunal) cannot keep in count the intra psychic condition of a man. The condemned will be eliminated. From Achan we learn Viduy the condemned need to say viduy. It is a part of Teshuva. Mishna (6, 2) in Sanhedrin explained that after the Viduy Achan was not cut off from Olam Haba :
הָיָה רָחוֹק מִבֵּית הַסְּקִילָה כְּעֶשֶׂר אַמּוֹת, אוֹמְרִים לוֹ הִתְוַדֵּה, שֶׁכֵּן דֶּרֶךְ הַמּוּמָתִין מִתְוַדִּין, שֶׁכָּל הַמִּתְוַדֶּה יֶשׁ לוֹ חֵלֶק לָעוֹלָם הַבָּא. שֶׁכֵּן מָצִינוּ בְעָכָן שֶׁאָמַר לוֹ יְהוֹשֻׁעַ, בְּנִי שִׂים נָא כָבוֹד לַה' אֱלֹהֵי יִשְׂרָאֵל וְתֶן לוֹ תוֹדָה וְגוֹ' וַיַּעַן עָכָן אֶת יְהוֹשֻׁעַ וַיֹּאמַר אָמְנָה אָנֹכִי חָטָאתִי לַה' אֱלֹהֵי יִשְׂרָאֵל וְכָזֹאת וְגוֹ' (יהושע ז). וּמִנַּיִן שֶׁכִּפֶּר לוֹ וִדּוּיוֹ, שֶׁנֶּאֱמַר (שם) וַיֹּאמֶר יְהוֹשֻׁעַ מֶה עֲכַרְתָּנוּ יַעְכָּרְךָ ה' בַּיּוֹם הַזֶּה. הַיּוֹם הַזֶּה אַתָּה עָכוּר, וְאִי אַתָּה עָכוּר לָעוֹלָם הַבָּא.
When he is about ten cubits away from the place of stoning, they say to him, "confess!", for such is the practice of all who are executed, that they [first] confess, for he who confesses has a portion in the world to come. Even so we find in the case of Achan, that Joshua said unto him, my son, give, I pray thee, glory to the Lord, the god of Israel, and make confession unto him. And Achan answered Joshua and said, of a truth, I have sinned against the Lord the God of Israel, and thus and thus have I done. And whence do we know that his confessions made atonement for him? - From the words, and Joshua said: why hast thou troubled us? The lord shall trouble thee this day, i. e. , this day art thou to be troubled, but thou shalt not be troubled in the next world.
So, Teshuva cannot cancel a decided punishment of Rabbinic tribunal because it is a Ben Adam Lamakom issue, and
Teshuva apparently does be sufficient without punishment.
But there is a notion of "Four subgroups of atonement" (Gemara Yoma 86a), and for sin with Kareth, Teshuva does not be sufficient. He needs to endure suffering.
שאל ר' מתיא בן חרש את ר' אלעזר בן עזריה ברומי שמעת ד' חלוקי כפרה שהיה רבי ישמעאל דורש אמר שלשה הן ותשובה עם כל אחד ואחד עבר על עשה ושב אינו זז משם עד שמוחלין לו שנאמר (ירמיהו ג) שובו בנים שובבים עבר על לא תעשה ועשה תשובה תשובה תולה ויוה"כ מכפר שנאמר (ויקרא טז) כי ביום הזה יכפר עליכם מכל חטאתיכם עבר על כריתות ומיתות בית דין ועשה תשובה תשובה ויוה"כ תולין ויסורין ממרקין שנאמר (תהילים פט) ופקדתי בשבט פשעם ובנגעים עונם אבל מי שיש חילול השם בידו אין לו כח בתשובה לתלות ולא ביוה"כ לכפר ולא ביסורין למרק אלא כולן תולין ומיתה ממרקת שנאמר (ישעיהו כב) ונגלה באזני ה' צבאות אם יכופר העון הזה לכם עד תמותון
Rabbi Matthia Ben Heresh asked Rabbi Eleazar Ben Azariah in Rome: have you heard about the four kinds of sins, concerning which Rabbi Ishmael has lectured? He answered: They are three, and with each is repentance connected - If one transgressed a positive commandment , and repented , then he is forgiven, before he has moved from his place; as it is said: Return, O backsliding chiidren. If he has transgressed a prohibition and repented,then repentance suspends [the punishment] and the Day of Atonement procures atonement, as it is said : For on this day shall atonement be made for you.
from all your sins. If he has committed [a sin to be punished with] extirpation or death through the Beth din, and repented, then repentance and the Day of Atonement suspend [the punishment thereon], and suffering finishes the atonement, as it is said: Then will I visit their transgression with the rod, and their iniquity with strokes. But if he has been guilty of the profanation of the Name, then penitence has no power to suspend punishment, nor the Day of Atonement to procure atonement, nor suffering to finish it, but all of them together suspend the punishment and only death finishes it , as it is said : And the Lord of hosts revealed Himself in my ears; surely this iniquity shal not be expiated by you till ye die.
After this review of two Chazal,
is repentance an effect of having received a punishment or is it separate from that?
--> Separated.
hears his death sentence and then truly repents (not out of fear but maybe out of a realization that he did wrong on a grand scale and a wish to be a better person), must the death penalty be carried out because it is a required consequence or is the penalty eliminated because of teshuva?
--> You see in the paradigmatic case of Achan and Yehoshua, that teshuva and punishment are independent issues. It seems that Yehoshua "objectivized" teshuva of Achan, therefore the issue was not different.
So, tribunal acts only following an objective world (does not use prophecy, Ruach hakodesh {Remember Tanuro shel Achan [not the same achan] in Baba Metsia}) and Teshuva is not counted as an objective event.
I hope that through this, we can answer the Pshat of Gemara Makot 13b quoted by @Fred
"חייבי מיתות ב"ד אינו בכלל מלקות ארבעים שאם עשו תשובה אין ב"ד של מטה מוחלין "
(" whereas those who have become liable to death by sentence of the [human] Court are not subject to the punishment of 'forty lashes' because, [even] if they should do penance, the Earthly Tribunal would not grant them remission").
The Earthly Tribunal has nothing to do with the world of Teshuva, so teshuva does not exist in its world, not that Teshuva is not valuable, it is indistinguible.
But about Psuley Edut, if we know that someone stopped bad activities, he will being again a Kosher witness. Therefore Psule edut is not a condemnation.