City of Irving v. Inform Constr., Inc
In City of Irving v. Inform Constr., Inc., 201 S.W.3d 693 (Tex. 2006), the Court held that a city "does not have immunity from suit for claims germane to, connected with, and properly defensive to its counterclaim to the extent the opposing party's claims act as an offset against the city's recovery."
The Court also explained that these rules apply even if the city's counterclaim is compulsory. Id.