Does Allah’s pleasure extend to all of those who swore allegiance at al-Hudaybiyah?
Question

Is Allah pleased with all of those who swore allegiance beneath the tree (may Allah be pleased with them), as the verse indicates? Or were there some of the hypocrites who swore allegiance, or were there other exceptions?
Praise be to Allah.Allah, may He be exalted, says (interpretation of the meaning):
{Certainly was Allah pleased with the believers when they pledged allegiance to you, [O Muhammad], under the tree, and He knew what was in their hearts, so He sent down tranquillity upon them and rewarded them with an imminent conquest} [al-Fath 48:18].
Here Allah, may He be glorified and exalted, describes those who swore allegiance as believers, which rules out the possibility of them being hypocrites, and he gave them the glad tidings that He is pleased with them. The fact that this description and promise includes all of those who swore allegiance is supported by the hadith of Jabir ibn ‘Abdullah (may Allah be pleased with him), who said: The Messenger of Allah (blessings and peace of Allah be upon him) said to us on the day of al-Hudaybiyah: “You are the best of the people of earth.” And we were one thousand four hundred men. If I could see today, I would show you the spot where the tree was. Narrated by al-Bukhari (4154) and Muslim (1856).
According to the hadith of Jabir, the Messenger of Allah (blessings and peace of Allah be upon him) said: “None of those who swore allegiance beneath the tree will enter Hell.” Narrated by Abu Dawud (4653) and by at-Tirmidhi (3860), who said: This is a sahih hasan hadith.
This is also supported by the terms of the oath of allegiance, as there are reports which say that it included a promise that they would not flee.
It was narrated that Ma‘qil ibn Yasar said: I remember the day of the tree, when the Prophet (blessings and peace of Allah be upon him) received the people’s oath of allegiance, and I was holding one of its branches away from his head, and we were fourteen hundred. He said: We did not swear to fight to the death, but we swore not to flee. Narrated by Muslim (1858).
According to another report, the oath was to fight to the death.
It was narrated that Salamah (may Allah be pleased with him) said: I swore allegiance to the Prophet (blessings and peace of Allah be upon him), then I went to the shade of the tree. When the number of people grew less, he said: O Ibn al-Akwa‘, won’t you swear allegiance? I said: I have already sworn allegiance, O Messenger of Allah. He said: “Do it again.” So I swore allegiance to him again. I [the narrator] said to him: O Abu Muslim, on what basis did you swear allegiance to him on that day? He said: That we would fight to the death. Narrated by al-Bukhari (2960) and Muslim (1860).
Such a serious oath could not be sworn by any but people of deeply-rooted faith. It was narrated from Ibn Jurayj: Abu’z-Zubayr told me that he heard Jabir asking: How many were they on the day of al-Hudaybiyah? He said: We were fourteen hundred, and we swore allegiance to him whilst ‘Umar was holding his hand beneath the tree, which was an acacia. We swore allegiance to him, except for Jadd ibn Qays al-Ansari, who hid beneath the belly of his camel. Narrated by Muslim (1856).
Moreover, these texts indicate that all of those who swore allegiance were true believers and Allah was pleased with them, and there is nothing to contradict that. There is no proven report which suggests that some of the hypocrites were present among those who swore allegiance.
The fact that there were hypocrites in Madinah does not necessarily mean that they were among the army of al-Hudaybiyah, because the number mentioned of those who swore allegiance does not include all the fighters among the people of Madinah. What is narrated in as-Sahihayn is that they numbered one thousand and four hundred, as noted above in the hadiths of Jabir and Ma‘qil ibn Yasar. At the battle of the Trench (al-Khandaq), which took place before al-Hudaybiyah, approximately three thousand fighters were present, according to the majority of scholars.
Dr. Akram Diya’ al-‘Umari said:
As for the Muslim army – on the day of al-Khandaq – Ibn Ishaq said that there were three thousand fighters, and the majority of Sirah scholars followed him in that. Ibn Hazm stated that they were seven hundred only, and he based that on the fact that the Muslims were seven hundred strong at Uhud, and between Uhud and al-Khandaq, in his view, there was one year, so how could the Muslims reach the number of three thousand fighters?
But the view of Ibn Hazm, which he was certain of, is not correct, because the number of those who attended the wedding feast in the house of Jabir ibn ‘Abdillah  was one thousand, as it says in the sahih hadith, and the number of those who played a role in guarding Madinah was five hundred. So how could the rest of the army be nine hundred? The time between Uhud and al-Khandaq was two years, during which a number of the boys who were not present at Uhud because they were too young grew up, and the Muslims put a great deal of effort into calling people to Islam despite the dangers, and people migrated to Madinah after they entered Islam. So it is not strange that the numbers of the Muslim army increased."(As-Sirah an-Nabawiyyah  2/426).
To sum up: Allah’s good pleasure with those who swore allegiance in Bay‘at ar-Ridwan includes all of them, and the texts of the Sunnah, which are revelation (wahy), confirm that.
And Allah knows best.