Context : Supermassive stars and quasi-stars ( massive stars with a central black hole ) are both considered as potential progenitors for the formation of supermassive black holes . They are expected to form from rapidly accreting protostars in massive primordial halos . Aims : We explore how long rapidly accreting protostars remain on the Hayashi track , implying large protostellar radii and weak accretion luminosity feedback . We assess the potential role of energy production in the nuclear core , and determine what regulates the evolution of such protostars into quasi-stars or supermassive stars . Methods : We follow the contraction of characteristic mass scales in rapidly accreting protostars , and infer the timescales for them to reach nuclear densities . We compare the characteristic timescales for nuclear burning with those for which the extended protostellar envelope can be maintained . Results : We find that the extended envelope can be maintained up to protostellar masses of 3.6 \times 10 ^ { 8 } \dot { m } ^ { 3 } M _ { \odot } , where \dot { m } denotes the accretion rate in solar masses per year . We expect the nuclear core to exhaust its hydrogen content in 7 \times 10 ^ { 6 } yr . If accretion rates \dot { m } \gg 0.14 can still be maintained at this point , a black hole may form within the accreting envelope , leading to a quasi-star . Alternatively , the accreting object will gravitationally contract to become a main-sequence supermassive star . Conclusions : Due to the limited gas reservoir in typical 10 ^ { 7 } M _ { \odot } dark matter halos , the accretion rate onto the central object may drop at late times , implying the formation of supermassive stars as the typical outcome of direct collapse . However , if high accretion rates are maintained , a quasi-star with an interior black hole may form .