4. As shown in Figure 4, on the arc $AB$ of a sector $OAB$ with a radius of $2 \mathrm{~cm}$ and a central angle of $90^{\circ}$, there is a moving point $P$. A perpendicular line $PH$ is drawn from point $P$ to the radius $OA$, intersecting $OA$ at $H$. Let the incenter of $\triangle OPH$ be $I$. When point $P$ moves from point $A$ to point $B$ along the arc $AB$, the length of the path traced by the incenter $I$ is $\qquad$.
4. $\frac{\sqrt{2} \pi}{2} \mathrm{~cm}$.

As shown in Figure 7, I is the incenter of the right triangle $\triangle P O H$. Connect $O I, P I, A I$. It is easy to prove that
$\triangle O P I \cong \triangle O A I$.
Therefore, $\angle A I O=\angle P I O$.
Since I is the incenter of the right triangle $\triangle P O H$,

we have,
$$
\angle P I O=180^{\circ}-(\angle I O P+\angle O P I)=135^{\circ},
$$

which means $\angle A I O=135^{\circ}$.
Construct a circle passing through points $A, O, I$, with the center at $O_{1}$, and connect $O O_{1}, A O_{1}$. It is easy to prove that $\angle O O_{1} A=90^{\circ}, O O_{1}=\sqrt{2}$. Therefore, the required path length is $\frac{90 \pi \times \sqrt{2}}{180}=\frac{\sqrt{2} \pi}{2} \mathrm{~cm}$.