Education

The 2016 IRS publication 519

https://www.irs.gov/pub/irs-pdf/p519.pdf

states:

------------------------------------

You will not be an exempt individual as a student in 2016 if you have been exempt as a teacher, trainee, or student for any part of more than 5 calendar years unless you meet both of the following requirements.

You establish that you do not intend to reside permanently in the United States.

You have substantially complied with the requirements of your visa.

---------------------------------------

So change 2016 to 2017 and this says you are deemed non-exempt so long as you were in the US even 1 day in 2018.  Payroll is behaving correctly.  Should you tackle the processes described in publication 519 to argue for exemption, chapter 8 discusses payroll taxes.

It is often beneficial to take advantage of non-exempt status as you get the large standard deduction against your US income.  Work the numbers using your 2017 return and the 2018 doubled standard deduction.