The present invention relates to compounds useful as inhibitors of ATR protein kinase. The invention also relates to pharmaceutically acceptable compositions comprising the compounds of this invention; methods of treating of various diseases, disorders, and conditions using the compounds of this invention; processes for preparing the compounds of this invention; intermediates for the preparation of the compounds of this invention; and methods of using the compounds in in vitro applications, such as the study of kinases in biological and pathological phenomena; the study of intracellular signal transduction pathways mediated by such kinases; and the comparative evaluation of new kinase inhibitors.The compounds of this invention have formula I:or a pharmaceutically acceptable salt, wherein the variables are as defined herein.Moreover, The compounds of this invention have formula I-A:or a pharmaceutically acceptable salt, wherein the variables are as defined herein.