I'll keep this short. Just wanted to get an expert opinion if possible.
I'd lived in the US since 2001 on a F1 and then on E3 visas until October 2019. Between last October and August 2020 I'd spent approx 160 days in the US on an ESTA. I'd had laser eye surgery just over a year ago and because of some complications I needed follow-up visits to my eye doctor in NYC, hence my spending so much time there.
When I last entered the US in August, I was admitted by CBP but, as I'd been pre-approved for Global Entry I then went to another desk for my enrolment interview. That agent pulled up my travel history, saw discrepancies between the US address I'd provided on the application and my new overseas home address, and sent me for a secondary. In the secondary I was basically accused of working in the US illegally (I haven't been) and was told that if I didn't depart on the date I told them I'd be leaving (9 days later) I'd have issues the next time I entered. He also said if it hadn't been for COVID he'd have deported me. I left the day before the date I'd mentioned as I needed to be back in my home country.
Since then my Global Entry application has gone back to "pre-approved" status. I'm just concerned because the CBP agent typed a lot of notes during the secondary and I suspect I will have problems re-entering on an ESTA or even getting a new ESTA. I don't have plans to return to the US but obviously hope to avoid complications in the future.