A prophet, grieving, for years
Ya qub lost a son and did not get over it. The Qur'an says he turned away and said, O my sorrow for Yusuf, and that his eyes turned white from grief, and that he was suppressing it. Years of it, visible in his body.
Then the sentence that settles the whole question, in 12:86. I only complain of my suffering and my grief to Allah.
Look carefully at what that separates. Complaint to Allah, which is exactly what he is doing and is permitted. And complaint against Allah, which is a different act. Pouring out grief in front of your Lord is not a failure of patience. In the Qur'an it is what a prophet does.
Qur’an and Sunnah
وَتَوَلَّىٰ عَنۡهُمۡ وَقَالَ يَٰٓأَسَفَىٰ عَلَىٰ يُوسُفَ وَٱبۡيَضَّتۡ عَيۡنَاهُ مِنَ ٱلۡحُزۡنِ فَهُوَ كَظِيمࣱ
and he turned away from them, saying, ‘Alas for Joseph!’ His eyes went white with grief and he was filled with sorrow
Qur’an 12:84
قَالَ إِنَّمَآ أَشۡكُواْ بَثِّي وَحُزۡنِيٓ إِلَى ٱللَّهِ وَأَعۡلَمُ مِنَ ٱللَّهِ مَا لَا تَعۡلَمُونَ
He said, ‘I plead my grief and sorrow before God. I have knowledge from God that you do not have
Qur’an 12:86
Translation: M.A.S. Abdel Haleem, The Qur'an, Oxford University Press, 2004.