How does window length influence cut-off frequency of filter and group delay?
Half average length. What is it?

Primarily something the author made up. They design a lowpass more or less as a weighted moving average filter. They simply use the window itself as the impulse response of the filter. That's NOT the same as designing an ideal low pass filter at the cutoff frequency you want and then windowing it down to the filter order. This seems to work reasonably well, you get frequency response of a nuttall window (which isn't bad) and the cut off frequency is roughly the sample rate divided by the window length.
Ir your sample rate is 44.1kHz and your window length is, say, N=32, the cut off will be around 1320 Hz or thereabouts.

Compensation of the delay. .... What is wrong with my interpretation of this formula?

Your interpretation is correct. If the window length is even, you can't correct for the group delay by simply shifting samples. The code only &quot;approximately&quot; compensates for group delay and is off by half a sample.
There are a few more things wrong about the code:

If someone calls it with half_average &gt; fft_size/4 , bad things will happen
Multiplication in the frequency domain is circular convolution (not linear convolution) in the time domain. The input must be properly zero-padded before FFT to avoid time domain aliasing.