If this was put into the order it could be valid. Was this read into the record also? To get the deduction he will have to get a signed Form 8332 from you that releases the deduction. This could be ordered by the court.
Any individual seeking legal advice for their own situation should retain their own legal counsel as this response provides information that is general in nature and not specific to any person's unique situation. Circular 230 Disclaimer - Advice given in this response cannot be used to eliminate penalties with the IRS or any other governmental agency.
Non custodial parents seeking to claim the personal exemption must attach a copy of a valid state court order or decree to support their claim. If the divorce or separation ocurred after 2008, the non custodial parent is required to submit Form 8332, which requires your written consent.
It is unlikely that the IRS will give weight to a bench side note, that you refer to in your question. Without either a valid order or signed Form 8332, your ex will not be able to use the dependent personal exemption or child tax credit. Prepare and file your return in the normal manner. If you receive a letter from the IRS, provide any information the Service requests to substantiate that you provided the principal place of abode for your child for more than 1/2 of the year.
Please keep in mind that there are many variables that could be applied to the brief facts you have given. The information offered here is general in nature and is not a legal opinion nor is it specific tax advice.