Penal Code PC § 969.5
(a) Whenever it shall be discovered that a pending complaint to which a plea of guilty has been made under Section 859a does not charge all prior felonies of which the defendant has been convicted either in this state or elsewhere, the complaint may be forthwith amended to charge the prior conviction or convictions and the amendments may and shall be made upon order of the court. The defendant shall thereupon be arraigned before the court to which the complaint has been certified and shall be asked whether he or she has suffered the prior conviction. If the defendant enters a denial, his or her answer shall be entered in the minutes of the court. The refusal of the defendant to answer is equivalent to a denial that he or she has suffered the prior conviction.
(b) Except as provided in subdivision (c), the question of whether or not the defendant has suffered the prior conviction shall be tried by a jury impaneled for that purpose unless a jury is waived, in which case it may be tried by the court.
(c) Notwithstanding the provisions of subdivision (b), the question of whether the defendant is the person who has suffered the prior conviction shall be tried by the court without a jury.