What happens to a wavefunction upon measurement when there's degeneracy?

This occurs in all measurements, because you don't measure the quantum number of every particle in the universe.

If you believe in the Copenhagen interpretation, then in your example the state after measurement is the projection of the original state onto the subspace with energy $$E_n$$. For example, let's use the quantum numbers $$n$$, $$l$$, where $$l$$ is the angular momentum. If the original state was $$|1,0\rangle+i|2,0\rangle-|2,1\rangle$$, and you measure $$n=2$$, then after measurement the state becomes $$i|2,0\rangle-|2,1\rangle$$.

If you believe instead in standard quantum mechanics, then nothing happens to the wavefunction you're observing, but you become entangled with the wavefunction in a way that leads to the same facts about the results of your future measurements.

The measurement is a projection so the appropriate projection operator would be $$\hat\Pi= \sum_{r=1}^k \vert E_n;\alpha_r\rangle\langle E_n;\alpha_r\vert$$ where $$\vert E_n;\alpha_r\rangle$$ is an eigenstate of $$\hat H$$ with energy $$E_n$$ and $$\alpha_r$$ denotes all the other eigenvalues required to fully label your states, given a complete set of commuting observables.

Thus, you’d get $$\vert\Phi\rangle=\hat \Pi\vert \psi\rangle = \sum_r \vert E_n;\alpha_r\rangle c_{r}\, ,\tag{1}$$ where $$c_r=\langle E_n;\alpha r\vert\psi\rangle$$. Note that projection does not preserve the norm so (1) must be normalized by dividing “manually” by $$\sqrt{\sum_r \vert c_r\vert^2}$$.