  The observed radii distribution of {\it Kepler} exoplanets reveals two
distinct populations: those that are more likely to be terrestrials
($\lesssim1.7R_\oplus$) and those that are more likely to be gas-enveloped
($\gtrsim2R_\oplus$). There exists a clear gap in the distribution of radii
that separates these two kinds of planets. Mass loss processes like
photoevaporation by high energy photons from the host star have been proposed
as natural mechanisms to carve out this radius valley. These models favor
underlying core mass function of sub-Neptunes that is sharply peaked at
$\sim$4--8$M_\oplus$ but the radial-velocity follow-up of these small planets
hint at a more bottom-heavy mass function. By taking into account the initial
gas accretion in gas-poor (but not gas-empty) nebula, we demonstrate that 1)
the observed radius valley is a robust feature that is initially carved out at
formation during late-time gas accretion; and 2) that it can be reconciled with
core mass functions that are broad extending well into sub-Earth regime. The
maximally cooled isothermal limit prohibits cores lighter than
$\sim$1--2$M_\oplus$ from accreting enough mass to appear gas-enveloped. The
rocky-to-enveloped transition established at formation produces a gap in the
radius distribution that shifts to smaller radii farther from the star, similar
to that observed. For the best agreement with the data, our late-time gas
accretion model favors dust-free accretion in hotter disks with cores slightly
less dense than the Earth ($\sim$0.8$\rho_\oplus$) drawn from a mass function
that is as broad as $dN/dM_{\rm core} \propto M_{\rm core}^{-0.7}$.
