4. A square piece of paper with a side length of 2 (vertices are $A$, $B$, $C$, $D$, and the center is $O$) is folded into a regular quadrilateral pyramid $O-A B C D$. When the volume of the quadrilateral pyramid is maximized, the size of the dihedral angle $A-O B-C$ is $\qquad$
4. $\frac{2 \pi}{3}$.

As shown in Figure 2, draw $A E \perp O B$ at point $E$, and connect $C E$. Then $C E \perp O B$, and $\angle A E C$ is the plane angle of the dihedral angle to be found. Let $H$ be the center of the base. Then $O H \perp$ plane $A B C D$. Draw $H F \perp A B$, and connect $O F$.
By the theorem of three perpendiculars, we get $O F \perp A B$.
Let $A B=2 x$. Then
$$
\begin{array}{l}
B F=x, A H=H C=\sqrt{2} x, \\
O H=\sqrt{O B^{2}-H B^{2}}=\sqrt{2\left(1-x^{2}\right)} . \\
\text { Therefore, } V_{\text {regular pyramid } O-A B C D}=\frac{4 x^{2}}{3} \sqrt{2\left(1-x^{2}\right)} \\
=\frac{4}{3} \sqrt{2\left(1-x^{2}\right) x^{2} x^{2}} \\
\leqslant \frac{4}{3} \sqrt{\left(\frac{2}{3}\right)^{3}}=\frac{8 \sqrt{6}}{27} .
\end{array}
$$

By the equality condition of the arithmetic mean-geometric mean inequality, we know that when and only when $x=\frac{\sqrt{6}}{3}$, $V_{\text {regular pyramid }} O-A B C D$ reaches its maximum value.
Also, $O F=\sqrt{O B^{2}-B F^{2}}=\frac{2 \sqrt{3}}{3}$,
$O F \cdot A B=A E \cdot O B$,
then $A E=\frac{O F \cdot A B}{O B}=\frac{4}{3}=C E$.
And $A C=\sqrt{2} A B=\frac{4 \sqrt{3}}{3}$, so by the cosine rule we get
$\cos \angle A E C=\frac{A E^{2}+C E^{2}-A C^{2}}{2 A E \cdot E C}=-\frac{1}{2}$.
Since $0<\angle A E C<\pi$, therefore, $\angle A E C=\frac{2 \pi}{3}$.