Definitions of Flat Connections I have some questions about the definitions of flat connections, and want to make sure if my understanding is correct.
In Jost's Riemannian Geometry and Geometric Analysis, two definitions of flatness for connections are given:

(Definition 4.1.5) The curvature of a connection $D$ on the vector bundle $E$ is the operator $$F = D \circ D: \Omega^0(E) \to \Omega^2(E)$$
The connection is called flat, if its curvature satisfies $F=0$.

For a connection on the tangent bundle $TM$,

(Definition 4.1.8) A connection $\nabla$ on $TM$ is flat if each point in $M$ possesses
a neighborhood $U$ with local coordinates for which all the coordinate vector fields
$\frac{\partial}{\partial y^i}$ are parallel, that is, $$\nabla \frac{\partial}{\partial y^i} = 0$$

Later, it shows that

(Theorem 4.1.3) A connection $\nabla$ on $TM$ is flat if and only if its curvature and torsion
vanish identically.

In definition 4.1.5, if we take $E = TM$, then the flatness just means vanishing curvature. Therefore, if a connection on $TM$ is flat in the sense of definition 4.1.8, then by theorem 4.1.3, it is also flat in the sense of definition 4.1.5.
I am wondering whether the converse is also true? Or is there any example where the connection has vanishing curvature but nontrivial torsion?
I also saw in Tu's Differential Geometry that the concept of torsion does not make sense for a connection on an arbitrary vector bundle. I suppose this is the reason why we merely require vanishing curvature for flat connections on an arbitrary vector bundle. Therefore, we have two (possibly) different definitions for flat connections on $TM$.
 A: Curvature and torsion are both ‘obstructions to integrability’, but in slightly different senses, and so as mentioned in the comment, the two definitions are not equivalent. The correct theorems, which I think will clarify things for you, are the following:

Theorem 1. (Curvature is obstruction to existence of local parallel frames)
Let $E$ be a (rank $k$) vector bundle (over an $n$-dimensional base $M$) with a connection $D$. Then, the curvature $F$ vanishes if and only if about each point of the base manifold there is a smooth local frame of parallel sections of $E$ (i.e there exist smooth local sections $\{e_1,\dots, e_k\}$ which satisfy $De_i=0$ identically).

One direction is easy, because $F(\cdot,\cdot)\cdot e_i=D(De_i)=0$. For the converse, one way to prove it is to first establish that vanishing curvature implies that locally, parallel-transport is path-independent. Then, you fix a point $p$ in the base manifold, a basis $\{v_1,\dots, v_k\}$ of the fiber $E_p$, and then parallel-transport it all over (well-defined due to path-independence) a small neighborhood of $p$ to get local sections $\{e_1,\dots, e_k\}$; these sections are smooth by ODE regularity theory. By construction, these guys are parallel with respect to $D$.
Now, you can specialize to $TM$, and the above statement is of course still true. A natural question one might ask in the case of $E=TM$ is under what conditions one may take the local parallel sections $\{e_1,\dots, e_n\}$ of $TM$ (guaranteed to exist by the previous theorem) to be those arising from some coordinates: $e_i=\frac{\partial}{\partial x^i}$? Well, this happens if and only if the $e_i$’s Lie-commute with each other: $[e_i,e_j]=0$ for all $i,j$. Now, the torsion $T$ is equal to
\begin{align}
T(e_i,e_j)=\nabla_{e_i}e_j-\nabla_{e_j}e_i-[e_i,e_j]=0-0-[e_i,e_j],
\end{align}
where the $0$’s are due to being parallel sections. So, we see that the $e_i$’s come from some coordinates $x^i$ if and only if they Lie-commute, which happens if and only if the torsion vanishes. Thus,

Theorem 2. (Curvature and torsion are obstruction to existence of local parallel coordinate frames)
Let $M$ be a smooth manifold, and $D$ a connection on $TM$. Then, the curvature and torsion vanish if and only if about each point of $M$ there is a local coordinate chart $(U,x)$ such that the vector fields $\frac{\partial}{\partial x^i}$ are parallel with respect to $D$.

So, curvature (on any vector bundle) obstructs the existence of parallel frames, while torsion (in the case of $TM$) is the further obstruction to making them coordinate frames.
As a further corollary of theorem $2$, we can see that in the case of a (pseudo-)Riemannian manifold $(M,g)$, with the Levi-Civita connection (torsion free by definition) there exists an ‘orthonormal’ system of coordinates if and only if the curvature vanishes. This is the so-called ‘fundamental theorem of Riemannian geometry’ (which Spivak proves like 5 different ways in Vol II of his Differential geometry books).
