The Messenger of Allah ﷺ said: There are three (persons) whose actions are not recorded: a sleeper till he awakes, an idiot till he is restored to reason, and a boy till he reaches puberty.
أَنَّ رَسُولَ اللَّهِ ﷺ قَالَ رُفِعَ الْقَلَمُ عَنْ ثَلاَثَةٍ عَنِ النَّائِمِ حَتَّى يَسْتَيْقِظَ وَعَنِ الْمُبْتَلَى حَتَّى يَبْرَأَ وَعَنِ الصَّبِيِّ حَتَّى يَكْبَرَ