Sec. 4. FILING OF APPLICATION. (a) An application for a writ of habeas corpus, returnable to the court of criminal appeals, must be filed in the convicting court not later than the 180th day after the date the convicting court appoints counsel under Section 2 or not later than the 45th day after the date the state's original brief is filed on direct appeal with the court of criminal appeals, whichever date is later.
(b) The convicting court, before the filing date that is applicable to the applicant under Subsection (a), may for good cause shown and after notice and an opportunity to be heard by the attorney representing the state grant one 90-day extension that begins on the filing date applicable to the defendant under Subsection (a). Either party may request that the court hold a hearing on the request. If the convicting court finds that the applicant cannot establish good cause justifying the requested extension, the court shall make a finding stating that fact and deny the request for the extension.
(c) An application filed after the filing date that is applicable to the applicant under Subsection (a) or (b) is untimely.
(d) If the convicting court receives an untimely application or determines that after the filing date that is applicable to the applicant under Subsection (a) or (b) no application has been filed, the convicting court immediately, but in any event within 10 days, shall send to the court of criminal appeals and to the attorney representing the state:
(1) a copy of the untimely application, with a statement of the convicting court that the application is untimely, or a statement of the convicting court that no application has been filed within the time periods required by Subsections (a) and (b); and
(2) any order the judge of the convicting court determines should be attached to an untimely application or statement under Subdivision (1).
(e) A failure to file an application before the filing date applicable to the applicant under Subsection (a) or (b) constitutes a waiver of all grounds for relief that were available to the applicant before the last date on which an application could be timely filed, except as provided by Section 4A.