  The observed exoplanet population features a gap in the radius distribution
that separates the smaller super-Earths ($\lesssim$1.7 Earth radii) from the
larger sub-Neptunes ($\sim$1.7--4 Earth radii). While mass loss theories can
explain many of the observed features of this radius valley, it is difficult to
reconcile them with potentially rising population of terrestrials beyond
orbital periods of $\sim$30 days. We investigate the ability of gas accretion
during the gas-poor phase of disk evolution to reproduce both the location of
the observed radius gap and the existence of long-period terrestrial planets.
Updating the analytic scaling relations of gas accretion rate accounting for
the shrinking of the bound radius by hydrodynamic effects and deriving a more
realistic disk temperature profile, we find that the late-stage gas accretion
alone is able to carve out the observed radius gap, with slopes $R_{\rm gap}
\propto P^{-0.096}$ and $R_{\rm gap} \propto M_\star^{0.15}$ for top-heavy; and
$R_{\rm gap} \propto P^{-0.089}$ and $R_{\rm gap} \propto M_\star^{0.22}$ for
bottom-heavy core mass distributions, in good agreement with observations. The
general morphology of the primordial radius gap is stable against a range of
disk gas density and disk accretion rate with the latter affecting mostly the
population of large planets ($\gtrsim$3--4$R_\oplus$). The peaks and valleys in
the radius distribution were likely set in place primordially while
post-formation mass loss further tunes the exoplanetary population. We provide
potential observational tests that may be possible with TESS, PLATO and Roman
Space Telescope.
