4. Let $0<\theta<\pi$, then the maximum value of $\sin \frac{\theta}{2}(1+\cos \theta)$ is

Translate the text above into English, please keep the original text's line breaks and format, and output the translation result directly.
$$
\frac{4 \sqrt{3}}{9}
$$
4.【Analysis and Solution】 $\sin \frac{\theta}{2}(1+\cos \theta)=2 \sin \frac{\theta}{2} \cos ^{2} \frac{\theta}{2}=\sqrt{2} \sqrt{2 \sin ^{2} \frac{\theta}{2} \cos ^{2} \frac{\theta}{2}}$
$$
\begin{array}{l}
\leqslant \sqrt{2} \cdot \sqrt{\left[\frac{2 \sin ^{2} \frac{\theta}{2}+\cos ^{2} \frac{\theta}{2}+\cos ^{2} \frac{\theta}{2}}{3}\right]^{3}} \\
=\sqrt{2} \cdot \sqrt{\left(\frac{2}{3}\right)^{2}}=\sqrt{2} \cdot \frac{2}{3} \sqrt{\frac{2}{3}} \\
=\frac{4 \sqrt{3}}{9} .
\end{array}
$$

The equality holds if and only if $2 \sin ^{2} \frac{\theta}{2}=\cos ^{2} \frac{\theta}{2}$, i.e., $\theta=2 \operatorname{arcctg} \sqrt{2}$. Therefore, the answer should be $\frac{4 \sqrt{3}}{9}$.