When I calculate my credit on MA Form 1 for taxes paid to CT, on Line 1 of the Form 1 Line 30 worksheet, do I enter my CT AGI or the income I earned in CT from my W-2?

 I live in MA and worked in CT until my retirement in July so my AGI includes retirement and pension income. I filed CT Form 1040-NR/PY for my CT income taxes.