Solution (source code)

= Solution

Direct calculation gives
$$
W=(1+\cos x)\cos x+\sin^2x=1+\cos x.
$$
Where $1+\cos x\ne0$, <Abel identity> gives $p=-W'/W=\sin x/(1+\cos x)$, and substitution of either solution gives $q=1/(1+\cos x)$. Thus
$$
\boxed{p(x)=\tan(x/2),\qquad q(x)=\frac1{1+\cos x},\qquad W(\pi)=0.}
$$
These coefficients have singularities at odd multiples of $\pi$. This does not contradict the <Wronskian> criterion: its continuous-coefficient interval hypothesis fails at those points.

On $0\le x<\pi$, the initial conditions uniquely select $y=\sin x$. \b[The normalized differential equation is not defined on the whole interval $0\le x<\infty$], so the usual global <uniqueness theorem for ordinary differential equations> cannot give the global initial-value assertion as posed. No choice of finite coefficients at $\pi$ can repair the normalized equation while retaining both displayed solutions: at that point $1+\cos x$ and its first derivative vanish, but its second derivative equals one.

The <continuation through a zero of the leading ODE coefficient> is a different problem: consider the multiplied, degenerate equation
$$
(1+\cos x)y''+\sin x\,y'+y=0.
$$
For this different equation, a globally $C^2$ solution with the given initial data is uniquely $\sin x$. On each regular interval every solution is $A_j(1+\cos x)+B_j\sin x$; continuity of $y'$ and $y''$ at an odd multiple of $\pi$ forces both constants to agree across it. If only $C^1$ piecewise solutions away from the singular points are required, the $A_j$ may change and uniqueness fails. Thus the coefficient singularity and the intended solution regularity must be distinguished.