The Prophet ﷺ prayed three rakahs and then gave the salam.Kharbaq said, "You prayed only three rakahs."So he led them in the remaining rakah, then gave the salam, performed the two prostrations of forgetfulness, and gave the salam again.
أخبرنا يحيى بن حبيب بن عربي قال حدثنا حماد قال حدثنا خالد عن أبي قلابة عن أبي المهلب
أن النبي ﷺ صلى ثلاثا ثم سلم فقال الخرباق إنك صليت ثلاثا فصلى بهم الركعة الباقية ثم سلم ثم سجد سجدتي السهو ثم سلم