Mujahid reported,

I went to see Ibn Abbas and said, "Abu Abbas, I was with Ibn Umar when he recited a verse and wept."He asked, "Which verse?"I said, "If you disclose what is in your souls or conceal it, Allah will bring you to account for it" [Baqarah 2:284].Ibn Abbas said, "When this verse was revealed, it grieved the companions of the Messenger of Allah ﷺ severely and distressed them greatly. They said, 'Messenger of Allah, we are ruined if we are to be held accountable for what we say and what we do. As for our hearts, they are not within our control.'The Messenger of Allah ﷺ said to them, 'Say, We hear and we obey.'Then this verse abrogated it, "The Messenger has believed in what was revealed to him from his Lord, and so have the believers," up to, "Allah does not burden a soul beyond what it can bear. It will have what it has earned, and against it what it has gained" [Baqarah 2:285–286]. So they were excused regarding the whisperings of the soul, and were held to account only for their deeds."

Ahmad 3070

Sahih

حدثنا عبد الرزاق أخبرنا معمر عن حميد الأعرج

عن مجاهد قال

دخلت على ابن عباس فقلت يا أبا عباس كنت عند ابن عمر فقرأ هذه الآية فبكى قال أية آية قلت {إن تبدوا ما في أنفسكم أو تخفوه يحاسبكم به الله} قال ابن عباس إن هذه الآية حين أنزلت غمت أصحاب رسول الله ﷺ غما شديدا وغاظتهم غيظا شديدا يعني وقالوا يا رسول الله هلكنا إن كنا نؤاخذ بما تكلمنا وبما نعمل فأما قلوبنا فليست بأيدينا فقال لهم رسول الله ﷺ قولوا سمعنا وأطعنا قال فنسختها هذه الآية {آمن الرسول بما أنزل إليه من ربه والمؤمنون إلى لا يكلف الله نفسا إلا وسعها لها ما كسبت وعليها ما اكتسبت} فتجوز لهم عن حديث النفس وأخذوا بالأعمال

أحمد 3070صحيح
Contents
Reference
Commentary
Ayat
Collection
Musnad Ahmad
Book
Abdullah bin Abbas bin Abdul-Muttalib
Numbering
Darussalam 3070
Ahmad 3070