to any bars to relief based on preenactment proceedings other than as specified in paragraph (2). (5) Referral to magistrate A Federal court acting under this subsection may refer the petition for review to a Federal magistrate for proposed findings and recommendations pursuant to section 636(b)(1)(B) of title 28, United States Code. (6) Appeal (A) In general A final order on a petition for review under paragraph (1) shall be subject to review on appeal by the court of appeals for the circuit in which the proceeding is held. (B) Appeal by petitioner An individual described in paragraph (1) may appeal a final order on a petition for review under paragraph (1) only if a district or circuit judge issues a certificate of appealability. A district or circuit court judge shall issue or deny a certificate of appealability not later than 30 days after an application for a certificate of appealability is filed. A district judge or circuit judge may issue a certificate of appealability under this subparagraph if the individual has made a substantial showing of actual prejudice to the criminal conviction or sentence of the individual as a result of a violation described in paragraph (1). (b) Violation (1) In general An individual not covered by subsection (a) who is arrested, detained, or held for trial on a charge that would expose the individual to a capital sentence if convicted may raise a claim of a violation of Article 36(1)(b) or (c) of the Vienna Convention on Consular Relations, done at Vienna April 24, 1963, or of a comparable provision of a bilateral international agreement addressing consular notification and access, at a reasonable time after the individual becomes aware of the violation, before the court with jurisdiction over the charge. Upon a finding of such a violation— (A) the consulate of the foreign state of which the individual is a national shall be notified immediately by the detaining authority, and consular access to the individual shall be afforded in accordance with the provisions of the Vienna