  We examine the impact of the ion dynamics on laser-driven electron
acceleration in an initially empty channel irradiated by an ultra-high
intensity laser pulse with $I > 10^{22}$ W/cm$^2$. The negative charge of the
accelerated electrons inside the channel generates a quasi-static transverse
electric field that causes gradual ion expansion into the channel. Once the
ions fill the channel, the pinching force from the quasi-static magnetic field
generated by the accelerated electrons becomes uncompensated due to the
reduction of the quasi-static transverse electric field. As a result there are
two distinct populations of accelerated electrons: those that accelerate ahead
of the expanding ion front while moving predominantly forward and those that
accelerate in the presence of the ions in the channel while performing strong
transverse oscillations. The ions diminish the role of the longitudinal laser
electric field, making the transverse electric field the dominant contributor
to the electron energy. The ion expansion also has a profound impact on the
gamma-ray emission, causing it to become volumetrically distributed while
reducing the total emitted energy. We formulate a criterion for the laser pulse
duration that must be satisfied in order to minimize the undesired effect from
the ions and to allow the electrons to remain highly collimated.
\textcolor{black}{We demonstrate the predictive capability of this criterion by
applying it to assess the impact of a given pre-pulse on ion expansion. Our
results provide a} guideline for future experiments at multi-PW laser
facilities with ultra-high intensities.
