Small change in stochastic processes $d \int_0^t \sigma_s^2 ds$ Let $\sigma_t$ be a stochastic process with $t \geq 0$. With $M_t := \int_0^T E[\sigma_s^2 | \mathscr{F}_t]ds $. Suppose that 
\begin{equation}
M_t = \int_t^T \sigma_t^2e^{-\kappa(s-t)}+\theta(1-e^{-\kappa(s-t)}) ds + \int_0^t \sigma_s^2 ds
\end{equation}
Why is 
\begin{equation}
dM_t = \int_t^T \kappa\sigma_t^2 e^{-\kappa(s-t)}dt + e^{-\kappa(s-t)}d\sigma_s^2-\kappa \theta e^{-\kappa(s-t)} ds
\end{equation}
What happened to the "$d\int_0^t \sigma_s^2 ds$" term? Why is it not included in the $dM_t$ term. Not sure if this helps but $\sigma_s^2$ is a CIR process.
Thanks in advance!
 A: I may have over-extended.

Prologue. Let $V_t = \sigma_t^2$. The CIR dynamics is
$$
dV_t = \kappa(\theta - V_t)dt + \nu dW_t.
$$
The solution for $s>t$ is
$$
V_s = V_te^{-\kappa(s-t)} + \theta\left(1 - e^{-\kappa(s-t)}\right) + \nu\int_t^s e^{-\kappa(s-t)}dW_t.
$$
From this, its conditional expectation is given by
$$
\mathbb E_t[V_s] = \begin{cases}
V_t & s\le t,\\
V_te^{-\kappa(s-t)} + \theta\left(1 - e^{-\kappa\left(s-t\right)}\right) \qquad & s>t.
\end{cases}
$$
This explains why we have the expression we are computing.

Body. First, we will split the expression into several expressions given by
\begin{aligned}
M_t 
= V_t \int_t^Te^{-\kappa(s-t)}ds + \theta\int_t^T\left(1-e^{-\kappa(s-t)}\right)ds + \int_0^tV_sds 
\triangleq X_t + Y_t + Z_t,
\end{aligned}
such that $dM_t = dX_t + dY_t + dZ_t$. The easiest of these is 
$$
dZ_t = \color{red}{V_tdt}.
$$
Then, you may also compute (abusing of the notation)
$$
dY_t = \frac{\partial Y}{\partial t}dt = -\theta\left(\int_t^T\kappa e^{-\kappa(s-t)}ds\right)dt.
$$
Lastly, we have (abusing of the notation, again)
\begin{aligned}
dX_t 
&= \frac{\partial X}{\partial t}dt + \frac{\partial X}{\partial V}dV_t + \frac 12\frac{\partial^2 X}{\partial V^2}dV_t^2 \\
&= V_t\left(\int_t^T\kappa e^{-\kappa(s-t)}ds \color{red}{- 1}\right)dt + \left(\int_t^T e^{-\kappa(s-t)}ds\right) dV_t.
\end{aligned}
Blending all together, we obtain (notice the terms in $\color{red}{\text{red}}$ cancel each other)
$$dM_t = \left(\int_t^Te^{-\kappa(s-t)}ds\right)\left(dV_t - \kappa\left(\theta - V_t\right)dt\right) = \left(\int_t^Te^{-\kappa(s-t)}ds\right)\nu dW_t.$$

Epilogue. This makes sense because $M$ is a martingale as, for $u>t$,
$$
\mathbb E_t\left[M_u\right] = \mathbb E_t\left[\int_0^T\mathbb E_u\left[V_s\right]ds\right] = \int_0^T\mathbb E_t\left[\mathbb E_u\left[V_s\right]\right]ds = M_t.
$$
