primary residence for less than 2 year and then rented capital gain

Hi there, i have a somewhat tricky question that is baffling me and i am not able to find the answer, will try to explain here.

 

current date is 9/20/2021.

 

i have a home purchased on October 2020 which i use as a primary residence, i am also buying another home in same city which will be ready on Feb 2022 , builder is asking me to occupy the new house as primary residence for two years. here is my dates:

 

1st house purchase date = 10/2020

lived in 1st house until = 1/2022 (15 months)

moved to second house = 2/2022

lived in second house until = 2/2024

1st house rented period = 2/2022 to 2/2024 (2 years)

moved back to 1st house = 3/2024

 proposed sold date1st house = 1/2025

 

in above scenario i have only 50% gain as qualified period, please correct me if i am wrong since i didnt live in my 1st house for 2 years and rented.